Skip to content

Index

diapason.agents

Agents primitive — multi-turn reasoning and tool use.

AgentContext dataclass

Runtime context handed to an agent on each invocation.

AgentResult dataclass

Result returned after an agent completes a run.

BaseAgent

Bases: ABC

Base class for all agent implementations.

Subclasses must be registered via @AgentRegistry.register("name") to become discoverable.

Provides concrete helper methods that eliminate boilerplate in subclasses:

  • :meth:_emit_turn_start / :meth:_emit_turn_end -- event bus
  • :meth:_build_messages -- conversation + system prompt assembly
  • :meth:_generate -- delegates to engine with stored defaults
  • :meth:_max_turns_result -- standard max-turns-exceeded result
  • :meth:_strip_think_tags -- remove <think> blocks

run(input, context=None, **kwargs) abstractmethod

Execute the agent on input and return an AgentResult.

ToolUsingAgent

Bases: BaseAgent

Intermediate base for agents that accept and use tools.

Sets accepts_tools = True for CLI/SDK introspection, and initialises a :class:ToolExecutor from the provided tools.