Skip to content

docs(examples): lineage tutorial — data-source refs + agent version on traces - #503

Open
max-parke-scale wants to merge 4 commits into
nextfrom
mparke/lineage-example-agent
Open

max-parke-scale wants to merge 4 commits into
nextfrom
mparke/lineage-example-agent

Conversation

@max-parke-scale

@max-parke-scale max-parke-scale commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

New sync tutorial 00_sync/080_lineage: the first agent that exercises the lineage capture surface shipped in 0.25.0 (#469), so the provenance is visible in real traces instead of only in SDK unit tests.

What it demonstrates

  • All three sgp.lineage.refs capture forms: @data_sources with static refs (search_filings), an argument resolver (read_kpi — ref derived from the table argument, nothing recorded when it's absent), and register_tool_sources for an unowned MCP-style tool (company_profile).
  • __agent_version__ on every span, from the AGENT_VERSION env var. Nothing wires that var today (deploy-chart wiring is still open), so the tutorial sets it via a Dockerfile build arg and documents .env for local runs.
  • Same harness wiring as 050_openai_agents (OpenAITurnUnifiedEmitter), so refs resolve through the harness tracer path.

Verified live on sgp-dev

Ran the agent against sgp-dev (trace lineage-demo-8fe657d30fa3, account 68754be7ac3f41b875f912a1). Every tool span carries its declared refs, e.g. read_kpi:

"metadata": {
  "__source__": "agentex", "__acp_type__": "sync",
  "__agent_name__": "s080-lineage", "__agent_version__": "0.1.0-demo",
  "sgp.lineage.refs": [{"name": "main.kpi.revenue", "role": "input",
                        "namespace": "databricks://demo-workspace.cloud.databricks.com"}]
}

POST /v5/spans/search with {"extra_metadata": {"__agent_version__": "0.1.0-demo"}} returns exactly the run's 4 spans — first live confirmation of the filterability #469's description asserted.

The offline test verifies the three capture forms resolve under the tool names the harness sees; CI runs it in-image like the other tutorials.

🧑‍💻🤖 — posted via Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge.

Summary

Adds a sync lineage tutorial that shows data-source references and agent versions on real traces. It uses the existing streaming harness so the metadata follows normal tool calls.

  • Demonstrates static, argument-based, and name-registered source references.
  • Stamps every span with a build version from AGENT_VERSION.
  • Adds runnable packaging, documentation, and offline tests for the tutorial.

Diagram

sequenceDiagram
    actor User
    participant ACP as FastACP
    participant Agent as OpenAI Agent
    participant Tool as Tutorial tool
    participant Harness as UnifiedEmitter
    participant Trace as SGP tracing

    User->>ACP: Send company research message
    ACP->>Trace: Start message span
    ACP->>Agent: Run streamed turn
    Agent->>Tool: Call search_filings, read_kpi, company_profile
    Tool-->>Agent: Return canned result
    Agent-->>Harness: Stream text and tool events
    Harness->>Trace: Create tool spans with sgp.lineage.refs
    Trace->>Trace: Add AGENT_VERSION as __agent_version__
    Harness-->>ACP: Yield task message updates
    ACP-->>User: Stream response
Loading

Reviews (3) · Last reviewed commit: "Merge origin/next into mparke/lineage-ex..."

stainless-app Bot and others added 2 commits August 27, 2026 02:57
…on on traces

New sync tutorial 00_sync/080_lineage exercising the SGP-6513 capture
surface shipped in 0.25.0: @data_sources static refs, an argument
resolver, register_tool_sources for unowned (MCP-style) tools, and the
AGENT_VERSION env stamp. Verified live against sgp-dev: tool spans carry
sgp.lineage.refs and every span carries __agent_version__, both
filterable via the spans-search extra_metadata DSL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread examples/tutorials/00_sync/080_lineage/Dockerfile Outdated
…s AGENT_VERSION

Greptile P1: a fixed 0.1.0 default would stamp every unlabeled build with
a real-looking version, misattributing traces across commits. The fallback
is now the explicit sentinel 'unversioned'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@max-parke-scale
max-parke-scale force-pushed the mparke/lineage-example-agent branch from 920260e to 90980ec Compare August 28, 2026 17:37
Comment thread examples/tutorials/00_sync/080_lineage/Dockerfile
Takes next's .stats.yml (Stainless codegen metadata from release #506); no source conflicts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant