Iragent
This project is about using agents as simple as possible with small and large language models
Loading...
Searching...
No Matches
iragent.models.AgentManager Class Reference

Public Member Functions

None __init__ (self, str init_message, List[Agent] agents, Agent first_agent, int max_round=3, Callable termination_fn=None)
 
Message start (self)
 

Public Attributes

 termination_fn = termination_fn
 
 max_round = max_round
 
dict agents = {agent.name: agent for agent in agents}
 
 init_msg
 

Detailed Description

A simple multi-agent execution manager that routes messages between 
agents in a fixed sequence, with optional early termination.

Unlike `AutoAgentManager`, this class does not dynamically decide 
the next agent to route to — it executes in a predefined order 
based on the message's `reciever` field.

Attributes:
    termination_fn (Callable): Optional function to determine when the 
        workflow should stop early.
    max_round (int): Maximum number of message-passing iterations allowed.
    agents (dict[str, Agent]): Dictionary of available agents, keyed by 
        agent name.
    init_msg (Message): The initial message passed to the first agent.

Args:
    init_message (str): The initial request or instruction from the user.
    agents (List[Agent]): The list of agents participating in the workflow.
    first_agent (Agent): The first agent to receive the initial message.
    max_round (int, optional): Maximum number of routing rounds. Defaults to 3.
    termination_fn (Callable, optional): A function to check if the process 
        should terminate early. Defaults to None.

Methods:
    start() -> Message:
        Executes the multi-agent workflow starting with `init_message`.  
        The process:
            - Sends the message to the current agent.
            - Evaluates termination conditions after each response.
            - Passes the output directly to the next agent defined by the 
              `reciever` field in the message.
            - Stops when the termination function returns True or the 
              maximum round count is reached.
        Returns the final `Message` from the last executed agent.

Constructor & Destructor Documentation

◆ __init__()

None iragent.models.AgentManager.__init__ ( self,
str init_message,
List[Agent] agents,
Agent first_agent,
int max_round = 3,
Callable termination_fn = None )

Member Function Documentation

◆ start()

Message iragent.models.AgentManager.start ( self)

Member Data Documentation

◆ agents

dict iragent.models.AgentManager.agents = {agent.name: agent for agent in agents}

◆ init_msg

iragent.models.AgentManager.init_msg
Initial value:
= Message(
sender="user",
reciever=first_agent.name,
content=init_message,
intent="User request",
metadata={},
)

◆ max_round

iragent.models.AgentManager.max_round = max_round

◆ termination_fn

iragent.models.AgentManager.termination_fn = termination_fn

The documentation for this class was generated from the following file: