agents.experiments.supervisor.state_models

State models for supervisor agents.

This module defines the state schemas and data models used by supervisor agents for managing multi-agent systems.

Classes

AgentMetadata

Metadata for a registered agent.

DynamicSupervisorState

Extended state model for dynamic supervisors.

ExecutionContext

Context for agent execution.

SerializedAgent

Serialized representation of an agent for storage/transfer.

SupervisorState

State model for supervisor agents.

ToolMapping

Mapping between tools and agents.

Module Contents

class agents.experiments.supervisor.state_models.AgentMetadata(/, **data)

Bases: pydantic.BaseModel

Metadata for a registered agent.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class agents.experiments.supervisor.state_models.DynamicSupervisorState(/, **data)

Bases: SupervisorState

Extended state model for dynamic supervisors.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

add_agent_template(name, template)

Add a template for agent creation.

Parameters:
  • name (str) – Template name

  • template (dict[str, Any]) – Template configuration

Return type:

None

get_creation_statistics()

Get statistics about agent creation.

Returns:

Creation statistics

Return type:

dict[str, Any]

record_agent_creation(agent_name, success, error=None)

Record an agent creation attempt.

Parameters:
  • agent_name (str) – Name of the agent being created

  • success (bool) – Whether creation was successful

  • error (str | None) – Error message if creation failed

Return type:

None

class agents.experiments.supervisor.state_models.ExecutionContext(/, **data)

Bases: pydantic.BaseModel

Context for agent execution.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class agents.experiments.supervisor.state_models.SerializedAgent(/, **data)

Bases: pydantic.BaseModel

Serialized representation of an agent for storage/transfer.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class agents.experiments.supervisor.state_models.SupervisorState(/, **data)

Bases: pydantic.BaseModel

State model for supervisor agents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

add_execution(agent_name, task, task_id=None)

Add a new execution context.

Parameters:
  • agent_name (str) – Name of the executing agent

  • task (str) – Task description

  • task_id (str | None) – Optional task ID (generated if not provided)

Returns:

The created execution context

Return type:

ExecutionContext

complete_execution(task_id, result, error=None)

Complete an execution context.

Parameters:
  • task_id (str) – Task identifier

  • result (str) – Execution result

  • error (str | None) – Optional error message

Returns:

True if execution was found and updated

Return type:

bool

get_agent_statistics()

Get statistics about agents and executions.

Returns:

Dictionary with agent statistics

Return type:

dict[str, Any]

get_recent_executions(limit=10)

Get recent executions.

Parameters:

limit (int) – Maximum number of executions to return

Returns:

List of recent execution contexts

Return type:

list[ExecutionContext]

class agents.experiments.supervisor.state_models.ToolMapping(/, **data)

Bases: pydantic.BaseModel

Mapping between tools and agents.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)