Skip to content

fix(templates): register the local Agentex tracing processor so the developer UI traces tab shows spans - #512

Open
michaelxu2288 wants to merge 2 commits into
scaleapi:nextfrom
michaelxu2288:fix/templates-local-tracing
Open

fix(templates): register the local Agentex tracing processor so the developer UI traces tab shows spans#512
michaelxu2288 wants to merge 2 commits into
scaleapi:nextfrom
michaelxu2288:fix/templates-local-tracing

Conversation

@michaelxu2288

@michaelxu2288 michaelxu2288 commented Sep 10, 2026

Copy link
Copy Markdown

Problem

The README's quickstart ends with "Investigate your agent's behavior by opening the traces tab", but every agentex init framework template registers only SGPTracingProcessorConfig, which disables itself when SGP_API_KEY / SGP_ACCOUNT_ID are empty. No other code creates a tracing processor (TracingProcessorManager starts with an empty list), so the spans the unified harness derives are never written to the backend /spans API and the traces sidebar shows "No spans found for this task" for any locally scaffolded agent.

Repro: agentex init (Sync ACP + Claude Code, or any framework), run it against ./dev.sh, send a message, GET /spans?task_id=<task> -> [], backend log has no POST /spans.

Fix

Register AgentexTracingProcessorConfig() ahead of the SGP block in all 16 framework templates (sync / default / temporal x openai-agents, pydantic-ai, langgraph, claude-code, codex, plus the OpenAI local-sandbox variant). SGP registration is unchanged. Fixes a comment in sync-langgraph that claimed to register the Agentex processor while registering SGP. Adds a parametrized test in tests/lib/cli/test_init_templates.py asserting every framework template registers the local processor.

Verification

  • tests/lib/cli/test_init_templates.py: 42 passed (26 existing + 16 new).
  • All 19 templates rendered through create_project_structure and byte-compiled.
  • Fresh agent scaffolded from the patched sync-claude-code template against a local backend: message -> POST /spans, GET /spans?task_id=... returns the message (AGENT_WORKFLOW) span. Same for a temporal-claude-code agent (Turn 1/2/3 spans via the worker). Without the change: 0 spans.

Follow-ups (not in this PR)

  • 22 tutorial/demo files under examples/ register SGP only, and 00_sync/020_streaming (which the README tells users to copy) registers nothing; happy to mirror this change there.
  • Alternative that fixes everything at once: have the SDK auto-register the Agentex processor when AGENTEX_BASE_URL is set (idempotent, env kill-switch). That changes runtime behaviour for existing agents, so I kept this PR template-only; maintainers' call.

https://claude.ai/code/session_01HCVKnA7LeJZ44nxZz1uzF3

RetriggerConfidence Score: 5/5

The PR appears safe to merge under the review rubric because no new reportable findings or outstanding previous findings remain.

Summary

  • Adds registration to synchronous, asynchronous, and Temporal framework templates.
  • Skips registration when AGENTEX_BASE_URL is explicitly empty in the process environment.
  • Adds parametrized coverage ensuring every concrete framework template contains the registration.
  • Preserves the existing optional SGP tracing setup.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    H[Unified harness] --> S[Derived business spans]
    S --> M[Tracing processor manager]
    M -->|AgentexTracingProcessorConfig| A[AgentEx spans API]
    M -->|SGPTracingProcessorConfig| G[SGP tracing backend]
    A --> U[Developer UI traces tab]
Loading

Reviews (2) · Last reviewed commit: "fix(templates): skip the local tracing p..."

…eveloper UI traces tab shows spans

Every framework template registered only SGPTracingProcessorConfig, which
disables itself when SGP_API_KEY or SGP_ACCOUNT_ID is empty. Nothing else
creates a tracing processor, so spans derived by the unified harness were
never written to the backend /spans API and a scaffolded agent always showed
"No spans found for this task" in the developer UI, contradicting the README
("open the traces tab").

Register AgentexTracingProcessorConfig() ahead of the SGP block in all 16
framework templates (sync/default/temporal x openai-agents, pydantic-ai,
langgraph, claude-code, codex, plus the local-sandbox variant), fix a
sync-langgraph comment that claimed to register the Agentex processor, and
add a parametrized test asserting every framework template registers it.

Verified on a scaffolded sync Claude Code agent and a Temporal Claude Code
agent against a local backend: with the registration, message/turn spans
appear via POST /spans; without it, none do.

Claude-Session: https://claude.ai/code/session_01HCVKnA7LeJZ44nxZz1uzF3
Comment thread src/agentex/lib/cli/templates/sync-claude-code/project/acp.py.j2 Outdated
…disabled

The runtime treats an explicitly empty AGENTEX_BASE_URL as "no backend" and
skips agent registration; registering the Agentex tracing processor
unconditionally would then make every span export fail. Guard the
registration on the same condition in all 16 framework templates.

Claude-Session: https://claude.ai/code/session_01HCVKnA7LeJZ44nxZz1uzF3
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