Client Wrappers
Sagewai provides client libraries in 17 programming languages. Every wrapper exposes the same API surface — Harness, Registry, Observatory, and Gateway — with three authentication methods.
Supported Languages
| Language | Package | Tier | Install |
|---|---|---|---|
| Python | sagewai-client | Tier 1 | pip install sagewai-client |
| TypeScript | sagewai | Tier 1 | npm install sagewai |
| Go | sagewai-go | Tier 1 | go get github.com/sagewai/sagewai-go |
| Rust | sagewai | Tier 1 | cargo add sagewai |
| Java | com.sagecurator:sagewai | Tier 2 | Maven / Gradle |
| C# / .NET | Sagewai | Tier 2 | dotnet add package Sagewai |
| Kotlin | com.sagecurator:sagewai | Tier 2 | Gradle |
| Ruby | sagewai | Tier 2 | gem install sagewai |
| Swift | Sagewai | Tier 2 | Swift Package Manager |
| C++ | sagewai | Tier 2 | CMake FetchContent |
| PHP | sagecurator/sagewai | Tier 2 | composer require sagecurator/sagewai |
| Dart | sagewai | Tier 2 | dart pub add sagewai |
| Scala | com.sagecurator:sagewai | Tier 2 | SBT |
| Perl | Sagewai | Tier 2 | cpanm Sagewai |
| Elixir | sagewai | Tier 2 | Mix |
| React Native | sagewai | Mobile | npm install sagewai |
| Flutter | sagewai | Mobile | dart pub add sagewai |
Tier 1 wrappers have full implementations with tests and are published to their respective package registries. Tier 2 wrappers follow the same API surface and are currently in development — install commands will be available once packages are published. Mobile wrappers share the same API as 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 organized by pillar:
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 (Simplest)
Best for scripts, services, and development.
# 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-..."))
Sends X-API-Key header with every request.
JWT (Token-based)
Best for authenticated users and service-to-service calls.
# 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..."))
Sends Authorization: Bearer header.
OAuth (Enterprise)
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
Consistent across all wrappers:
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 | Consume 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: Python SDK defines and runs your agents on the server, while client wrappers let your TypeScript frontend, Go microservice, or Rust CLI interact with those agents.