Documentation Index
Fetch the complete documentation index at: https://docs.pipecat.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
LLMAgent extends BaseAgent with an LLM pipeline and automatic tool registration. Subclasses implement build_llm() to provide an LLM service and define tools with the @tool decorator.
Configuration
Inherits all parameters fromBaseAgent.
Unique name for this agent.
Whether the agent starts active. Defaults to
False (unlike BaseAgent which
defaults to True), since LLM agents typically wait to be activated via
handoff.Whether to defer frames queued during tool execution until all tools complete.
When
True, any frames queued via queue_frame() while a @tool method is
running are held in an internal queue and delivered automatically once the
last tool finishes.Properties
Inherits all properties fromBaseAgent.
tool_call_active
True when one or more @tool methods are executing.
Abstract Methods
build_llm
LLMService (e.g. OpenAILLMService, AnthropicLLMService). Tool registration is handled automatically; do not register @tool methods here.
Returns: An LLMService instance.
Methods
build_tools
@tool. Override to provide additional or different tools.
Returns: List of tool functions.
create_llm
build_llm() and registers all @tool decorated methods. Each tool is automatically wrapped with inflight tracking for frame deferral. Override to customize the LLM setup.
Returns: The configured LLMService.
on_activated
args contains messages, they are appended to the LLM context. When args contains run_llm (defaults to True when messages are set), the LLM is triggered after appending.
| Parameter | Type | Description | |
|---|---|---|---|
args | `dict | None` | Activation arguments (see LLMAgentActivationArgs) |
handoff_to
@tool handler, pass params.result_callback to ensure any pending LLM output is fully delivered before handing off.
| Parameter | Type | Default | Description | |
|---|---|---|---|---|
agent_name | str | Name of the agent to hand off to | ||
args | `AgentActivationArgs | None` | None | Arguments forwarded to on_activated |
result_callback | `FunctionCallResultCallback | None` | None | The result_callback from FunctionCallParams |
end
@tool handler, pass params.result_callback to ensure any pending LLM output is fully delivered before ending.
| Parameter | Type | Default | Description | |
|---|---|---|---|---|
reason | `str | None` | None | Human-readable reason for ending |
result_callback | `FunctionCallResultCallback | None` | None | The result_callback from FunctionCallParams |
process_deferred_tool_frames
| Parameter | Type | Description |
|---|---|---|
frames | list[tuple[Frame, FrameDirection]] | The deferred frames collected during tool execution |