Skip to content

The TypeScript SDK

Discover, inspect and run tools from your own code, with adapters for OpenAI, Anthropic and the AI SDK.

Install

The SDK has no dependency and runs in Node 20 or later, browsers, Workers and Deno.

Shell
npm install @get-agentik/sdk

Discover, inspect, run

TypeScript
import { Agentik } from "@get-agentik/sdk";

const agentik = new Agentik({ apiKey: process.env.AGENTIK_API_KEY });
const hits = await agentik.discover("backlinks of a domain");
const spec = await agentik.inspect(hits[0]!.tool_id);
const run = await agentik.run(spec.id, { target: "example.com" }, { idempotencyKey: crypto.randomUUID() });
console.log(run.status, run.price_billed_usd, run.output);

discover and inspect need no key. run, getRun, waitForSettlement and wallet need a workspace key, which you create in your workspace.

Use it with a model

toOpenAiTools, toAnthropicTools and toAiSdkTools turn tool specs into each format's tool definitions. executeToolCall runs a call the model returned.

Errors and retries

A 429 is retried with the server's retry_after_ms. Out of credit throws an InsufficientCreditsError, whose top-up link only a person can complete. See errors and recovery and idempotency.

The source is open (MIT): github.com/agent-tool-router/agentik.

Connect your agent to 3,250+ tools for free

Sign in with Google or GitHub. No card required.