threadline

Introduction

Threadline is the universal context layer for AI agents. It gives every user a single, living context object that any agent can read and update — across models, platforms, and products.

How it works

At a high level, Threadline is three simple primitives:

01

capture

Agents send interactions to Threadline. We extract deltas and merge them into a structured context object.

02

store

Context lives in Postgres + Redis with per-user isolation, audit logging, and strong controls.

03

inject

Your agent calls tl.inject() to get a personalized system prompt for every user, every time.

Quick start in 5 minutes

01

Create a Threadline account and generate an API key from the developer dashboard.

02

Install the SDK in your agent project:

terminal
npm install threadline-sdk

03

Initialize the client with your API key:

typescript
import { Threadline } from "threadline-sdk"

const tl = new Threadline({
apiKey: process.env.THREADLINE_KEY!,
baseUrl: process.env.THREADLINE_BASE_URL ?? "https://api.threadline.dev",
})

04

Inject context into your system prompt:

typescript
const prompt = await tl.inject(userId, basePrompt)

05

Update context after each interaction:

typescript
await tl.update({
userId,
userMessage,
agentResponse,
})

From here, you can explore:

  • The Quick Start for a full Express.js chatbot example.
  • The API Reference for HTTP details.
  • The SDK Reference for TypeScript types and helper methods.