Skip to main content

What are Threads?

Threads allow you to maintain stateful conversation context across multiple runs within a deployment. Each thread is scoped to a single deployment and tracks conversation history, state, and checkpoints. This is modeled after LangGraph’s Threads API and works with CrewAI, LangGraph Python, and LangGraph JS frameworks.

Key Concepts

  • Thread: A stateful conversation context scoped to a deployment
  • Thread State: JSON values representing the current conversation state
  • Checkpoints: Historical snapshots of thread state after each run
  • Thread Status: idle (ready), busy (running), interrupted, or error

Creating a Thread

Running in a Thread

When you create a run in a thread context, the runner receives the thread state and can update it after completion.

Concurrency

Only one run can execute in a thread at a time. If a thread is busy, new run requests will be rejected with a 409 status. Wait for the current run to complete before starting a new one.

Thread History

Each run that updates thread state creates a checkpoint. You can view the history of state changes:

Managing Threads

Streaming

Real-time event streaming from runs

API Reference

Threads API docs