fix(agent): align ixp extraction tool with the job attachment strategy - #1012
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the IXP extraction tool’s attachment id handling so LangChain/Pydantic validation keeps tool kwargs JSON-native (string IDs), while still supporting existing Python callers that may pass uuid.UUID.
Changes:
- Changed
ExtractionToolInputSchema.idfromuuid.UUIDtostr, and added validation/normalization logic. - Updated the extraction tool implementation to convert the validated string id to
uuid.UUIDonly at the SDK boundary. - Added/updated tests to assert schema alignment with
Attachmentand to ensure malformed ids fail validation.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/uipath_langchain/agent/tools/extraction_tool.py |
Switches schema id to str, validates/normalizes it, and converts to uuid.UUID when calling the SDK. |
tests/agent/tools/test_extraction_tool.py |
Extends tests to assert the schema divergence for id, ensure parsed kwargs keep id as str, and invalid ids raise validation errors. |
pyproject.toml |
Bumps project version to 0.14.17. |
uv.lock |
Updates lockfile metadata/version to match the release bump. |
67b94ff to
9a7643a
Compare
de19bb4 to
3520ec2
Compare
3520ec2 to
86bdf80
Compare
| input_model: Any = create_model(resource.input_schema) | ||
|
|
||
| @mockable( | ||
| name=resource.name, | ||
| description=resource.description, | ||
| input_schema=ExtractionToolInputSchema.model_json_schema(), | ||
| input_schema=input_model.model_json_schema(), |
There was a problem hiding this comment.
Do we know that deployed agents with IXP tools have been migrated? or that the resource.input_schema had always been populated?
Worried we might break some old agents for which the schema in agent.json was not defined and we relied on the predefined pydantic model
There was a problem hiding this comment.
the schema is always defined in agent builder. however seems like the CLI is scaffolding an empty schema.
added for the time being a fallback inout schema to be back compat
86bdf80 to
6dd26d8
Compare
6dd26d8 to
aa3bcf1
Compare
|
Decorator-flavor Bring Your Own Guardrail support, pairing with the ByoValidator shipped in uipath (UiPath/uipath-python#1833): - Re-export ByoValidator from uipath_langchain.guardrails and the .guardrails.decorators shim via a guarded getattr, so the package keeps importing (ByoValidator is None) on uipath releases that predate it. TODO in-code: switch to a direct import once the dependency floor includes it. - Adapter hardening: the LLM/agent wrappers previously swallowed evaluator exceptions silently; they now log a WARNING with the guardrail name and traceback (still fail-open). This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config, feature flag off) visible. - Tests: adapter error-logging tests (always run) + ByoValidator-through- @guardrail tests (tool / plain function / validator reuse) that skip automatically until the installed uipath ships ByoValidator; verified passing locally against the uipath-python ByoValidator branch. - Docs: BYOG section under the decorator pattern in docs/guardrails.md, using placeholder validator/connection values and documenting the connector-defined `parameters` passthrough. - Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT scope + tool TOOL scope, bindings.json connection binding), with a commented-out Azure Content Safety `parameters` example. Bump to 0.14.18 (0.14.17 was taken by #1012 and is published on PyPI). Independent of the middleware-flavor PR (#1013); branched from main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Decorator-flavor Bring Your Own Guardrail support, pairing with the ByoValidator shipped in uipath (UiPath/uipath-python#1833): - Re-export ByoValidator from uipath_langchain.guardrails and the .guardrails.decorators shim via a guarded getattr, so the package keeps importing (ByoValidator is None) on uipath releases that predate it. TODO in-code: switch to a direct import once the dependency floor includes it. - Adapter hardening: the LLM/agent wrappers previously swallowed evaluator exceptions silently; they now log a WARNING with the guardrail name and traceback (still fail-open). This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config, feature flag off) visible. - Tests: adapter error-logging tests (always run) + ByoValidator-through- @guardrail tests (tool / plain function / validator reuse) that skip automatically until the installed uipath ships ByoValidator; verified passing locally against the uipath-python ByoValidator branch. - Docs: BYOG section under the decorator pattern in docs/guardrails.md, using placeholder validator/connection values and documenting the connector-defined `parameters` passthrough. - Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT scope + tool TOOL scope, bindings.json connection binding), with a commented-out Azure Content Safety `parameters` example. - Discovery: docs and sample point at `uip agent guardrails byo-configurations` (UiPath/cli#3298) rather than the raw agents_/api/designer/byog-guardrails endpoint, and note that the command needs an org-admin user session. Bump to 0.14.18 (0.14.17 was taken by #1012 and is published on PyPI). Independent of the middleware-flavor PR (#1013); branched from main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Decorator-flavor Bring Your Own Guardrail support, pairing with the ByoValidator shipped in uipath (UiPath/uipath-python#1833): - Re-export ByoValidator from uipath_langchain.guardrails and the .guardrails.decorators shim via a guarded getattr, so the package keeps importing (ByoValidator is None) on uipath releases that predate it. TODO in-code: switch to a direct import once the dependency floor includes it. - Adapter hardening: the LLM/agent wrappers previously swallowed evaluator exceptions silently; they now log a WARNING with the guardrail name and traceback (still fail-open). This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config, BYOG not enabled) visible. - Tests: adapter error-logging tests (always run) + ByoValidator-through- @guardrail tests (tool / plain function / validator reuse) that skip automatically until the installed uipath ships ByoValidator; verified passing locally against the uipath-python ByoValidator branch. - Docs: BYOG section under the decorator pattern in docs/guardrails.md, using placeholder validator/connection values and documenting the connector-defined `parameters` passthrough. - Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT scope + tool TOOL scope, bindings.json connection binding), with a commented-out Azure Content Safety `parameters` example. - Discovery: docs and sample point at `uip agent guardrails list` for the validator name, connection id and the connector-defined `Parameters` schema, rather than the raw agents_/api/designer/byog-guardrails endpoint. - Scopes/stages: BYOG validators are not scope- or stage-restricted, so the developer chooses; here the scope is inferred from each decorated target. Bump to 0.14.18 (0.14.17 was taken by #1012 and is published on PyPI). Independent of the middleware-flavor PR (#1013); branched from main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Decorator-flavor Bring Your Own Guardrail support, pairing with the ByoValidator shipped in uipath (UiPath/uipath-python#1833): - Re-export ByoValidator from uipath_langchain.guardrails and the .guardrails.decorators shim via a guarded getattr, so the package keeps importing (ByoValidator is None) on uipath releases that predate it. TODO in-code: switch to a direct import once the dependency floor includes it. - Adapter hardening: the LLM/agent wrappers previously swallowed evaluator exceptions silently; they now log a WARNING with the guardrail name and traceback (still fail-open). This makes BYOG misconfiguration (PROVIDER_ERROR, removed/disabled config, BYOG not enabled) visible. - Tests: adapter error-logging tests (always run) + ByoValidator-through- @guardrail tests (tool / plain function / validator reuse) that skip automatically until the installed uipath ships ByoValidator; verified passing locally against the uipath-python ByoValidator branch. - Docs: BYOG section under the decorator pattern in docs/guardrails.md, using placeholder validator/connection values and documenting the connector-defined `parameters` passthrough. - Sample: samples/joke-agent-byog-decorator starter (agent-factory AGENT scope + tool TOOL scope, bindings.json connection binding), with a commented-out Azure Content Safety `parameters` example. - Discovery: docs and sample point at `uip agent guardrails list` for the validator name, connection id and the connector-defined `Parameters` schema, rather than the raw agents_/api/designer/byog-guardrails endpoint. - Scopes/stages: BYOG validators are not scope- or stage-restricted, so the developer chooses; here the scope is inferred from each decorated target. Bump to 0.14.19: 0.14.17 was taken by #1012 and is published on PyPI, and 0.14.18 belongs to the middleware flavor (#1013), which lands first. Independent of the middleware-flavor PR (#1013); branched from main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add Bring Your Own Guardrail (BYOG) support so coded agents can run customer-managed validators (a cloud content-safety subscription, a vendor validation service, or a custom Integration Service connector) configured under Admin -> AI Trust Layer -> Guardrails Configurations. - UiPathByoGuardrailMiddleware references the admin configuration by validator name + IS connection id and builds a builtInValidator guardrail with validator_type="byo" (byoValidatorName/byoConnectionId), reusing the shared BuiltInGuardrailMiddlewareMixin hook wiring unchanged. - validator_parameters is an optional passthrough of raw ValidatorParameter values. Scopes and stages are developer-supplied: BYOG validators are not scope- or stage-restricted, so all three scopes and both stages are available exactly as for the built-in validators. - Extract BUILT_IN_VALIDATOR_GUARDRAIL_TYPE (Literal-typed, in middlewares/_base.py) and use it across all built-in middlewares in place of the repeated "builtInValidator" string. - Docs: "Bring Your Own Guardrail (BYOG)" section in docs/guardrails.md plus a "Tuning a BYOG validator" subsection for validator_parameters. - Sample: samples/joke-agent-bring-your-own-guardrail, guarding AGENT (PRE+POST) and TOOL (PRE) scopes, with bindings.json declaring the IS connection for per-environment rebinding. All identifiers are placeholders, following the bring-your-own-model convention; the Azure Content Safety parameter example ships commented out to keep the sample vendor-neutral. - Discovery: docs and sample point at `uip agent guardrails list` for the validator name, connection id and the connector-defined `Parameters` schema, rather than the raw agents_/api/designer/byog-guardrails endpoint. - Bump version to 0.14.18 and sync uv.lock (0.14.17 was taken by #1012 and is published on PyPI). Verified live on alpha against a real BYOG harmful-content configuration: benign input passes, harmful input blocks at before_agent with the vendor verdict, and per-category severity thresholds are honoured (omitted blocks any non-zero severity, 4 lets severity-2 through while blocking 4, 6 lets both through). The decorator flavor ships separately (uipath-python ByoValidator + #1014, which follows at 0.14.19). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>



Summary
resource.inputSchemainstead of a hardcoded flat model, so it honours thejob-attachment$refthat agent builder already writesWhy
the ixp tool was the only attachment-carrying tool not following the shared strategy. it ignored
resource.inputSchemaentirely, hardcoded an alias-free mirror ofAttachment, and typed the id asuuid.UUID.that last part broke tool simulation: langchain validates arguments against
args_schemabefore invoking the tool, so the tool received a liveUUIDobject rather than the string the model emitted, and anything encoding those kwargs with a plainjson.dumpsfailed withObject of type UUID is not JSON serializable.process_tool,context_tool,deeprag_toolandanalyze_files_toolall generate the schema from the resource, keep the id a string, and convert touuid.UUIDonly at the sdk call site. the ixp tool now does the same, which fixes the serialization failure as a side effect of the alignment rather than as a special case.the arg-resolution half of
get_job_attachment_wrapperis extracted asresolve_job_attachment_argsso the ixp wrapper can reuse it while keeping its own result handling (tools_storageplus thedataProjectiontool message thatixpVsEscalationdepends on).