Skip to main content

Agent

Defined in the agent module.
AI Agent

Constructor

Optional[str]
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional
No description available.
Optional
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional[str]
No description available.
Optional
No description available.
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.

llm_instance()

Instance method.

llm_instance()

Instance method.

clone_for_channel()

Return a fully independent copy of this agent for a gateway channel.

chat_history()

Get chat history (read-only access, use context managers for modifications).

chat_history()

Set chat history (updates the underlying async-safe state with lock).

auto_memory()

AutoMemory instance for automatic memory extraction.

auto_memory()

Instance method.

policy()

PolicyEngine instance for execution control.

policy()

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.

total_cost()

Cumulative USD cost of all LLM calls in this agent run.

cost_summary()

Summary of cost and token usage.

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.

last_stop_reason()

Structured reason the last tool-execution loop stopped.

agent_id()

Lazily generate agent ID when first accessed.

display_name()

Safe display name that never returns None.

set_snapshot_root()

Root filesystem change-tracking at project_path.

undo()

Undo the last set of file changes.

redo()

Redo a previously undone set of file changes.

diff()

Get file diffs from autonomous execution.

analyze_prompt()

Analyze prompt for autonomy signals.

get_recommended_stage()

Get recommended execution stage for prompt.

run_autonomous()

Run an autonomous task execution loop.

run_autonomous_async()

Async variant of run_autonomous() for concurrent agent execution.

handoff_to()

Programmatically hand off a task to another agent.

run_until()

Run agent iteratively until output meets quality criteria.

run_until_async()

Async version of run_until().

handoff_to_async()

Asynchronously hand off a task to another agent.

add_verification()

Register a verification hook for the current run.

remove_verification()

Remove a verification hook by name. Returns True if one was removed.

get_available_tools()

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

add_mcp_server()

Attach an MCP server to a live agent at runtime.

remove_mcp_server()

Disconnect and deregister a previously attached MCP server.

refresh_tools()

Re-derive the live toolset from self.tools.

list_mcp_servers()

Return the names of MCP servers currently attached at runtime.

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.

get_learn_context()

Get learning context for injection into system prompt.

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.

close()

Synchronously close the agent and clean up resources.

aclose()

Async version of close() for async context managers.

is_closed()

Returns True if the agent has been closed.

where_does_it_run()

Plain-English answer to ‘where does my code actually run?’.

Source

View on GitHub

praisonaiagents/agent/agent.py at line 233

Agents Concept

Single Agent Guide

Multi-Agent Guide

Agent Configuration

Auto Agents