Skip to main content

AgentTeam

Defined in the agents module.
AI Agent Multi-agent coordinator that manages and delegates work to multiple agents. AgentTeam orchestrates the execution of tasks across multiple Agent instances, supporting sequential, parallel, and hierarchical execution patterns.

Constructor

agents
Any
required
No description available.
tasks
Any
No description available.
process
Any
default:"'sequential'"
No description available.
manager_llm
Any
No description available.
name
Optional
No description available.
variables
Optional
No description available.
llm
Optional
No description available.
memory
Optional
default:"False"
No description available.
planning
Optional
default:"False"
No description available.
context
Optional
default:"False"
No description available.
output
Optional
No description available.
execution
Optional
No description available.
hooks
Optional
No description available.
autonomy
Optional
No description available.
knowledge
Optional
No description available.
guardrails
Optional
No description available.
web
Optional
No description available.
reflection
Optional
No description available.
caching
Optional
No description available.

Methods

add_task()

Instance method.

clean_json_output()

Instance method.

context_manager()

ContextManager instance for unified context management across all agents.

default_completion_checker()

Instance method.

aexecute_task()

Async version of execute_task method

arun_task()

Async version of run_task method

arun_all_tasks()

Async version of run_all_tasks method

astart()

Async version of start method.

save_output_to_file()

Instance method.

execute_task()

Synchronous version of execute_task method

run_task()

Synchronous version of run_task method

run_all_tasks()

Synchronous version of run_all_tasks method

get_task_status()

Instance method.

get_all_tasks_status()

Instance method.

get_task_result()

Instance method.

get_task_details()

Instance method.

get_agent_details()

Instance method.

start()

Start agent execution with verbose output (beginner-friendly).

run()

Run agents silently (production use).

set_state()

Set a state value

get_state()

Get a state value

update_state()

Update multiple state values

clear_state()

Clear all state values

has_state()

Check if a state key exists

get_all_state()

Get a copy of the entire state dictionary

delete_state()

Delete a state key if it exists. Returns True if deleted, False if key didn’t exist.

increment_state()

Increment a numeric state value. Creates the key with default if it doesn’t exist.

append_to_state()

Append a value to a list state. Creates the list if it doesn’t exist.

save_session_state()

Save current state to memory for session persistence

restore_session_state()

Restore state from memory for session persistence. Returns True if restored.

get_token_usage_summary()

Get a summary of token usage across all agents and tasks.

get_detailed_token_report()

Get a detailed token usage report.

display_token_usage()

Display token usage in a formatted table.

launch()

Launch all agents as a single API endpoint (HTTP) or an MCP server.

current_plan()

Get the current plan.

todo_list()

Get the current todo list.

get_plan_markdown()

Get the current plan as markdown.

get_todo_markdown()

Get the current todo list as markdown.

update_plan_step_status()

Update the status of a plan step.

Usage

from praisonaiagents import Agent, AgentTeam, Task
    
    researcher = Agent(role="Researcher", instructions="Research topics")
    writer = Agent(role="Writer", instructions="Write content")
    
    task1 = Task(description="Research AI trends", agent=researcher)
    task2 = Task(description="Write article", agent=writer)
    
    team = AgentTeam(
        agents=[researcher, writer],
        tasks=[task1, task2],
        process="sequential"
    )
    result = team.start()

Notes

The class was renamed from AgentManager to AgentTeam in v1.0. AgentManager and Agents remain as silent aliases for backward compatibility.

Source

View on GitHub

praisonaiagents/agents/agents.py at line 172