Skip to main content

Overview

The simplest way to run an agent: AgentLoop::execute() runs the loop to completion and returns the final AgentState. The loop sends messages to the LLM, processes any tool calls, and repeats until the LLM produces a final response with no pending tool calls. Key concepts:
  • AgentLoop::default(): Creates a minimal agent loop with sensible defaults
  • AgentState::empty(): Creates an empty immutable state container
  • execute(): Runs the full loop and returns the final state
  • AgentEventConsoleObserver: Attach via wiretap() to see execution lifecycle events
  • finalResponse(): Access the agent’s final text output

Example