Tracing quickstart
Send one run through the AI Gateway or install agent hooks, then verify the trace and the guard decision in Provon.
Both paths can block in real time. For passive evidence from existing instrumentation or historical sessions, see OpenTelemetry and Agent transcripts.
Prerequisites#
- A running Provon deployment.
- A project API key with the default capabilities:
telemetry:ingest,telemetry:read, andguardrails:evaluate. - For the Gateway path: a provider key and at least one model binding in Providers.
- For the hooks path: the
provonCLI and Claude Code, Codex, Cursor, OpenCode, dsh, or Pi installed locally.
export PROVON_API_KEY="your_project_api_key"Send a trace#
Point an OpenAI-compatible client at the Gateway origin and add a stable conversation header:
export PROVON_GATEWAY_URL="https://<your-provon-gateway-origin>/v1"
curl "$PROVON_GATEWAY_URL/chat/completions" \
-H "Authorization: Bearer $PROVON_API_KEY" \
-H "Content-Type: application/json" \
-H "x-otel-gen-ai-conversation-id: quickstart-gateway-1" \
-d '{
"model": "openai/gpt-5-mini",
"messages": [{ "role": "user", "content": "Refund order 123 and explain the policy." }]
}'Replace the model with one enabled for your provider. The Gateway records the request, response, provider attempt, latency, tokens, errors, and guardrail decisions according to the project's trace-capture settings.
Guardrail outcomes appear only on calls actually proxied through the Gateway. See the Gateway quickstart for provider setup and enforcement modes.
Install the guard and trace hooks, then run one agent session:
provon auth login
provon setup guard --agent claude-code
provon setup ingest --agent claude-code--agent claude-code limits setup to Claude Code; omit it to install for every detected tool.
setup guard writes the synchronous PreToolUse guard hook; setup ingest writes the
asynchronous PostToolUse/Stop trace hooks.
Run a session and ask the agent to call a tool. If the project has an enforced rule that matches,
the hook denies the call and returns the rule reason to the agent. In Audit mode the call proceeds
and the decision is recorded as wouldBlock.
If the decision API is unreachable, the guard hook follows its fail mode. The default is open;
reinstall with provon setup guard --fail-mode closed to deny instead. See
Agent hooks.
Verify the evidence#
Open Traces and find the run you just created.
Verify:
- the trace has a stable conversation identifier;
- model and tool spans appear in causal order;
- token, cost, latency, status, and error fields appear when the source emitted them;
- for hooks, a
provon.guard.tool_callspan records the decision, mode, rule, and bounded reason.
Note
A trace is evidence that the run was captured, not proof that the task succeeded. A healthy trace may legitimately produce no Finding.
Inspect it from the CLI#
CLI authentication reads the same project key:
provon auth token set --api-key "$PROVON_API_KEY"Search and summarize the trace:
provon traces search "<trace-id>" --search-type trace-id --range 1h
provon traces summarize "<trace-id>"traces summarize reports telemetry facts such as duration, spans, errors, tokens, cost, and slow
operations. It does not run diagnostic Rules or create Findings.
Diagnose the same evidence with the CLI#
Export a trace bundle, then diagnose it locally without uploading or persisting a Finding:
provon traces export "<trace-id>" --out ./quickstart-trace
provon diagnose ./quickstart-trace --mode rule-signalsThe healthy example should normally produce no Finding. That is a successful result: traces are evidence, while Findings are supported problems. See Trace diagnosis with CLI.
Limitations#
- Gateway capture only sees traffic that crosses the Gateway; tool execution outside that boundary needs hooks or application instrumentation.
- Hook capture only sees local sessions where the hook is installed and trusted.
provon traces summarizeis a read summary; diagnosis and Finding publication require Rules and a recorded conversation settled long enough to run.- Advanced OTLP and transcript ingest add evidence but cannot block a model call or a tool call.