Overview
An agent can handle multiple rounds of execution, where each round builds on the previous conversation history. Just add a new user message to the returned state and callexecute()
again — AgentLoop automatically resets completed executions before starting a new one.
This enables multi-turn interactions where the agent reasons over past tool results
to answer follow-up questions without re-executing tools.
Key concepts:
withUserMessage(): Appends a follow-up user message to the existing conversation- The agent sees all prior messages including tool calls and results from previous executions
- Follow-up questions can reference data gathered in earlier rounds
AgentLoopauto-resets terminal execution state (completed/failed) on entry