Expand description
Claude Messages API client with OAuth, stealth headers, and automatic token rotation.
§Tool Use Support
This module supports Claude’s tool use API for building agent loops:
use agentctl_auth::claude::{Client, Tool, ToolHandler, ToolOutput};
use anyhow::Result;
use async_trait::async_trait;
struct MyHandler;
#[async_trait]
impl ToolHandler for MyHandler {
async fn handle(&self, name: &str, input: &serde_json::Value) -> Result<ToolOutput> {
match name {
"read_file" => Ok(ToolOutput::success("file contents")),
_ => Ok(ToolOutput::error("unknown tool")),
}
}
}Structs§
- Agent
Loop Result - Result of running an agent loop.
- Client
- Claude Messages API client.
- Client
Builder - Builder for Claude client.
- Message
- Claude API message with support for both text and multi-content (tool use).
- Messages
Response - Claude API response.
- Tool
- Tool definition for Claude API.
- Tool
Output - Output from a tool handler.
- Tool
Result Block - A tool result block for user messages.
- Tool
UseBlock - A tool use block from Claude’s response.
- Usage
Enums§
- Content
Block - Content block in Claude API responses.
- Message
Content - Message content — either simple text or array of content blocks.
Traits§
- Tool
Handler - Trait for handling tool calls in agent loops.