Skip to content

docs(adapters): fix framework user-doc inaccuracies on agents branch (PR-2a + PR-2b, ~18 issues)#157

Closed
mmercuri wants to merge 2 commits into
feat/instrument-frameworks-agentsfrom
docs/fix-agents-branch-user-docs
Closed

docs(adapters): fix framework user-doc inaccuracies on agents branch (PR-2a + PR-2b, ~18 issues)#157
mmercuri wants to merge 2 commits into
feat/instrument-frameworks-agentsfrom
docs/fix-agents-branch-user-docs

Conversation

@mmercuri

Copy link
Copy Markdown
Contributor

Summary

Fixes 17 of the 18 inaccuracies the audit attributed to the agents branch in A:/tmp/adapter-user-docs-audit.md (2026-05-10). One inaccuracy (the embedding event-name fix) and one heavy rewrite (benchmark_import) are already addressed by PR #150 and have been deliberately excluded here to avoid double-committing.

Two themed commits:

  1. agent.action removal across 7 docs (PR-2a)agno, bedrock_agents, ms_agent_framework, openai_agents, pydantic_ai, semantic_kernel, strands. Grep confirmed zero "agent.action" literals in the entire framework adapter source tree. Per-adapter event tables rewritten against what lifecycle.py actually emits, with lifecycle.py:<line> citations on every row. Also fixes the related per-doc findings the audit listed alongside each agent.action row (reasoning bullet on agno, termination bullet on ms_agent_framework, policy.violation on pydantic_ai, agent.state.change on semantic_kernel, agent.handoff on strands).
  2. llama_index event taxonomy rewrite (PR-2b) — replaced LLMCompletionStartEventLLMStartEvent, AgentToolCallEventToolCallEvent; removed AgentChatWithStep* events and the Embedding events bullet (no source match); replaced agent.action row with the actual agent.output (lifecycle.py:283); added the previously-omitted cost.record row (lifecycle.py:218); corrected RAG retriever wording (tool_name="retrieval", tool_type="retrieval", lifecycle.py:244-257).

Per-doc fix breakdown

Doc Issues fixed Source verified
frameworks-agno.md agent.action row removed; reasoning bullet rewritten; cost.record added lifecycle.py:228 (no agent.action literal anywhere)
frameworks-bedrock_agents.md agent.action row removed; "What's wrapped" trace-walk corrected; cost.record added lifecycle.py:206-213 (trace-step routing), :256 (cost)
frameworks-ms_agent_framework.md agent.action row removed; termination bullet rewritten; agent.state.change + cost.record added lifecycle.py:335,272
frameworks-openai_agents.md agent.action row removed; response_span mapped to model.invoke; agent.state.change + cost.record added lifecycle.py:293,446,193,211,295
frameworks-pydantic_ai.md agent.action removed; policy.violation removed (no source emission — validation errors surface on agent.output); cost.record/agent.state.change/agent.handoff added lifecycle.py:203,283,353 (no policy.violation literal)
frameworks-semantic_kernel.md agent.action removed; agent.state.change removed (memory ops emit tool.call at :390); cost.record added lifecycle.py:390,310 (no agent.state.change literal)
frameworks-strands.md agent.action removed; agent.handoff removed (no literal); Loops/Multi-agent bullets rewritten; agent.state.change + cost.record added lifecycle.py:249,308,209 (no agent.handoff literal)
frameworks-llama_index.md 6 event-class rename/removals + cost.record add + retriever wording fix lifecycle.py:185,189,195-198,283,218,244-257

Overlap with PR #150 (skipped on purpose)

These were verified by reading gh pr diff 150 before starting; no changes to those two files in this PR.

Hard constraints (CLAUDE.md)

  • Source-traced claims only — every NEW claim cites a lifecycle.py:<line>.
  • No destructive git ops; no --no-verify, no escape-hatch flags.
  • Audit was re-verified against source for every finding; no audit-was-wrong cases found.

Test plan

  • Reviewer spot-checks 3 random lifecycle.py: citations from the per-doc table above against the source on feat/instrument-frameworks-agents.
  • grep -rn 'agent.action' docs/adapters/frameworks-*.md returns 0 results (confirmed locally before push).
  • No source code touched — doc-only PR, zero behavioural risk.

Audit report: A:/tmp/adapter-user-docs-audit.md (sections L79-170, lines covering agno through strands plus llama_index). Recommended PR scoping #2 on L243-251.

mmercuri added 2 commits May 10, 2026 15:38
…rks-*.md docs (per audit)

