Show HN: Clark-agent, a Rust library for LLM tool loops
Clark-agent is a Rust library designed for creating typed, hookable agent loops that are provider-agnostic. It allows for flexible tool integration and execution management while maintaining strong typing and structured event handling. The library supports various configurations and plugins to extend its functionality and streamline interactions with language models.
- ▪Clark-agent provides a framework for building agent loops that can interact with various tools and language models.
- ▪The library emphasizes strong typing and structured event handling to ensure reliable execution.
- ▪Developers can customize the agent's behavior through plugins and configuration options.
Opening excerpt (first ~120 words) tap to expand
clark-agent A small, typed, hookable agent loop. Provider-agnostic, sandbox-agnostic, tooling-agnostic. Shape context → LLM (StreamFn) → tool batch → results appended → repeat Termination is a tool decision (ToolResult::terminate = true, unanimous across the batch). The runtime owns execution and event emission; tools own semantics; plugins own cross-cutting extension. Layers types — AgentMessage, content blocks, StopReason. Conversation is Vec<AgentMessage>. Apps extend via AgentMessage::Custom or by wrapping in their own enum. event — AgentEvent enum + EventSink trait. Single sink, typed events. Streamed and final delivery use the same enum. ChannelSink, FanOutSink, NoopSink provided. tool — AgentTool trait + ToolRegistry. Tools own their schema, validation, and execution.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.