Index
agents
¶
Agents primitive — multi-turn reasoning and tool use.
Classes¶
AgentContext
dataclass
¶
AgentContext(conversation: Conversation = Conversation(), tools: List[str] = list(), memory_results: List[Any] = list(), metadata: Dict[str, Any] = dict())
Runtime context handed to an agent on each invocation.
AgentResult
dataclass
¶
AgentResult(content: str, tool_results: List[ToolResult] = list(), turns: int = 0, metadata: Dict[str, Any] = dict())
Result returned after an agent completes a run.
BaseAgent
¶
BaseAgent(engine: InferenceEngine, model: str, *, bus: Optional[EventBus] = None, temperature: float = 0.7, max_tokens: int = 1024)
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
Source code in src/openjarvis/agents/_stubs.py
Functions¶
run
abstractmethod
¶
run(input: str, context: Optional[AgentContext] = None, **kwargs: Any) -> AgentResult
Execute the agent on input and return an AgentResult.
ToolUsingAgent
¶
ToolUsingAgent(engine: InferenceEngine, model: str, *, tools: Optional[List['BaseTool']] = None, bus: Optional[EventBus] = None, max_turns: int = 10, temperature: float = 0.7, max_tokens: int = 1024, loop_guard_config: Optional[Any] = None, capability_policy: Optional[Any] = None, agent_id: Optional[str] = None)
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.