just-another-sdk

Introduction

A TypeScript agent SDK with zero runtime dependencies.

just-another-sdk is a TypeScript SDK for building LLM agents. You define an agent, give it tools, run the loop, and get a typed result.

import { Agent, tool } from 'just-another-sdk'
import { openrouter } from 'just-another-sdk/providers'
import * as z from 'zod'

const agent = new Agent({
  name: 'travel-assistant',
  instructions: 'Use the tools available to you rather than guessing.',
  model: openrouter('anthropic/claude-opus-5'),
  tools: [
    tool({
      name: 'get_weather',
      description: 'Get the current weather for a city.',
      inputSchema: z.object({ city: z.string() }),
      execute: async ({ city }) => ({ city, tempC: 18, summary: 'clear' }),
    }),
  ],
})

const result = await agent.run('What is the weather in Paris?')
console.log(result.output)

Why another one

Agent frameworks demo well. Then you ship one, and the problems that actually cost you time turn out to be the unglamorous ones — a model that loops until your bill spikes, a tool exception that takes down a request, an API key in a CI log, a dependency tree you cannot audit, and no way to see what your agent did.

This SDK treats those as the product rather than the appendix.

Zero dependencies

npm ls shows one package. Providers are plain fetch calls — no vendor SDK to keep in sync, nothing transitive to audit.

A loop that cannot hang

Every exit path sets a stopReason. A model that calls tools forever costs you maxTurns requests, not your afternoon.

Failures stay recoverable

A tool that throws becomes a tool result the model reads and works around, so the run finishes with an answer.

Your validator, not ours

Zod, Valibot, ArkType — anything implementing Standard Schema. Handler input is typed from the schema.

Secrets never reach your logs

An API key cannot appear in a thrown error, an event, or a trace. A test suite asserts it.

Observable by construction

Tracing, streaming, and progress UIs all consume one event stream.

Where to start

Requirements

Node 20.19 or newer, or any runtime providing fetch and AbortSignal — Bun, Deno, Cloudflare Workers, and Vercel Edge all work. TypeScript is optional, but the API is designed around it.

This is a young project, but every page here documents something that is implemented and covered by tests. Where a page describes work that is still planned, it says so under a Coming next heading at the end rather than mixing it into the API above.

On this page