UN-2805 [FEAT] Add custom_data parameter for API deployment variable replacement overrides#201
Conversation
…nt overrides - Added USER_DATA constant to MetadataKey class for user data handling - Updated BaseTool to extract and store user_data from execution metadata - Version bump to v0.77.2 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary by CodeRabbit
WalkthroughUpdates SDK version to v0.77.2, introduces a new metadata key USER_DATA, and extends BaseTool to expose a user_data attribute populated from tool metadata (defaulting to an empty dict). Minor non-functional formatting change in an error raise within BaseTool. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant BaseTool
participant ToolArgs as ToolArgs (includes METADATA)
rect rgba(200,235,255,0.3)
note over Caller,BaseTool: Tool construction via from_tool_args
Caller->>BaseTool: from_tool_args(tool_args)
BaseTool->>ToolArgs: Read METADATA["user_data"]
alt user_data present
BaseTool->>BaseTool: Set instance.user_data = value
else user_data absent
BaseTool->>BaseTool: Set instance.user_data = {}
note right of BaseTool: Default path
end
BaseTool-->>Caller: Return initialized instance
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/unstract/sdk/tool/base.py (1)
266-273: Use equality (==) instead of identity (is) for string comparison.
ison strings is unreliable; use==to avoid intermittent misclassification of output type.- if output_type is PropKey.OutputType.JSON and not isinstance(data, dict): + if output_type == PropKey.OutputType.JSON and not isinstance(data, dict):
🧹 Nitpick comments (1)
src/unstract/sdk/constants.py (1)
138-138: Add brief comment and clarify allowable content for USER_DATA.To avoid accidental PII persistence in METADATA.json, document expected schema and constraints.
- USER_DATA = "user_data" + # Arbitrary per-user overrides for variable replacement; must be JSON-serializable, + # minimal, and free of sensitive/PII. This metadata is persisted in METADATA.json. + USER_DATA = "user_data"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (3)
src/unstract/sdk/__init__.py(1 hunks)src/unstract/sdk/constants.py(1 hunks)src/unstract/sdk/tool/base.py(2 hunks)
🔇 Additional comments (2)
src/unstract/sdk/tool/base.py (1)
136-138: Error formatting change is fine.No behavior change; message remains clear and actionable.
src/unstract/sdk/__init__.py (1)
1-1: Version bump LGTM — confirm tag & changelog
- src/unstract/sdk/init.py: version = "v0.77.2".
- Root pyproject.toml uses dynamic = ["version"] (hatch); many adapter subpackage pyproject.toml files still show version = "0.0.1".
- Confirm a release tag "v0.77.2" exists and CHANGELOG/release notes are updated, and verify hatch/git-derived package version matches the bumped value (check whether the leading "v" is intentional/PEP 440–compatible).
What
Why
How
Can this PR break any existing features. If yes, please list possible items. If no, please explain why.
No, this PR should not break any existing features because:
Env Config
Related Issues or PRs
Dependencies Versions / Env Variables
Notes on Testing
Screenshots
N/A
Checklist
I have read and understood the Contribution Guidelines.