Introduction

An agent framework for TypeScript and Python, built on an append-only event log.

Every team building agents writes the same pieces again: a sandbox, a Slack bot, a WhatsApp bot, hooks, a knowledge base, memory, evals. threads ships them built in, for TypeScript and Python. You write what your agent does and add your API keys.

threads is alpha. It is not on npm or PyPI yet, and APIs may change. See Installation to try it from source.

What you write

An agent is a model, instructions and tools. Running it is one call.

import { anthropic } from "@threads/anthropic";
import { agent, sqlite, tool } from "@threads/core";
import { z } from "zod";

const getWeather = tool({
  name: "get_weather",
  description: "Get the weather for a city.",
  input: z.object({ city: z.string() }),
  runs: "host",
  effect: "read_only",
  execute: async ({ city }) => `It is sunny in ${city}.`,
});

const weather = agent({
  name: "weather",
  instructions: "Answer questions about the weather.",
  model: anthropic({
    model: "claude-sonnet-5",
    maxTokens: 8192,
    contextWindow: 1_000_000,
    maxOutputTokens: 128_000,
  }),
  tools: [getWeather],
});

const result = await weather.run("What is the weather in Paris?", { store: sqlite(".threads") });

The core is a plain library: no server needed. Channels, schedules and the HTTP API run in the optional host.

What's built in

Why the log matters

Every run is recorded as an append-only log of events: each input, each request the model saw, each tool call and result. That one record gives you three things.

Every step is recorded

A full audit trail of what the agent saw, decided and did.

No double actions

After a crash, an action that may already have happened is checked or handed to you, never blindly retried.

Safe to experiment

Fork any past step and try again in a separate sandbox, never against real customers.

Read How it works for a short tour of the log.

Providers

TypeScriptPython
ModelsAnthropic, OpenAI, AI SDK bridgeAnthropic, OpenAI, LiteLLM
SandboxesE2B (on Bun), DaytonaE2B, Daytona, Modal
ChannelsSlack, WhatsApp, GitHubSlack, WhatsApp, GitHub
Memorylocal, Supermemory, Zeplocal, Supermemory, Zep

Next steps

Edit on GitHub

On this page