Skip to main content

Agent

Defined in the agent module.

Constructor

name
Optional
No description available.
role
Optional
No description available.
goal
Optional
No description available.
backstory
Optional
No description available.
instructions
Optional
No description available.
llm
Optional
No description available.
model
Optional
No description available.
function_calling_llm
Optional
No description available.
llm_config
Optional
No description available.
base_url
Optional
No description available.
api_key
Optional
No description available.
tools
Optional
No description available.
allow_delegation
bool
default:"False"
No description available.
allow_code_execution
Optional
default:"False"
No description available.
code_execution_mode
Literal
default:"'safe'"
No description available.
handoffs
Optional
No description available.
auto_save
Optional
No description available.
rate_limiter
Optional
No description available.
memory
Optional
No description available.
knowledge
Optional
No description available.
planning
Optional
default:"False"
No description available.
reflection
Optional
No description available.
guardrails
Optional
No description available.
web
Optional
No description available.
context
Optional
No description available.
autonomy
Optional
No description available.
verification_hooks
Optional
No description available.
output
Optional
No description available.
execution
Optional
No description available.
templates
Optional
No description available.
caching
Optional
No description available.
hooks
Optional
No description available.
skills
Optional
No description available.

Methods

from_template()

Create an Agent from a template.

stream_emitter()

Lazy-loaded StreamEventEmitter for real-time events (zero overhead when not used).

stream_emitter()

Allow setting stream_emitter directly.

auto_memory()

AutoMemory instance for automatic memory extraction.

auto_memory()

Instance method.

policy()

PolicyEngine instance for execution control.

policy()

Instance method.

background()

BackgroundRunner instance for async task execution.

background()

Instance method.

checkpoints()

CheckpointService instance for file-level undo/restore.

checkpoints()

Instance method.

output_style()

OutputStyle instance for response formatting.

output_style()

Instance method.

thinking_budget()

ThinkingBudget instance for extended thinking control.

thinking_budget()

Instance method.

context_manager()

ContextManager instance for unified context management.

context_manager()

Set context manager directly.

console()

Lazily initialize Rich Console only when needed AND verbose is True.

skill_manager()

Lazily initialize SkillManager only when skills are accessed.

get_skills_prompt()

Get the XML prompt for available skills.

agent_id()

Lazily generate agent ID when first accessed.

display_name()

Safe display name that never returns None.

analyze_prompt()

Analyze prompt for autonomy signals.

get_recommended_stage()

Get recommended execution stage for prompt.

run_autonomous()

Run an autonomous task execution loop.

handoff_to()

Programmatically hand off a task to another agent.

handoff_to_async()

Asynchronously hand off a task to another agent.

get_available_tools()

Get tools available to this agent, filtered by plan_mode if enabled.

rules_manager()

Lazy-initialized RulesManager for persistent rules/instructions.

get_rules_context()

Get rules context for the current conversation.

get_memory_context()

Get memory context for the current conversation.

store_memory()

Store content in memory.

llm_model()

Unified property to get the LLM model regardless of configuration type.

retrieval_config()

Get the unified retrieval configuration.

rag()

Lazy-loaded RAG instance for advanced retrieval with citations.

retrieve()

Retrieve context from knowledge without LLM generation.

query()

Query knowledge and get a structured answer with citations.

rag_query()

Query knowledge using RAG pipeline with citations.

chat_with_context()

Chat with pre-retrieved context.

generate_task()

Generate a Task object from the agent’s instructions

execute_tool()

Execute a tool dynamically based on the function name and arguments.

clear_history()

Instance method.

prune_history()

Prune chat history to keep only the last N messages.

delete_history()

Delete a specific message from chat history by index.

delete_history_matching()

Delete all messages matching a pattern.

get_history_size()

Get the current number of messages in chat history.

ephemeral()

Context manager for ephemeral conversations.

session_id()

Get the current session ID.

chat()

Chat with the agent.

clean_json_output()

Clean and extract JSON from response text.

achat()

Async version of chat method with self-reflection support.

arun()

Async version of run() - silent, non-streaming, returns structured result.

astart()

Async version of start() - interactive, streaming-aware.

run()

Execute agent silently and return structured result.

switch_model()

Switch the agent’s LLM model while preserving conversation history.

start()

Start the agent interactively with verbose output.

iter_stream()

Stream agent response as an iterator of chunks.

execute()

Execute a task synchronously - backward compatibility method

aexecute()

Execute a task asynchronously - backward compatibility method

execute_tool_async()

Async version of execute_tool

launch()

Launch the agent as an HTTP API endpoint or an MCP server.