Skip to content

latent.agents.react_agent

ReActAgent -- concrete conversational agent powered by LiteLLM (FR-1.2).

Classes

ReActAgent

ReActAgent(name: str, model: str, system_prompt: str | None = None, tools: list[Callable] | None = None, temperature: float = 0.0, max_tokens: int = 4096, timeout: float | None = None, max_iterations: int = 10, max_iterations_fallback_message: str | None = None, max_iterations_fallback_tool: str | None = None, max_iterations_fallback_args: dict[str, Any] | None = None, thinking_config: dict | None = None, response_format: type[BaseModel] | dict | None = None, completion_kwargs: dict[str, Any] | None = None, optimized_prompt: str | Path | None = None, cache_policy: CachePolicy | None = None, canned_responses: list[CannedResponder] | None = None, kwargs: Any = {})

Conversational agent powered by LiteLLM.

Supports any model provider via litellm (OpenAI, Anthropic, Bedrock, Azure, etc.). Implements the ReAct pattern: LLM can call tools, observe results, and iterate.

Methods

ReActAgent.ask

ask(prompt: str) -> str

Send a message with chat history context. Appends to history.

Args: prompt: User query string.

Returns: Agent response text.

ReActAgent.reset

reset() -> None

Reset conversation history and events.

ReActAgent.tools

Tool definitions available to this agent.