Repository navigation
Preserving transport-error classification across Python local custom tool boundaries #4961
Replies: 1 comment
|
A quick follow-up: I've published a minimal, self-contained offline reproducer for the behavior described above. https://github.com/kunikuni0402-lab/composio-local-tool-timeout-reproducer The reproducer uses the real Composio Python SDK execution path at a pinned commit, with It compares two cases:
Both cases produce the same public I also verified the reproducer from a fresh clone of the public repository. Both cases passed, with results identical to the committed reference JSON. This is a characterization of the current exception-to-result behavior, not a claim of a production bug, actual provider-side effects, duplicate execution, or retry safety. Sharing in case it is useful for discussing whether optional structured error metadata or an observer hook would help preserve this distinction without changing the existing public result contract. |
Uh oh!
There was an error while loading. Please reload this page.
Hi Composio team,
I've been investigating error handling in the Python SDK, particularly when a local custom tool invokes a remote tool through
ctx.execute().I found a behavior that may be worth discussing from an agent reliability and recovery perspective.
1. Observed behavior
In an offline test against the Python SDK at commit
231122de19abd820eac91549382e407e2d2cbe06(nextbranch), usingcomposio-client==2.0.0rc19, I observed the following:APITimeoutError, retaining the underlyinghttpx.ReadTimeoutas its cause/context.ctx.execute(), the exception is converted into afailedresult witherror="Request timed out.".RuntimeError("Request timed out.")can produce the same caller-visible result, despite no remote execution taking place.The offline test covered both timeouts before and after a simulated side effect. In the nested case, the caller-visible result did not preserve a structured distinction between a remote transport timeout and an ordinary local exception.
This appears consistent with the SDK's intentional exception-to-result behavior, rather than necessarily indicating a bug.
2. Why this matters
For an AI agent executing external actions, a transport timeout does not necessarily mean the external operation failed.
For example, an external write operation might complete even if its response never reaches the caller.
The application may therefore need to reconcile the external system's state before deciding whether to retry, stop, or request human review.
When the underlying error category is lost at the local custom tool boundary, the application cannot reliably distinguish a potentially unconfirmed remote execution from an ordinary local exception using the returned error message alone.
This is an error-classification and observability concern, not evidence that Composio itself causes duplicate executions.
3. Possible improvement
Would it make sense to expose optional, structured error metadata while preserving the existing
failedresult contract?For example, an additive mechanism could expose a small set of sanitized fields such as:
{ "result_type": "failed", "error": "Request timed out.", "error_metadata": { "category": "transport_timeout", "origin": "nested_remote", "outcome": "unconfirmed" } }This is only an illustrative API shape, not a proposed final schema.
Here,
unconfirmedwould describe the outcome of the specific nested remote operation, not the local custom tool's overall result.An opt-in mechanism or an existing observer/hook interface might be preferable if adding fields to the public result schema would introduce compatibility concerns.
The goal would be to preserve machine-readable error classification without exposing raw exceptions, stack traces, request headers, or potentially sensitive data.
4. Relationship to existing work
I reviewed several related items:
I haven't identified an exact duplicate in the issues and discussions I was able to review, but the search was not exhaustive.
5. Questions for maintainers
I'd appreciate your perspective on a few points:
I have a reproducible offline test using
httpx.MockTransport, covering direct remote execution, nested local custom tool execution, and ordinary local exceptions. No real external service calls or writes were performed.I'd be happy to share a minimal reproducer if that would be helpful.
Thanks for your time and for maintaining Composio!
All reactions