-
Notifications
You must be signed in to change notification settings - Fork 29
feat: support parallel calls #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6c6253a to
f7d3bee
Compare
f7d3bee to
46797a6
Compare
| return (tool_call, message) if return_message else tool_call | ||
| return (None, None) if return_message else None | ||
|
|
||
| # 2. Find first tool call with matching name from the last AI message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On what usecase we can end up without a tool call id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our Agent loop? None because we always do routing via Send(), or the guardrail subgraph which has the tool_call_id in the state (because it was called with Send() )
But if somebody else tries to reuse our primitives anyhow and they don't respect our contract, the id can be missing
| else: | ||
| subgraph.add_edge(START, inner_name) | ||
|
|
||
| # Always add the tool call state handler node at the end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is generic for any scope (agent, llm or tool). Won't your changes add the TOOL_CALL_STATE_HANDLER for agent and llm guardrail subgraphs as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would, but the llm and agent subgraphs are expected to have tool_call_id=None, which will make the node a no-op.
We can of course also conditionally add this node only for tool guardrails, that would make it more optimized.
Rough implementation draft to support parallel subgraphs. Successfully ran two IS tools with pre-execution guardrails in parallel.
Not yet done: