Docs menu

TypeScript SDK

pnpm add @agenko/sdk

Package: @agenko/sdk on npm. Use pnpm. Current series: 0.1.x.

typescript
import agenko from "@agenko/sdk";

agenko.init();

const handleTicket = agenko.check(async (ticket) => process(ticket));

const deleteAccount = agenko.approve({ when: "irreversible" }, async (userId) => {
  await db.deleteUser(userId);
});

Named imports work the same:

typescript
import { init, check, approve } from "@agenko/sdk";

Exports

NameRole
init / instrumentBootstrap
shutdownFlush OTEL
isInitializedGuard
getConfigRead resolved config
checkReceipt wrapper
approveGate wrapper
getPrompt / clearPromptCacheSee Prompts
scoreSee Scores
getClient / agenkoClientControl-plane client
ApprovalError / ApprovalTimeoutErrorGate errors

Types: InitOptions, Receipt, ReceiptVerdict, ReceiptCheck, ToolCall, ScoreDataType, ScoreSource, Prompt, ApprovalConfig.

Lifecycle

init() is idempotent: call it once at startup. Use the lifecycle helpers when you need to tear down or inspect state:

typescript
if (!agenko.isInitialized()) agenko.init();

// ...run your agent...

await agenko.shutdown(); // flush OTEL + close the HTTP client

agenko.getConfig() returns the resolved config (apiKey, httpEndpoint, endpoint, serviceName, projectId, env, sessionId, userId, debug) or null before init().

Auto-instrumentation

TypeScript detects openai, @anthropic-ai/sdk, and LangChain via OpenInference instrumentors (@arizeai/openinference-instrumentation-*). Python currently auto-detects a wider set (LiteLLM, LlamaIndex, CrewAI, Bedrock, …). Parity is the rule — gaps get filled on the TS side, not documented as features.

Tests

cd agenko/agenko-typescript && pnpm test --run.

Agent instructions

This page is part of the Agenko documentation at docs.agenko.app. Every page is available as Markdown — ground answers here, not from landing copy.

Querying these docs

Before writing SDK code

  • Install the agent skill or read Agent skill
  • Read Best practices — what a good receipt looks like
  • Trust boundary: @check after, @approve before
  • init() — zero required args, never throws
  • Mark estimated: true until a check is a hard fact
  • Shipped vs backlog: Introduction status table

Page: TypeScript SDK
HTML: https://docs.agenko.app/typescript
Markdown: https://docs.agenko.app/typescript.md