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 to run TypeScript.
- uv and Python 3.12 or newer to generate the shared code, even if you only plan to use TypeScript. Python also uses them to run the package.
Clone and build
Both languages share generated code built from spec/. Run the generator through uv so it uses
Python 3.12 rather than an older system python3. The first run creates python/.venv. Repeat the
same command after each pull.
git clone https://github.com/useagenthq/threads && cd threads
uv run --project python ./scripts/generate.shInstall 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 installAdd your app as a package
Create typescript/packages/my-agent/package.json and list the threads packages you need:
{
"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| Package | What it adds |
|---|---|
@threads/core | agent, tool, sqlite, openThread, memory, knowledge, the scripted model |
@threads/anthropic, @threads/openai, @threads/ai-sdk | Models |
@threads/e2b, @threads/daytona | Sandboxes |
@threads/mcp | MCP servers as tools |
@threads/supermemory, @threads/zep | Hosted memory |
@threads/host, @threads/slack, @threads/whatsapp, @threads/github | The host and its channels |
@threads/cli | The threads command |
Check your setup
From the clone's root, run the offline eval example in your language. It needs no API key or network connection:
cd typescript && bun examples/evals.tsBoth print 1 passed, 0 failed. These commands check that the generated code and your selected
language run together. If you're working on the framework itself, return to the clone's root and
run the full suites instead:
cd typescript && uv run --project ../python --extra host bun run checkFor Python, use cd python && uv sync --all-extras && uv run pytest. The TypeScript suite includes
tests against the Python host, which is why its full check asks uv for the host extra.
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.