页面简介
Transcript Analysis for AI Agents
正文摘录
Overview You can populate a transcript database in a variety of ways depending on where your transcript data lives and how it is managed: Inspect Logs: Read transcript data from Inspect eval log files. Arize Phoenix, LangSmith, Logfire, MLFlow, and W&B Weave: Read transcript data from LLM observability platforms. Claude Code: Read transcript data from local Claude Code sessions. Harbor: Read transcript data from Harbor agent trajectory (ATIF) files. Transcript API: Python API for creating and inserting transcripts. Arrow Import: Efficient direct insertion using RecordBatchReader. Parquet Data Lake: Use an existing data lake not created using Inspect Scout. We’ll cover each of these in turn below. Before proceeding though you should be sure to familiarize yourself with the Database Schema and make a plan for how you want to map your data into it. Inspect Logs While Scout can read Inspect logs directly, you might prefer to keep them in a transcript database. You can easily import Inspect logs as follows: from inspect_scout import transcripts_db, transcripts_from async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(transcripts_from("./logs")) You could also insert a filtered list of transcripts: from inspect_scout import columns as c async with transcripts_db("s3://my-transcript-db/") as db: transcripts = ( transcripts_from("./logs") .where(c.task_set == "cybench") .where(c.model.like("openai/%")) ) await db.insert(transcripts) Arize Phoenix Arize Phoenix is an open-source observability platform for LLM applications. Phoenix uses OpenInference semantic conventions which normalize trace data across all LLM providers, so Scout can import transcripts from any provider traced through Phoenix. Use the phoenix() transcript source to import traces from a Phoenix project. You can filter by time range, specific trace ID, or limit the number of transcripts: from inspect_scout import transcripts_db from inspect_scout.sources import phoenix async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(phoenix( project="my-phoenix-project", )) Phoenix automatically extracts OpenInference context attributes — session.id, user.id, tag.tags, and metadata.* — into transcript metadata when present. You can also filter traces by session, tags, or metadata: # Filter by session await db.insert(phoenix( project="my-chatbot", session_id="sess-abc", )) # Filter by tags (all must match) await db.insert(phoenix( project="my-agent", tags=["production", "v2"], )) # Filter by metadata key-value pairs await db.insert(phoenix( project="my-agent", metadata={"env": "production", "region": "us-east"}, )) # Fetch specific traces by ID await db.insert(phoenix( project="my-agent", trace_id=["trace-1", "trace-2", "trace-3"], )) NoteAuthentication Set the PHOENIX_API_KEY environment variable to authenticate with Phoenix. Set PHOENIX_COLLECTOR_ENDPOINT for the base URL (defaults to https://app.phoenix.arize.com). LangSmith LangSmith is LangChain’s platform for tracing, evaluating, and monitoring LLM applications. Scout can import transcripts from LangSmith traces, supporting: LangChain agents and chains (via langchain tracing) OpenAI API calls (via wrap_openai) Anthropic API calls (via wrap_anthropic) Use the langsmith() transcript source to import traces from a LangSmith project. You can filter by tags, time range, or using LangSmith’s filter syntax: from inspect_scout import transcripts_db from inspect_scout.sources import langsmith async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(langsmith( project="my-langsmith-project", tags=["production"], )) NoteAuthentication Set the LANGSMITH_API_KEY environment variable to authenticate with LangSmith. You can create an API key from LangSmith Settings. Logfire Logfire is Pydantic’s observability platform for Python applications. Scout can import transcripts from Logfire traces created by any of the supported instrumentors: Pydantic AI (logfire.instrument_pydantic_ai()) OpenAI (logfire.instrument_openai()) Anthropic (logfire.instrument_anthropic()) Google GenAI (logfire.instrument_google_genai()) Use the logfire() transcript source to import traces. You can filter by time range, specific trace ID, or using SQL WHERE fragments: from inspect_scout import transcripts_db from inspect_scout.sources import logfire async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(logfire( filter="tags @> ARRAY['production']", )) NoteAuthentication Set the LOGFIRE_READ_TOKEN environment variable to authenticate with Logfire. You can create a read token from Logfire Settings > Read Tokens. MLFlow MLFlow is an LLM and Agent Observability and Evaluations platform. Scout can import traces from MLFlow, with filtering by experiment name and/or tracking URI. To import transcripts from MLFlow, first install the inspect-mlflow package: pip install inspect-mlflow Then, use the import_mlflow_traces() function to import traces. For example: from inspect_mlflow.scout import import_mlflow_traces from inspect_scout import transcripts_db async with transcripts_db("./my-transcripts") as db: await db.insert(import_mlflow_traces( experiment_name="inspect-mlflow-demo", tracking_uri="http://localhost:5000", )) Be sure to also specify required credentials using environment variables or other means before conducing an import. W&B Weave W&B Weave is Weights & Biases’ tracing and evaluation framework for LLM applications. Scout can import transcripts from Weave traces, supporting: OpenAI API calls Anthropic API calls Google/Gemini API calls Custom instrumented code (via Weave ops) Use the weave() transcript source to import traces from a Weave project. The project parameter should be in "entity/project" format: from inspect_scout import transcripts_db from inspect_scout.sources import weave async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(weave( project="my-team/my-project", )) You can filter traces by time range, apply call filters, or limit the number of transcripts: from datetime import datetime # Filter by time range await db.insert(weave( project="my-team/my-project", from_time=datetime(2025, 1, 1), to_time=datetime(2025, 6, 30), )) # Apply call filters await db.insert(weave( project="my-team/my-project", filter={"op_name": "my_agent"}, )) # Limit number of transcripts await db.insert(weave( project="my-team/my-project", limit=100, )) NoteAuthentication Set the WANDB_API_KEY environment variable to authenticate with W&B. You can create an API key from W&B Settings. Claude Code Claude Code is Anthropic’s agentic coding tool. Scout can import transcripts directly from Claude Code’s session files, which are normally stored at ~/.claude/projects/. Use the claude_code() transcript source to import sessions. Each session can contain multiple conversations separated by /clear commands — each conversation segment becomes a separate transcript. from inspect_scout import transcripts_db from inspect_scout.sources import claude_code async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(claude_code()) By default, all sessions across all projects are imported. You can narrow the import by specifying a project path, session ID, or time range: # Import sessions from a specific project await db.insert(claude_code( path="~/dev/my-project", )) # Import a specific session by ID await db.insert(claude_code( session_id="abc123-def456", )) # Import sessions from a time range from datetime import datetime await db.insert(claude_code( from_time=datetime(2025, 1, 1), to_time=datetime(2025, 6, 30), )) Claude Code transcripts are mapped to the database schema as follows: Field Value source_type "claude_code" task_set Project directory path task_id Session slug (conversation summary) agent "claude-code" Harbor Harbor is an agent evaluation framework whose installed agents emit ATIF (Agent Trajectory Interchange Format) trajectory.json files. Scout can import these trajectories, filtering by session ID and/or time range. To import ATIF trajectories, first install the harbor package (requires Python >= 3.12): pip install "harbor>=0.6.0" Then, use the atif() source to import trajectories. For example: from inspect_scout import transcripts_db from inspect_scout.sources import atif async with transcripts_db("s3://my-transcript-db/") as db: await db.insert(atif(path="path/to/harbor-runs")) You can narrow the import by specifying a session ID, time range, or limit: # Import a specific trajectory by session ID await db.insert(atif( path="path/to/harbor-runs", session_id="abc123-def456", )) # Import trajectories from a time range from datetime import datetime await db.insert(atif( path="path/to/harbor-runs", from_time=datetime(2026, 1, 1), to_time=datetime(2026, 6, 30), )) # Limit the number of transcripts await db.insert(atif( path="path/to/harbor-runs", limit=100, )) Note that from_time/to_time filter on each file’s modification time (st_mtime), not the trajectory’s run time — mtime is reset by cp, git checkout, rsync, etc., so it can diverge from when the run actually occurred. Note that subagent trajectories are inlined into their parent as spans, so a parent and its referenced subagent files should be imported together in one pass (the default when pointing path at a directory). Importing them across separate passes — e.g. incremental time-windowed imports — can store a subagent’s events twice, once standalone and once inlined. The atif() source reads trajectories produced by Harbor’s own runner (e.g. harbor run --agent claude_code). When Harbor tasks are instead run via Inspect AI through inspect_harbor, the output is an Inspect eval log — see Inspect Logs. ATIF trajectories are mapped to the database schema as follows: Field Value source_type "atif" transcript_id Trajectory trajectory_id, else session_id (or run id) + file stem source_id Trajectory session_id (or trajectory_id) agent Trajectory agent.name model Trajectory agent.model_name Transcript API