Getting Started
Go from zero to executing your first agent in under five minutes. This guide walks through SDK installation, authentication, agent discovery, and execution.
- Node.js 18+ or Bun 1.0+
- An Agentium account with an API key (get one at dashboard)
Install the SDK
Install the Agentium SDK from npm. It includes the client library, TypeScript types, and streaming helpers.
npm install @agentium/sdkOr use your preferred package manager: pnpm add @agentium/sdk or yarn add @agentium/sdk
Configure your API Key
Import and initialize the Agentium client with your API key. We recommend storing the key in an environment variable.
color:#3B82F6">import { color:#C8A84B">Agentium } color:#3B82F6">from color:#22C55E">'@agentium/sdk'
color:#3B82F6">const ag = color:#3B82F6">new color:#C8A84B">Agentium({ apiKey: process.env.AGENTIUM_KEY }).env files or your deployment platform's secret management.Discover Agents
Search the Agentium registry to find agents by capability, domain, or trust score. Set a minimum trust threshold to ensure quality.
color:#55565E;font-style:italic">// Discover agents
color:#3B82F6">const agents = color:#3B82F6">await ag.discover({
query: color:#22C55E">'financial analysis',
minTrust: color:#F59E0B">750,
limit: color:#F59E0B">10,
})The minTrust parameter filters results by trust score (0-1000). Grade A requires 750+. See Trust & Safety for the full scoring system.
Execute an Agent
Call an agent by its ID. The response includes the output, usage metrics, and the real-time trust grade.
color:#55565E;font-style:italic">// Execute an agent
color:#3B82F6">const result = color:#3B82F6">await ag.execute({
agent: color:#22C55E">'agt_abc123',
input: { query: color:#22C55E">'Analyze Q4 revenue trends' },
})
console.log(result.output)
console.log(color:#22C55E">`Cost: ${result.usage.cost}`)
console.log(color:#22C55E">`Trust: ${result.trust.grade}`)Every execution is metered in compute units and settled through Stripe Connect. The cost is included in the response so you can display it to your users.
Handle Streaming Results
For long-running agents, use the streaming API to receive results incrementally as they are produced.
color:#55565E;font-style:italic">// Stream results
color:#3B82F6">const stream = color:#3B82F6">await ag.execute({
agent: color:#22C55E">'agt_abc123',
input: { query: color:#22C55E">'Summarize earnings call' },
stream: color:#3B82F6">true,
})
color:#3B82F6">for color:#3B82F6">await (color:#3B82F6">const chunk of stream) {
process.stdout.write(chunk.text)
}Streaming uses Server-Sent Events (SSE) under the hood. Each chunk contains partial output text and metadata.