Skip to content

teacher_agent

diapason.learning.spec_search.diagnose.teacher_agent

TeacherAgent: frontier model as a tool-calling meta-engineer.

NOT registered in AgentRegistry. NOT a subclass of BaseAgent. This is a standalone tool-calling loop that wraps CloudEngine with diagnostic tools for the diagnose phase.

The teacher: - Uses a frontier model (default claude-opus-4-6) regardless of the user's local intelligence config. - Has its own tool set (diagnostic tools) that user agents do not have. - Tracks cost and stops when the budget is exhausted. - Logs every tool call to a list of ToolCallRecord.

See spec §5.1.

TeacherAgent

Frontier model tool-calling loop for the diagnose phase.

Parameters

engine : A CloudEngine (or mock) that provides generate(). model : The frontier model id (e.g. "claude-opus-4-6"). tools : Diagnostic tools exposed to the teacher. max_turns : Maximum number of generate() calls before stopping. max_cost_usd : Maximum accumulated cost before stopping.

run(user_prompt, *, system_prompt=None)

Run the teacher tool-calling loop.

Parameters

user_prompt : The instruction to the teacher (e.g. "Analyze student failures"). system_prompt : Optional system prompt explaining the teacher's role.

Returns

TeacherAgentResult The teacher's final content, cost, and tool call records.

TeacherAgentResult dataclass

The result of a TeacherAgent.run() call.