Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trulayer.ai/llms.txt

Use this file to discover all available pages before exploring further.

Install

pip install trulayer pydantic-ai

Instrument

import os
import trulayer

trulayer.init(api_key=os.environ["TRULAYER_API_KEY"], project_name="my-app")
trulayer.instrument_pydanticai()
After instrumentation every Agent.run / Agent.run_sync call and every tool invocation is captured — no per-callsite changes needed.

Minimal example

from pydantic_ai import Agent

agent = Agent("openai:gpt-4o-mini", system_prompt="You are a concise assistant.")

result = agent.run_sync("What is the capital of France?")
print(result.output)
# A trace appears in the dashboard with one `agent` span and one `llm` child.

What gets captured

  • agent spans for every run / run_sync / run_stream call with the user prompt, system prompt, and final structured output
  • llm spans for each underlying model call, including token counts and any tool-call requests from the model
  • tool spans for each @agent.tool invocation with validated arguments and return value
  • Validation errors from Pydantic are captured on the span as errors so you can filter failed runs in the dashboard