@3rdclick/sdk
v0.1.5
Published
TypeScript SDK for 3rd.click — instrument AI agents with tracing, auto-adapters, and swarm communication
Downloads
88
Maintainers
Readme
@3rdclick/sdk
The official TypeScript SDK for the 3rd.click AI agent platform. It provides auto-instrumentation, distributed tracing, artifact capturing, and swarm communication for your remote agents.
Installation
npm install @3rdclick/sdkUsage
If you generated your project using 3cl init, the SDK traces are automatically forwarded to the local collector sidecar running on your deployment node at http://localhost:9111.
import { configure, trace } from '@3rdclick/sdk';
import { wrapOpenAI } from '@3rdclick/sdk/openai';
import OpenAI from 'openai';
// Optional: manually configure if not auto-detected from environment
configure({ endpoint: process.env.THIRDC_TRACE_ENDPOINT, apiKey: process.env.THIRDC_API_KEY });
// The wrapped client will trace all interactions seamlessly
const openai = wrapOpenAI(new OpenAI());
const result = await trace.span('my-agent', async () => {
// Capture a tool execution
const data = await trace.tool('fetchData', () => Promise.resolve({ items: [1, 2, 3] }));
// Make an LLM call; responses, tokens, and cost are automatically tracked
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Summarize the data' }]
});
// Attach persistent artifacts
await trace.artifact('summary.txt', response.choices[0].message.content || '');
return response.choices[0].message;
});For full documentation, visit docs.3rd.click.
