Working with Multiple Agents
Learn how to use LangDB to Trace Multi Agent workflows
Last updated
Was this helpful?
Learn how to use LangDB to Trace Multi Agent workflows
Last updated
Was this helpful?
Was this helpful?
from openai import OpenAI
from uuid import uuid4
client = OpenAI(
base_url="https://api.us-east-1.langdb.ai/{langdb_project_id}/v1" # LangDB API base URL,
api_key=api_key, # Replace with your LangDB token
)
response1 = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "developer", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}],
extra_headers={"x-thread-id": thread_id, "x-run-id": run_id}
)
# Agent 2 processes the response
response2 = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "developer", "content": "Processing user input."},
{"role": "user", "content": response1.choices[0].message["content"]}],
extra_headers={"x-thread-id": thread_id, "x-run-id": run_id}
)