This example demonstrates a GraphAgent workflow where an AgentNode runs an LLMAgent with node-scoped external tools.
The child LLMAgent emits the external tool call. A following normal graph node performs the checkpoint interrupt and later feeds the caller-provided tool result back to the same AgentNode.
The flow is:
research_agentreceivesagent.WithExternalTools(...)throughgraph.WithAgentNodeRunOptions(...).external_tool_gateis a normal graph node. It reads the child agent tool call written by the AgentNode output mapper and callsgraph.Interruptwith thetoolCallId.- The caller supplies the external search result.
- The graph resumes from the checkpoint with
graph.NewResumeCommand().WithResumeMap(...). external_tool_gatestores the caller result as a tool message in graph state.research_agentusesgraph.WithAgentNodeInputMapper(...)to project that tool message intograph.StateKeyAgentInputMessage.research_agentruns again with that tool message and writes the final answer.- The process keeps one runner session open so later turns reuse the same conversation history.
From the examples/graph module:
export OPENAI_BASE_URL="https://your-openai-compatible-base-url"
export OPENAI_API_KEY="<your api key>"
go run ./agentnode_llmagent_externaltool -model deepseek-v4-flashType a user request. When the graph pauses, paste the external tool result at the external_search result> prompt. Type another user request to start the next turn, or type /exit to quit.
The output has this shape:
Session: agentnode-llmagent-externaltool-session-xxx
Type a request to start a turn. Type /exit to quit.
user> Use external search to get user input and say hello+tool result after you receive it
Turn #1: waiting for external_search interrupt.
toolCallId: call_xxx
toolArgs: {"query": "user input"}
checkpointId: checkpoint-xxx
external_search result> 1234
Turn #1: resuming graph.
Final answer:
Hello 1234
user> Use external search to get user input and say hi+tool result after you receive it
Turn #2: waiting for external_search interrupt.
toolCallId: call_xxx
toolArgs: {"query": "user input"}
checkpointId: checkpoint-xxx
external_search result> 56789
Turn #2: resuming graph.
Final answer:
Hi 56789