Skip to content

Conversation

@andreitava-uip
Copy link
Contributor

@andreitava-uip andreitava-uip commented Jan 8, 2026

Rough implementation draft to support parallel subgraphs. Successfully ran two IS tools with pre-execution guardrails in parallel.

Not yet done:

  • fix all guardrail actions to correctly extract the tool call. Only done filter to be able to test, also need to do escalate
  • fix message updating. This is an existing bug in all our code. If you update message.tool_calls, that does not actually change what gets sent to the LLM.
  • test more scenarios, like tools with job attachments and so on
  • clean up implementation, add more error checking, fix linting
  • add and fix existing tests

@andreitava-uip andreitava-uip marked this pull request as draft January 8, 2026 13:54
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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

@andreitava-uip andreitava-uip Jan 14, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants