Skip to main content
createAgent() is the recommended entry point (see the Quick Start). This page is for code that needs the lower-level options it does not take. To move existing executor code over to createAgent(), see Migrating to createAgent().

AgentBuilder and AgentExecutor

createAgent() is a thin wrapper over AgentBuilder and the static AgentExecutor.execute(). Use them directly only for what createAgent() does not take: temperature and maxTokens, and a TraceExporter for tracing (exporter, captureContent). createAgent() already takes maxSteps, limits, onEvent, approvals, store (checkpoints), hooks and compaction. AgentExecutor is a static API - there is no new AgentExecutor().

Sharing tools with ToolRegistry

Advanced: ToolRegistry. To share tools across agents or register raw ToolDescriptors, use registry.register(tool) for a defined tool or registry.register(name, descriptor) for a descriptor. Pass the registry as toolRegistry to AgentExecutor.execute(). See Tools for a full example.

Options of AgentExecutor.execute()

AgentExecutor is static: call AgentExecutor.execute(options). Only agent, input and provider are required. Commonly used options: It resolves to an ExecutionResult: { text, messages, toolCalls, usage, finishReason, steps, approvalId? }.