Documentation Index
Fetch the complete documentation index at: https://docs.quraite.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Quraite provides a built-in adapter for Pydantic AI agents. This adapter allows you to integrate Pydantic AI agents with Quraite and run evaluations on them.
This adapter uses OpenInference instrumentation to capture the trajectory of the agent.
Prerequisites
- Agent dependencies:
pydantic-ai package, LLM API key (for example, Google Gemini via pydantic_ai.models.google), and any tools you want to use.
- Quraite dependencies:
quraite[pydantic-ai-oi] package.
Define Your Pydantic AI Agent
You create a normal Pydantic AI Agent first, exactly as you would in any Pydantic AI project.
from dotenv import load_dotenv
from pydantic_ai import Agent, RunContext
from pydantic_ai.models.google import GoogleModel
load_dotenv(override=True)
model = GoogleModel("gemini-2.5-flash")
agent = Agent(
model=model,
system_prompt=(
"You are a helpful calculator assistant. You must use the tools "
"according to the BODMAS rule."
),
# this is required for OpenInference instrumentation to capture the agent trajectory.
instrument=True,
)
@agent.tool
def add(ctx: RunContext, a: float, b: float) -> float:
"""Add two numbers."""
return a + b
@agent.tool
def subtract(ctx: RunContext, a: float, b: float) -> float:
"""Subtract two numbers."""
return a - b
@agent.tool
def multiply(ctx: RunContext, a: float, b: float) -> float:
"""Multiply two numbers."""
return a * b
@agent.tool
def divide(ctx: RunContext, a: float, b: float) -> float:
"""Divide two numbers."""
return a / b
Set up Tracing
Quraite provides a tracing setup helper. For Pydantic AI, pass the Framework.PYDANTIC_AI enum:
from quraite.tracing import Framework, setup_tracing
tracer_provider = setup_tracing([Framework.PYDANTIC_AI])
Wrap the Pydantic AI Agent
Wrap the agent with the PydanticAIAdapter and pass the tracer_provider to it.
from quraite.adapters import PydanticAIAdapter
pydantic_adapter = PydanticAIAdapter(
agent=agent,
tracer_provider=tracer_provider,
)
Run the Agent
Once wrapped, you expose the adapter using Quraite’s run_agent helper.
if __name__ == "__main__":
from quraite import run_agent
run_agent(
pydantic_adapter,
port=8080,
host="0.0.0.0",
tunnel="cloudflare",
)
End-to-End Examples