Skip to main content

Module claude

Module claude 

Source
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§

AgentLoopResult
Result of running an agent loop.
Client
Claude Messages API client.
ClientBuilder
Builder for Claude client.
Message
Claude API message with support for both text and multi-content (tool use).
MessagesResponse
Claude API response.
Tool
Tool definition for Claude API.
ToolOutput
Output from a tool handler.
ToolResultBlock
A tool result block for user messages.
ToolUseBlock
A tool use block from Claude’s response.
Usage

Enums§

ContentBlock
Content block in Claude API responses.
MessageContent
Message content — either simple text or array of content blocks.

Traits§

ToolHandler
Trait for handling tool calls in agent loops.