kaxil opened a new pull request, #74902:
URL: https://github.com/apache/airflow/pull/74902
Found while testing common.ai 1.0.0rc1 (#74741). Two things
`AgentOperator(durable=True)` documents but did not do:
**Duplicate toolset ids.** The 1.0.0 changelog and the durable execution
page say every `FunctionToolset`, `MCPToolset` and `DynamicToolset` needs a
*unique* `id=`, checked when the operator is created. Construction only checked
that an id was present, so two toolsets sharing `id="orders"` loaded fine and
failed at run time with pydantic-ai's `UserError: Two toolsets have the same id
'orders'`. The operator now raises `ValueError` at parse time. It applies the
same rule pydantic-ai's durable backend does (the check in
`durable_exec/_base.py`): only distinct instances of those three kinds collide,
and one instance passed in two places is still one toolset.
**Approval or deferred tools under `durable=True`.** The durable page says
such a call fails the task with `UnsupportedToolDeferralError`. It actually
failed with pydantic-ai's `UserError: A deferred tool call was present, but
DeferredToolRequests is not among output types`, after the model had been
called, because the operator added `DeferredToolRequests` to the output types
only when approval was supported, so the operator's own check was never
reached. Two changes:
- A toolset that declares approval or external execution
(`.approval_required()`, `requires_approval=True` on a tool, including
`agent_params={"tools": [...]}`, or an `ExternalToolset`) is refused with
`ValueError` when the Dag is parsed. A durable run can't pause, so that tool
could never run.
- A tool that raises `ApprovalRequired` or `CallDeferred` itself can't be
seen at parse time. Under `durable=True` the output types now include
`DeferredToolRequests`, so the run ends on that call and the task fails with
`UnsupportedToolDeferralError`, without another model request.
Durable execution, tool approval and troubleshooting docs are updated to
match. Without the source change, the new tests fail with `DID NOT RAISE
ValueError` and the `UserError` above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]