Installation

npm install infinium-o2

Requirements: Node.js 20 or higher.

The SDK depends on axios for HTTP communication. Provider SDKs (OpenAI, Anthropic, Google) are optional peer dependencies — install only the ones your agent uses.

Credentials

You need an agent ID and agent secret from the Infinium platform. These authenticate your agent when sending traces.

# .env
INFINIUM_AGENT_ID=your-agent-id
INFINIUM_AGENT_SECRET=your-agent-secret

Initialize the Client

InfiniumClient

import { InfiniumClient } from 'infinium-o2';

const client = new InfiniumClient({
  agentId: process.env.INFINIUM_AGENT_ID!,
  agentSecret: process.env.INFINIUM_AGENT_SECRET!,
});

AsyncInfiniumClient

For explicit lifecycle management with close():

import { AsyncInfiniumClient } from 'infinium-o2';

const client = new AsyncInfiniumClient({
  agentId: process.env.INFINIUM_AGENT_ID!,
  agentSecret: process.env.INFINIUM_AGENT_SECRET!,
});

// ... use client ...

await client.close();

Send Your First Trace

The simplest way to send a trace is sendTask():

const response = await client.sendTask({
  name: 'Classify support ticket',
  description: 'Categorized an inbound support ticket by type and urgency.',
  duration: 2.4,
  inputSummary: 'Customer ticket about billing issue',
  outputSummary: 'Category: billing, Urgency: high',
  llmUsage: {
    model: 'gpt-4o',
    provider: 'openai',
    promptTokens: 320,
    completionTokens: 45,
  },
});

if (response.success) {
  const traceId = response.data?.traceId;
  console.log(`Trace sent: ${traceId}`);
}

Verify on the Platform

After sending a trace, log into the Infinium platform to see:

  1. Your trace data in the agent dashboard
  2. Maestro’s interpretation and scoring (available after a few seconds)

You can also retrieve Maestro’s result programmatically:

const interpretation = await client.getInterpretedTaskResult(traceId);
console.log(interpretation.data);

Next Steps