| Crates.io | agent-protocol |
| lib.rs | agent-protocol |
| version | 0.1.0 |
| created_at | 2025-12-18 10:00:26.312263+00 |
| updated_at | 2025-12-18 10:00:26.312263+00 |
| description | Rust bindings of Agent Protocol |
| homepage | https://github.com/nurokhq/agent-protocol-rust |
| repository | https://github.com/nurokhq/agent-protocol-rust |
| max_upload_size | |
| id | 1992101 |
| size | 1,270,932 |
Rust API Client SDK for Agent Protocol
This is an auto-generated Rust client library for the Agent Protocol. Agent Protocol is a framework-agnostic specification for serving LLM agents in production. It provides standardized APIs for running agents with support for multi-turn interactions, persistent state management, and long-term memory.
reqwest with async/awaitrustls-tls (default) or native-tlsAdd this to your Cargo.toml:
[dependencies]
agent-protocol = { version = "0.1.0", features = ["rustls-tls"] }
Or with native TLS:
[dependencies]
agent-protocol = { version = "0.1.0", features = ["native-tls"] }
The following table shows the version correspondence between the client and Agent Protocol:
| Client Version | Agent Protocol Version |
|---|---|
| 0.1.0 | 0.1.6 |
Please ensure you use a compatible client version for your Agent Protocol implementation to avoid compatibility issues.
use agent_protocol::apis::configuration::Configuration;
use agent_protocol::apis::agents_api;
use agent_protocol::apis::threads_api;
use agent_protocol::models::{ThreadCreate, RunCreate};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create configuration
let config = Configuration {
base_path: "http://localhost:8000".to_string(),
..Default::default()
};
// Get agent information
let agent = agents_api::get_agent(&config, "my-agent-id").await?;
println!("Agent: {}", agent.name);
// Create a thread
let thread_create = ThreadCreate::new();
let thread = threads_api::create_thread(&config, thread_create).await?;
println!("Thread ID: {}", thread.thread_id);
Ok(())
}
use agent_protocol::apis::runs_api;
use agent_protocol::models::RunCreate;
// Create a stateless run and wait for output
let run_create = RunCreate::new();
let result = runs_api::create_run_wait(&config, Some(run_create)).await?;
println!("Run result: {:?}", result);
POST /runs/wait - Create ephemeral run and wait for outputPOST /runs/stream - Create ephemeral run and stream outputdefault: Enables rustls-tls featurerustls-tls: Use rustls for TLS (default, recommended)native-tls: Use native TLS implementationThis SDK is generated from the OpenAPI specification using OpenAPI Generator.
To regenerate the SDK:
# Initialize and update the spec submodule
git submodule update --init --recursive
# Generate the SDK
./scripts/generate_api_sdk.sh
This script:
spec/openapi.jsonsrc/generated/cargo fmtRun the test suite:
cargo test
Run linter checks:
cargo clippy
See LICENSE file for details.
Contributions are welcome! Please ensure that:
cargo fmtcargo testcargo clippy