summaryrefslogtreecommitdiff
path: root/Omni/Agent/Engine.hs
AgeCommit message (Collapse)Author
2025-11-29Implement agent loop with tool executionBen Sima
The implementation is complete. Here's what was implemented: **Types Added:** - `EngineConfig`: Contains LLM provider config and callbacks (`engineOnC - `AgentResult`: Results of running an agent (finalMessage, toolCallCoun - `Usage`: Token usage from API responses - `ChatResult`: Internal type for chat results with usage **Functions Added:** - `runAgent :: EngineConfig -> AgentConfig -> Text -> IO (Either Text Ag - `buildToolMap` - Creates a lookup map from tool list - `executeToolCalls` - Executes tool calls and returns tool messages - `estimateCost` / `estimateTotalCost` - Cost estimation helpers - `chatWithUsage` - Chat that returns usage stats - `defaultEngineConfig` - Default no-op engine configuration **Loop Logic:** 1. Sends messages to LLM via `chatWithUsage` 2. If response has tool_calls, executes each tool via `executeToolCalls` 3. Appends tool results as ToolRole messages 4. Repeats until no tool_calls or maxIterations reached 5. Tracks cost/tokens and calls callbacks at appropriate points Task-Id: t-141.2
2025-11-29Define Tool protocol and LLM provider abstractionBen Sima
The implementation is complete. I created [Omni/Agent/Engine.hs](file:// - **Types**: `Tool`, `LLM`, `AgentConfig`, `Message`, `Role`, `ToolCall` - **Functions**: `chat` for OpenAI-compatible HTTP via http-conduit, `de - **Tests**: JSON roundtrip for Tool, Message; validation of defaults All lints pass (hlint + ormolu) and tests pass. Task-Id: t-141.1