agents.supervisor.state.dynamic_stateΒΆ
Enhanced state schema for dynamic supervisor operations.
This module provides an enhanced state management system for dynamic supervisor agents that can add/remove agents at runtime and adapt their responses based on agent configuration and execution context.
ClassesΒΆ
Configuration for agent execution within supervisor context. |
|
Result of agent execution with metadata. |
|
Enhanced state schema for dynamic supervisor operations. |
|
Represents a supervisor routing decision with reasoning. |
Module ContentsΒΆ
- class agents.supervisor.state.dynamic_state.AgentExecutionConfig(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Configuration for agent execution within supervisor context.
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.supervisor.state.dynamic_state.AgentExecutionResult(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Result of agent execution with metadata.
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.supervisor.state.dynamic_state.DynamicSupervisorState(/, **data)ΒΆ
Bases:
haive.core.schema.state_schema.StateSchema
Enhanced state schema for dynamic supervisor operations.
This state schema provides comprehensive tracking of agent execution, dynamic configuration, and adaptive response handling 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)
- adapt_response_for_agent(agent_name, response)ΒΆ
Apply adaptation rules to agent response.
- Parameters:
agent_name (str)
response (Any)
- Return type:
Any
- add_agent_config(agent_name, config)ΒΆ
Add or update agent configuration.
- Parameters:
agent_name (str)
config (AgentExecutionConfig)
- Return type:
None
- add_execution_result(result)ΒΆ
Add execution result to history.
- Parameters:
result (AgentExecutionResult)
- Return type:
None
- add_routing_decision(decision)ΒΆ
Add routing decision to history.
- Parameters:
decision (SupervisorDecision)
- Return type:
None
- cleanup_old_history(max_history=100)ΒΆ
Clean up old execution history to prevent memory bloat.
- Parameters:
max_history (int)
- Return type:
None
- get_agent_config(agent_name)ΒΆ
Get agent configuration by name.
- Parameters:
agent_name (str)
- Return type:
AgentExecutionConfig | None
- get_agent_performance(agent_name)ΒΆ
Get performance metrics for specific agent.
- increment_retry_count(agent_name)ΒΆ
Increment retry count for agent.
- Parameters:
agent_name (str)
- Return type:
None
- remove_agent_config(agent_name)ΒΆ
Remove agent configuration.
- reset_retry_count(agent_name)ΒΆ
Reset retry count for agent.
- Parameters:
agent_name (str)
- Return type:
None
- should_retry_agent(agent_name)ΒΆ
Determine if agent should be retried based on configuration.
- update_agent_stats(agent_name, success, duration)ΒΆ
Update agent execution statistics.
- class agents.supervisor.state.dynamic_state.SupervisorDecision(/, **data)ΒΆ
Bases:
pydantic.BaseModel
Represents a supervisor routing decision with reasoning.
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)