Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ export const tabNavigation: NavTab[] = [
{ title: 'DSPy', href: '/docs/tracing/auto/dspy' },
{ title: 'OpenAI Agents', href: '/docs/tracing/auto/openai_agents' },
{ title: 'Smol Agents', href: '/docs/tracing/auto/smol_agents' },
{ title: 'Pydantic AI', href: '/docs/tracing/auto/pydantic_ai' },
{ title: 'Instructor', href: '/docs/tracing/auto/instructor' },
{ title: 'PromptFlow', href: '/docs/tracing/auto/promptflow' },
{ title: 'Guardrails', href: '/docs/tracing/auto/guardrails' },
Expand Down Expand Up @@ -659,6 +660,7 @@ export const tabNavigation: NavTab[] = [
{ title: 'DSPy', href: '/docs/integrations/traceai/dspy' },
{ title: 'OpenAI Agents', href: '/docs/integrations/traceai/openai_agents' },
{ title: 'Smol Agents', href: '/docs/integrations/traceai/smol_agents' },
{ title: 'Pydantic AI', href: '/docs/integrations/traceai/pydantic_ai' },
{ title: 'Instructor', href: '/docs/integrations/traceai/instructor' },
{ title: 'PromptFlow', href: '/docs/integrations/traceai/promptflow' },
{ title: 'Guardrails', href: '/docs/integrations/traceai/guardrails' },
Expand Down
1 change: 1 addition & 0 deletions src/pages/docs/integrations/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ TraceAI provides pre-built auto-instrumentation for the following frameworks and
<Card title="Mastra" href="/docs/integrations/traceai/mastra" />
<Card title="DSPy" href="/docs/integrations/traceai/dspy" />
<Card title="Instructor" href="/docs/integrations/traceai/instructor" />
<Card title="Pydantic AI" href="/docs/integrations/traceai/pydantic_ai" />
<Card title="Guardrails AI" href="/docs/integrations/traceai/guardrails" />
<Card title="Hugging Face smolagents" href="/docs/integrations/traceai/smol_agents" />
<Card title="MCP" href="/docs/integrations/traceai/mcp" />
Expand Down
72 changes: 72 additions & 0 deletions src/pages/docs/integrations/traceai/pydantic_ai.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "Pydantic AI Integration with Future AGI for Agent Observability"
description: "Integrate Pydantic AI with Future AGI observability. Trace agent runs, tool calls, structured outputs, and streaming automatically using traceAI-pydantic-ai."
---

## 1. Installation
Install the traceAI and other necessary packages.

```bash
pip install traceAI-pydantic-ai pydantic-ai
```

---

## 2. Set Environment Variables
Set up your environment variables to authenticate with FutureAGI.

```python
import os

os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"
```

---

## 3. Initialize Trace Provider
Set up the trace provider to create a new project in FutureAGI, establish telemetry data pipelines .

```python
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="PYDANTIC_AI_APP",
)
```

---

## 4. Instrument your Project
Use the Pydantic AI Instrumentor to instrument your project.

```python
from traceai_pydantic_ai import PydanticAIInstrumentor

PydanticAIInstrumentor().instrument(tracer_provider=trace_provider)
```

---

## 5. Run your Pydantic AI application.
Run your Pydantic AI application as you normally would. Our Instrumentor will automatically trace and send the telemetry data to our platform.

```python
from pydantic_ai import Agent, RunContext

agent = Agent(
"openai:gpt-4o",
instructions="You are a helpful assistant.",
)

@agent.tool
def get_weather(ctx: RunContext, city: str) -> str:
"""Get the weather for a city."""
return f"The weather in {city} is sunny and 72F"

result = agent.run_sync("What is the weather in San Francisco?")
print(result.output)
```
3 changes: 3 additions & 0 deletions src/pages/docs/tracing/auto/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ Python and JS/TS integrations use instrumentors that patch client libraries. Jav
<Card title="Smol Agents" icon="plug" href="/docs/tracing/auto/smol_agents">
`traceAI-smolagents`
</Card>
<Card title="Pydantic AI" icon="plug" href="/docs/tracing/auto/pydantic_ai">
`traceAI-pydantic-ai`
</Card>
<Card title="Instructor" icon="plug" href="/docs/tracing/auto/instructor">
`traceAI-instructor`
</Card>
Expand Down
72 changes: 72 additions & 0 deletions src/pages/docs/tracing/auto/pydantic_ai.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "Pydantic AI Tracing with Future AGI: Auto-Instrumentation"
description: "Set up auto-instrumentation for Pydantic AI with Future AGI tracing. Install traceAI-pydantic-ai to capture agent runs, tool calls, and model interactions."
---

## 1. Installation
Install the traceAI and other necessary packages.

```bash
pip install traceAI-pydantic-ai pydantic-ai
```

---

## 2. Set Environment Variables
Set up your environment variables to authenticate with FutureAGI.

```python
import os

os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
os.environ["FI_API_KEY"] = "your-futureagi-api-key"
os.environ["FI_SECRET_KEY"] = "your-futureagi-secret-key"
```

---

## 3. Initialize Trace Provider
Set up the trace provider to create a new project in FutureAGI, establish telemetry data pipelines .

```python
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType

trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="PYDANTIC_AI_APP",
)
```

---

## 4. Instrument your Project
Use the Pydantic AI Instrumentor to instrument your project.

```python
from traceai_pydantic_ai import PydanticAIInstrumentor

PydanticAIInstrumentor().instrument(tracer_provider=trace_provider)
```

---

## 5. Run your Pydantic AI application.
Run your Pydantic AI application as you normally would. Our Instrumentor will automatically trace and send the telemetry data to our platform.

```python
from pydantic_ai import Agent, RunContext

agent = Agent(
"openai:gpt-4o",
instructions="You are a helpful assistant.",
)

@agent.tool
def get_weather(ctx: RunContext, city: str) -> str:
"""Get the weather for a city."""
return f"The weather in {city} is sunny and 72F"

result = agent.run_sync("What is the weather in San Francisco?")
print(result.output)
```
Loading