agent-infra-sdk 0.1.2

Unified Rust SDK for Gateway-backed and local Agent Infra APIs
Documentation

Agent Infra SDK

Rust SDK for Agent Infra APIs. Applications configure one Gateway URL and one credential provider, then use typed clients for Agent Registry, context, workspace, trace, runtime identity, model, deployment, and evaluation APIs. Workspace data operations use Gateway by default, but may bind an in-process Workspace port for direct local filesystem access. Other APIs remain Gateway-backed.

use agent_infra_sdk::InfraClient;

let client = InfraClient::new("http://127.0.0.1:5200")?;
let agents = client.agents();
let context = client.context();
# Ok::<(), agent_infra_sdk::InfraClientError>(())

Local Workspace binding is selected once at the composition root; runtime business code still calls the same client.workspace() facade:

use agent_infra_sdk::InfraClient;
use agent_workspace_adapter_local::LocalWorkspace;
use std::{path::PathBuf, sync::Arc};

let workspace = Arc::new(LocalWorkspace::new(PathBuf::from(".")));
let client = InfraClient::builder("https://infra.example.com")
    .local_workspace(workspace)
    .build()?;

let readme = client.workspace().read_file("README.md").await?;

Feature flags can be used to include only the required typed clients.

Model streaming returns raw SSE bytes as soon as they arrive. The streaming methods set stream=true; chunks preserve wire order but are not guaranteed to align with SSE event boundaries:

use agent_infra_sdk::CallOptions;
use serde_json::json;

let mut stream = client
    .model()
    .responses_stream(
        &json!({"model": "model-1", "input": "hello"}),
        CallOptions::default(),
    )
    .await?;
while let Some(chunk) = stream.next_chunk().await {
    forward_sse_bytes(chunk?).await?;
}