> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-DB Tracing with tracing=True

> Trace agents with multiple databases using tracing=True in AgentOS.

Configure tracing with the `tracing=True` flag when agents have separate databases. A dedicated `db` ensures all traces are stored in one central location.

**1. Create a Python file**

```python tracing_multi_db_flag.py theme={null}
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.openai import OpenAIResponses
from agno.os import AgentOS
from agno.tools.hackernews import HackerNewsTools
from agno.tools.websearch import WebSearchTools

# Set up databases - each agent has its own db
db1 = SqliteDb(db_file="tmp/db1.db", id="db1")
db2 = SqliteDb(db_file="tmp/db2.db", id="db2")

# Dedicated traces database
db = SqliteDb(db_file="tmp/traces.db", id="traces")

agent = Agent(
    name="HackerNews Agent",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[HackerNewsTools()],
    instructions="You are a hacker news agent. Answer questions concisely.",
    markdown=True,
    db=db1,
)

agent2 = Agent(
    name="Web Search Agent",
    model=OpenAIResponses(id="gpt-5.2"),
    tools=[WebSearchTools()],
    instructions="You are a web search agent. Answer questions concisely.",
    markdown=True,
    db=db2,
)

# Setup AgentOS with tracing=True and dedicated db
# This ensures traces are written to and read from the same database
agent_os = AgentOS(
    description="Example app for tracing with multiple databases",
    agents=[agent, agent2],
    tracing=True,
    db=db,  # Dedicated database for traces
)
app = agent_os.get_app()

if __name__ == "__main__":
    agent_os.serve(app="tracing_multi_db_flag:app", reload=True)
```

<Snippet file="create-venv-step.mdx" />

**2. Install dependencies**

```bash theme={null}
uv pip install -U openai ddgs "agno[os]" opentelemetry-api opentelemetry-sdk openinference-instrumentation-agno
```

**3. Export your OpenAI API key**

```bash Mac/Linux theme={null}
export OPENAI_API_KEY="your_openai_api_key_here"
```

```bash Windows theme={null}
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

**4. Run AgentOS**

```bash theme={null}
python tracing_multi_db_flag.py
```

Your AgentOS will be available at `http://localhost:7777`. View traces in the AgentOS dashboard.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.