agents.multi.enhanced_supervisor_agent

Enhanced SupervisorAgent implementation using Agent[AugLLMConfig].

SupervisorAgent = Agent[AugLLMConfig] + worker management + delegation.

Classes

MockWorker

Init .

SupervisorAgent

Enhanced SupervisorAgent that coordinates multiple worker agents.

Module Contents

class agents.multi.enhanced_supervisor_agent.MockWorker(name, specialty)

Init .

Parameters:
  • name (str) – [TODO: Add description]

  • specialty (str) – [TODO: Add description]

async arun(input_data)

Arun.

Parameters:

input_data (str) – [TODO: Add description]

Returns:

Add return description]

Return type:

[TODO

class agents.multi.enhanced_supervisor_agent.SupervisorAgent

Bases: haive.agents.simple.enhanced_simple_real.EnhancedAgentBase

Enhanced SupervisorAgent that coordinates multiple worker agents.

SupervisorAgent = Agent[AugLLMConfig] + worker management + delegation.

The Supervisor pattern allows: 1. Managing a team of worker agents 2. Delegating tasks to appropriate workers 3. Coordinating results from multiple workers 4. Making decisions based on worker outputs

workers

Dictionary of worker agents

max_delegation_rounds

Maximum rounds of delegation

delegation_strategy

How to choose workers (first, best, all)

supervisor_prompt

Custom prompt for supervision

Examples

Basic supervisor with workers:

from haive.agents.simple import SimpleAgent
from haive.agents.react import ReactAgent

# Create workers
analyst = SimpleAgent(name="analyst", engine=AugLLMConfig())
researcher = ReactAgent(name="researcher", tools=[web_search])

# Create supervisor
supervisor = SupervisorAgent(
    name="project_manager",
    workers={
        "analyst": analyst,
        "researcher": researcher
    }
)

result = supervisor.run("Analyze market trends for electric vehicles")
# Supervisor will delegate to researcher for data, then analyst for insights

Dynamic worker addition:

supervisor = SupervisorAgent(name="manager")
supervisor.add_worker("coder", CodingAgent())
supervisor.add_worker("tester", TestingAgent())

result = supervisor.run("Implement and test a sorting algorithm")
add_worker(name, agent)

Add a worker agent.

Parameters:
  • name (str) – Unique name for the worker

  • agent (haive.agents.simple.enhanced_simple_real.EnhancedAgentBase) – Worker agent instance

Raises:

ValueError – If worker name already exists

Return type:

None

build_graph()

Build supervisor delegation graph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

classmethod ensure_aug_llm_config(values)

Ensure supervisor has AugLLMConfig engine.

Parameters:

values (dict[str, Any])

Return type:

dict[str, Any]

get_worker(name)

Get a specific worker by name.

Parameters:

name (str)

Return type:

haive.agents.simple.enhanced_simple_real.EnhancedAgentBase | None

list_workers()

List all worker names.

Return type:

list[str]

remove_worker(name)

Remove a worker agent.

Parameters:

name (str) – Name of worker to remove

Returns:

Removed agent or None if not found

Return type:

haive.agents.simple.enhanced_simple_real.EnhancedAgentBase | None

setup_agent()

Setup supervisor with appropriate prompt.

Return type:

None

classmethod validate_workers(v)

Validate worker agents.

Parameters:

v (dict[str, haive.agents.simple.enhanced_simple_real.EnhancedAgentBase])

Return type:

dict[str, haive.agents.simple.enhanced_simple_real.EnhancedAgentBase]