Pydantic AI
Pydantic AI’s OpenAIModel and AnthropicModel both accept a base_url — so pointing them at TapPass is one line. Every structured output, tool call, and retry is governed.
Setup (zero-code)
Section titled “Setup (zero-code)”export OPENAI_BASE_URL=https://tappass.example.com/v1export OPENAI_API_KEY=tp_...from pydantic_ai import Agentfrom pydantic import BaseModel
class Answer(BaseModel): content: str confidence: float
agent = Agent("openai:gpt-4o-mini", result_type=Answer)result = agent.run_sync("What's the capital of Belgium?")print(result.data.content, result.data.confidence)Explicit base URL
Section titled “Explicit base URL”from pydantic_ai import Agentfrom pydantic_ai.models.openai import OpenAIModel
model = OpenAIModel( "gpt-4o-mini", base_url="https://tappass.example.com/v1", api_key="tp_...",)
agent = Agent(model, result_type=Answer)Anthropic
Section titled “Anthropic”from pydantic_ai.models.anthropic import AnthropicModel
model = AnthropicModel( "claude-3-5-sonnet-20241022", base_url="https://tappass.example.com", api_key="tp_...",)Pydantic AI’s @agent.tool functions run in your process, but their invocations are logged in the audit trail — and you can gate them with tool_decision.rego server-side.