Installation

Run threads from source in TypeScript or Python.

threads is not on npm or PyPI yet. Until it is, install it from a clone of the repository.

Requirements

  • Bun for TypeScript. The core runs on Bun; the E2B adapter needs it.
  • uv and Python 3.12 or newer for Python.

Clone and build

Both languages share generated code built from spec/. Run the generator once after cloning, and again after each pull.

git clone https://github.com/useagenthq/threads && cd threads
./scripts/generate.sh

Install your language

The packages live in a Bun workspace under typescript/packages. The simplest way to use them today is to add your app as another workspace package.

Install the workspace

cd typescript && bun install

Add your app as a package

Create typescript/packages/my-agent/package.json and list the threads packages you need:

package.json
{
  "name": "my-agent",
  "private": true,
  "type": "module",
  "dependencies": {
    "@threads/core": "workspace:*",
    "@threads/anthropic": "workspace:*",
    "zod": "^4.6.5"
  }
}

Run bun install again from typescript/.

Run your code

Put the Quickstart code in typescript/packages/my-agent/index.ts and run it:

cd packages/my-agent && bun index.ts
PackageWhat it adds
@threads/coreagent, tool, sqlite, openThread, memory, knowledge, the scripted model
@threads/anthropic, @threads/openai, @threads/ai-sdkModels
@threads/e2b, @threads/daytonaSandboxes
@threads/mcpMCP servers as tools
@threads/supermemory, @threads/zepHosted memory
@threads/host, @threads/slack, @threads/whatsapp, @threads/githubThe host and its channels
@threads/cliThe threads command

Check your setup

From the clone, run each language's checks:

cd typescript && bun run check

API keys

Providers read their keys from the environment unless you pass them in code, for example ANTHROPIC_API_KEY, OPENAI_API_KEY, E2B_API_KEY or DAYTONA_API_KEY. Each provider page lists its variables. Keys are never written to the log and never enter a sandbox.

Edit on GitHub

On this page