agent_evolver
agent_evolver
¶
AgentConfigEvolver — analyze traces to evolve agent TOML configs.
Reads interaction traces to determine which agent/tool/parameter combinations perform best for different query classes, then writes updated TOML config files with automatic versioning and rollback.
Classes¶
AgentConfigEvolver
¶
AgentConfigEvolver(
trace_store: TraceStore,
*,
config_dir: Union[str, Path],
min_quality: float = 0.5,
)
Analyze traces to evolve agent TOML configs with versioning.
| PARAMETER | DESCRIPTION |
|---|---|
trace_store
|
A :class:
TYPE:
|
config_dir
|
Directory where agent TOML configs are written.
TYPE:
|
min_quality
|
Minimum average feedback score for a recommendation to be emitted.
TYPE:
|
Source code in src/diapason/learning/agents/agent_evolver.py
Methods:¶
analyze
¶
Analyze traces, return recommendations per query class.
Returns a list of dicts, each containing:
- query_class: the classified query category
- recommended_tools: list of tool names sorted by frequency
- recommended_agent: the best-performing agent for this class
- recommended_max_turns: suggested max_turns value
- sample_count: number of traces analyzed for this class
Source code in src/diapason/learning/agents/agent_evolver.py
write_config
¶
write_config(
agent_name: str,
*,
tools: List[str],
max_turns: int = 10,
temperature: float = 0.3,
system_prompt: str = "",
) -> Path
Write agent TOML config, archiving previous version first.
Returns the :class:Path to the written config file.
Source code in src/diapason/learning/agents/agent_evolver.py
list_versions
¶
List all versions (including current) for agent_name.
Returns a list of dicts with version, path, and modified.
Versions are numbered starting from 1 (oldest archived) through to
the current (highest version number).
Source code in src/diapason/learning/agents/agent_evolver.py
rollback
¶
Rollback to a specific version.
Raises :class:ValueError if the requested version does not exist.