Agentrics

Getting Started

Quickstart

Start tracking AI agent costs in under 5 minutes. No changes to your existing AI calls needed — the SDK wraps your client transparently.

1

Get an API key

Go to Settings → API Keys and create a new key. Copy it — you won't be able to see it again.

AGENTRICS_API_KEY=agntcs_sk_...
2

Install the SDK

Python

pip install agent-cost-optimizer

JavaScript / TypeScript

npm install @agentrics/sdk
3

Wrap your AI client

Python

import os
from anthropic import Anthropic
from agent_cost_optimizer import Agentrics

agentrics = Agentrics(api_key=os.environ["AGENTRICS_API_KEY"])

# Wrap your existing client — no other changes needed
client = agentrics.wrap_anthropic(
    Anthropic(),
    agent_id="support-classifier",
)

# Use exactly as before
response = client.messages.create(
    model="claude-3-haiku-20240307",
    max_tokens=256,
    messages=[{"role": "user", "content": "Classify this ticket..."}],
)
# Cost is tracked automatically

JavaScript / TypeScript

import OpenAI from "openai";
import { Agentrics } from "@agentrics/sdk";

const agentrics = new Agentrics({ apiKey: process.env.AGENTRICS_API_KEY! });

// Wrap your existing client
const client = agentrics.wrapOpenAI(new OpenAI(), "research-agent");

// Use exactly as before
const response = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Summarize this document..." }],
});
// Cost is tracked automatically
4

See your data

Open the Dashboard — costs appear in real time as your agents run. The spending breakdown shows per-agent and per-model costs, and the recommendations engine flags opportunities like model downgrades and call batching.

Next steps