Skip to main content
Prefer zero setup? Use plog run or import provenlog.auto instead. See Auto-Instrumentation.

Setup

from provenlog.integrations.ag2 import Trail
import autogen

trail = Trail(agent_id="my-autogen-agent")
autogen.runtime_logging.start(logger=trail)

What gets captured

EventAction TypeDetails
Chat completionsLLM_CALL / LLM_RESPONSEModel, messages, token counts
Function callsTOOL_CALL / TOOL_RESULTFunction name, arguments, output
Agent registrationCUSTOMAgent name, configuration
Cost trackingCUSTOMPer-call and cumulative costs
Cache statusCUSTOMCache hits and misses

How it works

The Trail hooks into AG2’s runtime logging system via autogen.runtime_logging.start. It receives structured events for all agent activity across the AG2 framework.

Configuration

# Simple — uses default embedded mode
trail = Trail(agent_id="my-autogen-agent")

# With explicit client for custom configuration
from provenlog import ProvenLogClient

client = ProvenLogClient("http://localhost:7600", agent_id="my-agent")
trail = Trail(client=client, agent_id="my-autogen-agent")