Skip to content

Simplify Agents SDK trace spans - #1999

Open
Ankcorn wants to merge 1 commit into
cloudflare:mainfrom
Ankcorn:tankcorn/group-agent-spans-v2
Open

Simplify Agents SDK trace spans#1999
Ankcorn wants to merge 1 commit into
cloudflare:mainfrom
Ankcorn:tankcorn/group-agent-spans-v2

Conversation

@Ankcorn

@Ankcorn Ankcorn commented Jul 29, 2026

Copy link
Copy Markdown
Member

Agents SDK traces currently emit many near-zero-duration implementation spans. That adds ingestion cost and hides the chat turn and model invocation users actually need.

Collapse startup, chat setup, and fiber lifecycle bookkeeping into the existing semantic hierarchy while keeping chat_turn, agent invocation, model calls, and result persistence visible.

Before

hibernatableWebSocket (50.18s)
├── agent_initialization (0ms)
├── durable_object_storage_get (0ms)
├── think_start (0ms)
└── chat_interaction (9.64s)
    ├── clear_previous_chat_state (0ms)
    ├── persist_chat_request_context (0ms)
    ├── load_chat_history (0ms)
    ├── persist_incoming_messages (0ms)
    ├── schedule_agent_alarm (0ms)
    ├── chat_turn (9.64s)
    │   ├── initialize_fiber (0ms)
    │   ├── persist_fiber_snapshot (0ms)
    │   ├── prepare_agent (0ms)
    │   ├── invoke_agent TestbedAgent (9.64s)
    │   │   └── chat @cf/moonshotai/kimi-k2.6 (9.64s)
    │   ├── persist_chat_result (9.64s)
    │   └── finalize_fiber (0ms)
    └── schedule_agent_alarm (0ms)

After

hibernatableWebSocket (50.18s)
├── agent_initialization (0ms)
└── chat_interaction (9.64s)
    ├── chat_interaction_setup (0ms)
    └── chat_turn (9.64s)
        ├── initialize_fiber (0ms)
        ├── invoke_agent TestbedAgent (9.64s)
        │   └── chat @cf/moonshotai/kimi-k2.6 (9.64s)
        └── persist_chat_result (9.64s)

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0a4c57e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
agents Patch
@cloudflare/ai-chat Patch
@cloudflare/think Patch
@cloudflare/agent-think Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1999

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1999

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1999

create-think

npm i https://pkg.pr.new/create-think@1999

hono-agents

npm i https://pkg.pr.new/hono-agents@1999

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1999

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1999

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1999

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1999

commit: 0a4c57e

@Ankcorn
Ankcorn marked this pull request as ready for review July 29, 2026 22:04

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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