Client Wrappers
Sagewai ships client libraries for 17 programming languages. Each wrapper covers the same API surface — Harness, Registry, Observatory, and Gateway — and supports the same three authentication methods.
Supported Languages
| Language | Package | Status | Install |
|---|
| Python | sagewai-client | Stable | pip install sagewai-client |
| TypeScript | sagewai | Stable | npm install sagewai |
| Go | sagewai-go | Stable | go get github.com/sagewai/sagewai-go |
| Rust | sagewai | Stable | cargo add sagewai |
| Java | com.sagecurator:sagewai | In development | Maven / Gradle |
| C# / .NET | Sagewai | In development | dotnet add package Sagewai |
| Kotlin | com.sagecurator:sagewai | In development | Gradle |
| Ruby | sagewai | In development | gem install sagewai |
| Swift | Sagewai | In development | Swift Package Manager |
| C++ | sagewai | In development | CMake FetchContent |
| PHP | sagecurator/sagewai | In development | composer require sagecurator/sagewai |
| Dart | sagewai | In development | dart pub add sagewai |
| Scala | com.sagecurator:sagewai | In development | SBT |
| Perl | Sagewai | In development | cpanm Sagewai |
| Elixir | sagewai | In development | Mix |
| React Native | sagewai | Mobile | npm install sagewai |
| Flutter | sagewai | Mobile | dart pub add sagewai |
Stable wrappers are fully implemented, tested, and published to their package registries. In development wrappers follow the same API surface — install commands will work once those packages are published. Mobile wrappers share their base language (TypeScript for React Native, Dart for Flutter).
Quick Start by Language
Python
from sagewai_client import SagewaiClient
client = SagewaiClient(
base_url="http://localhost:8100",
api_key="sk-harness-...",
)
response = client.chat("gpt-4o", "What is Sagewai?")
print(response.content)
TypeScript / JavaScript
import { SagewaiClient } from "sagewai";
const client = new SagewaiClient({
baseUrl: "http://localhost:8100",
apiKey: "sk-harness-...",
});
const response = await client.chat({
model: "gpt-4o",
messages: [{ role: "user", content: "What is Sagewai?" }],
});
console.log(response.content);
Go
package main
import (
"context"
"fmt"
sagewai "github.com/sagewai/sagewai-go"
)
func main() {
client := sagewai.NewClient(
sagewai.WithBaseURL("http://localhost:8100"),
sagewai.WithAPIKey("sk-harness-..."),
)
ctx := context.Background()
response, err := client.Chat(ctx, &sagewai.ChatRequest{
Model: "gpt-4o",
Messages: []sagewai.Message{{Role: "user", Content: "What is Sagewai?"}},
})
if err != nil {
panic(err)
}
fmt.Println(response.Content)
}
Rust
use sagewai::SagewaiClient;
#[tokio::main]
async fn main() -> Result<(), sagewai::Error> {
let client = SagewaiClient::builder()
.base_url("http://localhost:8100")
.api_key("sk-harness-...")
.build()?;
let response = client
.chat("gpt-4o")
.message("user", "What is Sagewai?")
.send()
.await?;
println!("{}", response.content);
Ok(())
}
Java
import com.sagecurator.sagewai.SagewaiClient;
var client = SagewaiClient.builder()
.baseUrl("http://localhost:8100")
.apiKey("sk-harness-...")
.build();
var response = client.chat("gpt-4o", "What is Sagewai?");
System.out.println(response.content());
C# / .NET
using Sagewai;
var client = new SagewaiClient("http://localhost:8100", "sk-harness-...");
var response = await client.ChatAsync("gpt-4o", "What is Sagewai?");
Console.WriteLine(response.Content);
Kotlin
import com.sagecurator.sagewai.SagewaiClient
val client = SagewaiClient(
baseUrl = "http://localhost:8100",
apiKey = "sk-harness-..."
)
val response = client.chat("gpt-4o", "What is Sagewai?")
println(response.content)
Ruby
require "sagewai"
client = Sagewai::Client.new(
base_url: "http://localhost:8100",
api_key: "sk-harness-..."
)
response = client.chat("gpt-4o", "What is Sagewai?")
puts response.content
Swift
import Sagewai
let client = SagewaiClient(
baseURL: "http://localhost:8100",
apiKey: "sk-harness-..."
)
let response = try await client.chat(model: "gpt-4o", message: "What is Sagewai?")
print(response.content)
PHP
use Sagewai\Client;
$client = new Client("http://localhost:8100", "sk-harness-...");
$response = $client->chat("gpt-4o", "What is Sagewai?");
echo $response->content;
Dart / Flutter
import 'package:sagewai/sagewai.dart';
final client = SagewaiClient(
baseUrl: 'http://localhost:8100',
apiKey: 'sk-harness-...',
);
final response = await client.chat('gpt-4o', 'What is Sagewai?');
print(response.content);
Elixir
client = Sagewai.Client.new(
base_url: "http://localhost:8100",
api_key: "sk-harness-..."
)
{:ok, response} = Sagewai.chat(client, "gpt-4o", "What is Sagewai?")
IO.puts(response.content)
Unified API Surface
Every wrapper exposes the same operations:
Harness (LLM Proxy)
| Method | Description |
|---|
chat(model, messages) | Send a chat completion request |
chatStream(model, messages) | Stream responses via Server-Sent Events |
listModels() | List available models on the harness |
Registry (Agent Governance)
| Method | Description |
|---|
listAgents() | List all registered agents |
getAgent(name) | Get agent details (model, tools, strategy, run count) |
Observatory (Cost Tracking)
| Method | Description |
|---|
getSpend(orgId?) | Get spend summary (daily, monthly, total USD) |
getSpendBreakdown(orgId?) | Cost breakdown by model |
Gateway (Token Management)
| Method | Description |
|---|
createToken(agentName, grantorId) | Create an access token |
listTokens(agentName?) | List tokens |
revokeToken(tokenId) | Revoke a token |
Health
| Method | Description |
|---|
health() | Check harness health status |
Authentication
All wrappers support three authentication methods.
API Key
Best for scripts, services, and development. Sends X-API-Key with every request.
# Python
client = SagewaiClient(base_url="...", api_key="sk-harness-...")
// TypeScript
const client = new SagewaiClient({ baseUrl: "...", apiKey: "sk-harness-..." });
// Go
client := sagewai.NewClient(sagewai.WithAPIKey("sk-harness-..."))
JWT
Best for authenticated users and service-to-service calls. Sends Authorization: Bearer.
# Python
client = SagewaiClient(base_url="...", jwt="eyJhbGciOi...")
// TypeScript
const client = new SagewaiClient({ baseUrl: "...", auth: { type: "jwt", token: "eyJ..." } });
// Go
client := sagewai.NewClient(sagewai.WithJWT("eyJ..."))
OAuth
Supports automatic token refresh for long-lived applications.
// TypeScript — with auto-refresh
const client = new SagewaiClient({
baseUrl: "http://localhost:8100",
auth: {
type: "oauth",
accessToken: "ya29...",
refreshToken: "1//0...",
refreshUrl: "https://auth.sagewai.ai/token",
},
});
Response Types
ChatResponse
| Field | Type | Description |
|---|
id | string | Unique response ID |
model | string | Model used |
content | string | Response text |
usage.prompt_tokens | int | Input tokens |
usage.completion_tokens | int | Output tokens |
usage.total_tokens | int | Total tokens |
AgentSummary
| Field | Type | Description |
|---|
name | string | Agent name |
model | string | Default model |
capabilities | string[] | Agent capabilities |
strategy | string | Execution strategy |
SpendSummary
| Field | Type | Description |
|---|
daily_usd | number | Today's spend |
monthly_usd | number | This month's spend |
total_usd | number | All-time spend |
total_requests | int | Total request count |
total_tokens | int | Total tokens used |
Python SDK vs Client Wrappers
| Python SDK (sagewai) | Client Wrappers |
|---|
| Install | pip install sagewai | Language-specific package |
| Purpose | Build agents, define tools, create workflows | Call agents from any language |
| Runs | Agent code executes locally | HTTP calls to harness/gateway |
| Use when | Defining agent behavior | Integrating with existing apps, CI/CD, mobile |
| Features | Full SDK (memory, directives, fleet, admin) | Harness + Registry + Observatory + Gateway APIs |
In a typical setup: the Python SDK defines and runs your agents on the server; client wrappers let your TypeScript frontend, Go microservice, or Rust CLI call those agents over HTTP.