From 4157475166d0b6c3c02c93cc1c689f5d775088d1 Mon Sep 17 00:00:00 2001 From: Suhani Nagpal Date: Fri, 29 May 2026 13:11:59 +0530 Subject: [PATCH 1/2] docs(integrations): add Pydantic AI tracing page Add a TraceAI integration page for Pydantic AI under /docs/integrations/traceai/pydantic_ai, wired into both the Tracing and Integrations sidebars plus both overview grids. Verified end-to-end: the example code runs against the live FAGI tracer and the agent run span lands in the dashboard. --- src/lib/navigation.ts | 2 + src/pages/docs/integrations/index.mdx | 1 + .../docs/integrations/traceai/pydantic_ai.mdx | 72 +++++++++++++++++++ src/pages/docs/tracing/auto/index.mdx | 3 + 4 files changed, 78 insertions(+) create mode 100644 src/pages/docs/integrations/traceai/pydantic_ai.mdx diff --git a/src/lib/navigation.ts b/src/lib/navigation.ts index f8c26b39..c7d3ef96 100644 --- a/src/lib/navigation.ts +++ b/src/lib/navigation.ts @@ -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/integrations/traceai/pydantic_ai' }, { title: 'Instructor', href: '/docs/tracing/auto/instructor' }, { title: 'PromptFlow', href: '/docs/tracing/auto/promptflow' }, { title: 'Guardrails', href: '/docs/tracing/auto/guardrails' }, @@ -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' }, diff --git a/src/pages/docs/integrations/index.mdx b/src/pages/docs/integrations/index.mdx index c61343f7..0206ef6c 100644 --- a/src/pages/docs/integrations/index.mdx +++ b/src/pages/docs/integrations/index.mdx @@ -40,6 +40,7 @@ TraceAI provides pre-built auto-instrumentation for the following frameworks and + diff --git a/src/pages/docs/integrations/traceai/pydantic_ai.mdx b/src/pages/docs/integrations/traceai/pydantic_ai.mdx new file mode 100644 index 00000000..2e1f1ed9 --- /dev/null +++ b/src/pages/docs/integrations/traceai/pydantic_ai.mdx @@ -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) +``` diff --git a/src/pages/docs/tracing/auto/index.mdx b/src/pages/docs/tracing/auto/index.mdx index 9eb6e48e..aa060a7b 100644 --- a/src/pages/docs/tracing/auto/index.mdx +++ b/src/pages/docs/tracing/auto/index.mdx @@ -83,6 +83,9 @@ Python and JS/TS integrations use instrumentors that patch client libraries. Jav `traceAI-smolagents` + + `traceAI-pydantic-ai` + `traceAI-instructor` From d7a92e114d91bbc06c50c173fd933dfb54e60f3e Mon Sep 17 00:00:00 2001 From: Suhani Nagpal Date: Fri, 29 May 2026 13:20:37 +0530 Subject: [PATCH 2/2] docs(tracing): add Pydantic AI auto-instrumentation page Restore the /docs/tracing/auto/pydantic_ai page so the auto-tracing surface has its own canonical entry matching the rest of the framework sibling pages. Repoint the Tracing sidebar entry and the auto-tracing overview card at it. The Integrations sidebar and overview continue to link to /docs/integrations/traceai/pydantic_ai. --- src/lib/navigation.ts | 2 +- src/pages/docs/tracing/auto/index.mdx | 2 +- src/pages/docs/tracing/auto/pydantic_ai.mdx | 72 +++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 src/pages/docs/tracing/auto/pydantic_ai.mdx diff --git a/src/lib/navigation.ts b/src/lib/navigation.ts index c7d3ef96..e44fb227 100644 --- a/src/lib/navigation.ts +++ b/src/lib/navigation.ts @@ -427,7 +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/integrations/traceai/pydantic_ai' }, + { 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' }, diff --git a/src/pages/docs/tracing/auto/index.mdx b/src/pages/docs/tracing/auto/index.mdx index aa060a7b..28d8afcd 100644 --- a/src/pages/docs/tracing/auto/index.mdx +++ b/src/pages/docs/tracing/auto/index.mdx @@ -83,7 +83,7 @@ Python and JS/TS integrations use instrumentors that patch client libraries. Jav `traceAI-smolagents` - + `traceAI-pydantic-ai` diff --git a/src/pages/docs/tracing/auto/pydantic_ai.mdx b/src/pages/docs/tracing/auto/pydantic_ai.mdx new file mode 100644 index 00000000..50b1feed --- /dev/null +++ b/src/pages/docs/tracing/auto/pydantic_ai.mdx @@ -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) +```