Skip to main content
Threads group related AI Gateway 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.
The Threads Overview, dates, duration, traces, and costs are available to see.
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>"),
)

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

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

AI Gateway Thread Management

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