Fixes the systemic `agent.action` claim in 7 framework adapter user docs on
the `feat/instrument-frameworks-agents` branch. Grep across the entire
framework adapter source tree confirms zero `"agent.action"` literals are
emitted — the doc claims were copied across adapters without a source check.

Per `A:/tmp/adapter-user-docs-audit.md` (2026-05-10), each table is now
rewritten against what the lifecycle source actually emits, with source
file:line citations on every row. Also addresses the related per-doc
findings the audit listed alongside the agent.action row:

- agno: remove `agent.action`; rewrite "Reasoning agents" bullet to note
  reasoning is not specially instrumented (lifecycle.py: no match for
  reasoning-specific emit). Add `cost.record` row (lifecycle.py:228).
- bedrock_agents: remove `agent.action`; correct the "What's wrapped"
  trace-walk description; add `cost.record` (lifecycle.py:256).
- ms_agent_framework: remove `agent.action`; rewrite the termination
  bullet (no per-strategy emission in source); add `agent.state.change`
  (lifecycle.py:335) and `cost.record` (lifecycle.py:272).
- openai_agents: remove `agent.action`; map `response_span` to
  `model.invoke` (lifecycle.py:293,446); add `agent.state.change`
  (lifecycle.py:193,211) and `cost.record` (lifecycle.py:295).
- pydantic_ai: remove `agent.action`; remove `policy.violation` claim
  (no such literal in pydantic_ai source) — validation errors surface
  on agent.output instead; add `cost.record`, `agent.state.change`,
  `agent.handoff`.
- semantic_kernel: remove `agent.action`; remove `agent.state.change`
  (no literal in source — memory operations emit `tool.call` at
  lifecycle.py:390); add `cost.record` (lifecycle.py:310).
- strands: remove `agent.action`; remove `agent.handoff` (no literal
  in source); rewrite "Loops" and "Multi-agent" bullets; add
  `agent.state.change` (lifecycle.py:249,308) and `cost.record`
  (lifecycle.py:209).

All replacement claims trace to a specific lifecycle.py line; verified by
re-grepping after edit. Zero `agent.action` strings remain in any adapter
doc.
…d cost.record (per audit)

Per `A:/tmp/adapter-user-docs-audit.md` (2026-05-10) — heavy rewrite of the
llama_index doc's event-type taxonomy. The previous doc claimed event
classes the source never observes and omitted events the source actually
emits. Every replacement now cites a lifecycle.py line.

Fixes (lifecycle.py reference points are the routed handlers at L179-198
and the emit sites that follow):

1. `LLMCompletionStartEvent` does not exist in source — the start branch
   handles `LLMChatStartEvent` and `LLMStartEvent` (`lifecycle.py:185`).
   Replaced.

2. `AgentToolCallEvent` does not exist in source — the routing handles
   `ToolCallEvent` (`lifecycle.py:189`). Renamed in the wrapped-events
   list and the events-emitted table.

3. `AgentChatWithStepStartEvent` / `AgentChatWithStepEndEvent` are not
   observed — only `AgentRunStepStartEvent` / `AgentRunStepEndEvent`
   are routed (`lifecycle.py:195-198`). Removed from the bullet list
   and corrected in the events-emitted table.

4. `EmbeddingStartEvent` / `EmbeddingEndEvent` — no embedding-event
   routing in source. The "Embedding events" bullet has been removed
   from the wrapped-events list.

5. `agent.action` per `AgentRunStepEndEvent` was wrong — `_on_agent_step_end`
   emits `agent.output` (`lifecycle.py:283`). Row removed.

6. `cost.record` was missing from the events-emitted table — the source
   emits one per LLM end event when token counts are present
   (`lifecycle.py:218`). Added.

7. "retrieval events surfaced as tool.call with tool_name='retriever'"
   was a wording mismatch — the actual emit uses tool_name="retrieval"
   and tool_type="retrieval" (`lifecycle.py:246-257`). Corrected and
   `RetrievalEndEvent` / `QueryEndEvent` are now explicit on the
   tool.call row.

Also added an `agent.handoff` row noting the source exposes a lifecycle
hook (`lifecycle.py:400`) that is not auto-emitted from the dispatcher
stream — flagged for honesty so customers don't expect handoff events
without calling `on_handoff` themselves.

Heavy rewrites for `frameworks-benchmark_import.md` and
`frameworks-embedding.md` are NOT included in this commit — they are
already in PR #150 (`docs/fix-frameworks-user-doc-inaccuracies`) and
double-committing would conflict.
@mmercuri mmercuri requested a review from m-peko May 10, 2026 22:42
@m-peko m-peko closed this May 21, 2026
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.

2 participants