Documentation Index
Fetch the complete documentation index at: https://docs.castari.com/llms.txt
Use this file to discover all available pages before exploring further.
SDK Overview
The @castari/sdk package lets you manage agents programmatically.
Installation
Quick Example
import { CastariClient } from '@castari/sdk';
const client = new CastariClient({
apiKey: process.env.CASTARI_API_KEY,
});
// List agents
const agents = await client.agents.list();
console.log(agents);
// Deploy an agent
await client.agents.deploy('my-agent');
// Invoke an agent
const result = await client.agents.invoke('my-agent', { prompt: 'Hello!' });
console.log(result.response_content);
When to Use the SDK
| Use Case | CLI or SDK? |
|---|
| Manual deploys | CLI |
| CI/CD pipelines | SDK |
| Building apps that manage agents | SDK |
| Quick testing | CLI |
| Programmatic invocations | SDK |
Authentication
The SDK supports two authentication methods:
API Key (Recommended for servers)
const client = new CastariClient({
apiKey: 'cast_xxxxxxxx_xxxxxxxxxx',
});
Generate an API key in the Castari Dashboard.
OAuth Token (For user-scoped access)
const client = new CastariClient({
token: 'eyJhbGciOiJSUzI1NiIs...', // Clerk JWT
});
TypeScript Support
The SDK is written in TypeScript and exports all types:
import {
CastariClient,
Agent,
AgentStatus,
InvocationResponse,
} from '@castari/sdk';
Error Handling
import { CastariClient, CastariError } from '@castari/sdk';
try {
await client.agents.deploy('my-agent');
} catch (error) {
if (error instanceof CastariError) {
console.error(`API Error: ${error.message}`);
console.error(`Status: ${error.status}`);
}
}
Next Steps
CastariClient
Client configuration and setup
Agents API
List, deploy, and invoke agents
Secrets API
Manage agent secrets
Types
TypeScript interfaces