Our docs got a refresh! Check out the new content and improved navigation. For detailed API reference see our Python SDK docs and TypeScript SDK.
Description
PercivalIntegrations

Custom Integration

How to trace your custom agentic framework with OpenInference + Patronus using OpenAI or Anthropic models.

Instrumenting In‑House Agents with Percival

If you already have an internal agent framework that calls OpenAI or Anthropic models directly, you can attach Percival/Patronus tracing with a few lines of code.


1. OpenAI Instrumentation

# Install required packages
pip install openinference-instrumentation-openai \
            opentelemetry-instrumentation-threading \
            opentelemetry-instrumentation-asyncio \
            patronus

2. Anthropic Instrumentation

pip install openinference-instrumentation-anthropic \
            opentelemetry-instrumentation-threading \
            opentelemetry-instrumentation-asyncio \
            anthropic \
            patronus

Tip Both snippets assume that the relevant environment variables (OPENAI_API_KEY, ANTHROPIC_API_KEY, etc.) are already set.

On this page