Skip to main content
Threads group related AI Router calls into a single conversation view, letting you trace multi-turn interactions across your Deployments and Agents.

Viewing Threads

To view Threads, head to the Traces section and select the Threads tab.
By selecting a Thread, you can then visualize the conversation.

Adding a Generation to a Thread

Threads are configured at runtime when using the Invoke API for Deployments, or when invoking an Agent. The API receives the following extra parameter:
Conversations will be grouped by Thread ID Tags can be used to filter and search Threads in the panel.
{
  "thread": { 
   	"id": "<unique-thread-id>",
    "tags": ["tag1", "tag2"]
  }
}
import os
from orq_ai_sdk import Orq

client = Orq(
  api_key=os.environ.get("ORQ_API_KEY", "<insert your api key here>"),
  environment="production",
)

generation = client.deployments.invoke(
  key="deployment-demo",
  context={"environments": []},
  metadata={"custom-field-name": "custom-metadata-value"},
  thread={
    "id": "<unique-thread-id>",
    "tags": ["tag1", "tag2"]
  }
)

print(generation.choices[0].message.content)

AI Router Thread Management

Full API reference for attaching threads to AI Router Deployment and Agent invocations.