Passing the custom tool output to another tool #269
|
Hi , |
Replies: 1 comment
|
Hi @Rishav-dev-star. Good news first: in most cases you don't need to wire this up yourself. (And apologies for the wait; this reply is long overdue.) When a tool returns, its result goes back into the conversation, the model reads it, and the model passes whatever values it needs as input to the next tool it calls. So the main lever is making your tool descriptions and return values clear enough that the model knows what to feed into the second tool. This is the default agent loop behavior, nothing extra to configure. If you need the chaining to be deterministic rather than model-decided, you have a few options. The simplest is plain Python: have one tool function call the other function directly. You can also invoke tools directly on the agent and pass the result along yourself: result = agent.tool.fetch_data(source_id="abc123") # returns the tool result dict
agent.tool.process_data(data=result["content"][0]["text"])Docs for direct calls are here: direct method calls. For larger payloads you don't want round-tripping through the model at all, tools can share data behind the scenes via agent state: one tool writes with |
Hi @Rishav-dev-star. Good news first: in most cases you don't need to wire this up yourself. (And apologies for the wait; this reply is long overdue.)
When a tool returns, its result goes back into the conversation, the model reads it, and the model passes whatever values it needs as input to the next tool it calls. So the main lever is making your tool descriptions and return values clear enough that the model knows what to feed into the second tool. This is the default agent loop behavior, nothing extra to configure.
If you need the chaining to be deterministic rather than model-decided, you have a few options. The simplest is plain Python: have one tool function call the other function…