Skip to content

agent_evolver

diapason.learning.agents.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.

AgentConfigEvolver

Analyze traces to evolve agent TOML configs with versioning.

Parameters

trace_store: A :class:TraceStore used to fetch historical traces. config_dir: Directory where agent TOML configs are written. min_quality: Minimum average feedback score for a recommendation to be emitted.

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

list_versions(agent_name)

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).

rollback(agent_name, version)

Rollback to a specific version.

Raises :class:ValueError if the requested version does not exist.

write_config(agent_name, *, tools, max_turns=10, temperature=0.3, system_prompt='')

Write agent TOML config, archiving previous version first.

Returns the :class:Path to the written config file.