Skip to main content

Module client

Module client 

Source
Expand description

ANS Registry API client.

The client provides methods for agent registration, certificate management, and agent discovery operations.

§Example

use ans_client::{AnsClient, models::*};

#[tokio::main]
async fn main() -> ans_client::Result<()> {
    let client = AnsClient::builder()
        .base_url("https://api.godaddy.com")
        .jwt("your-jwt-token")
        .build()?;

    let endpoint = AgentEndpoint::new("https://agent.example.com/mcp", Protocol::Mcp)
        .with_transports(vec![Transport::StreamableHttp]);

    let request = AgentRegistrationRequest::new(
        "my-agent",
        "agent.example.com",
        "1.0.0",
        "-----BEGIN CERTIFICATE REQUEST-----...",
        vec![endpoint],
    )
    .with_description("My AI agent")
    .with_server_csr_pem("-----BEGIN CERTIFICATE REQUEST-----...");

    let pending = client.register_agent(&request).await?;
    println!("Registered: {}", pending.ans_name);

    Ok(())
}

Structs§

AnsClient
ANS Registry API client.
AnsClientBuilder
Builder for constructing an AnsClient.

Enums§

Auth
Authentication method for the ANS API.