Skip to content

feat: surface assembled prompt byte metrics during spawn (#2822)#2839

Open
ApexYash11 wants to merge 1 commit into
AgentWrapper:mainfrom
ApexYash11:feat/prompt-bytes-metrics
Open

feat: surface assembled prompt byte metrics during spawn (#2822)#2839
ApexYash11 wants to merge 1 commit into
AgentWrapper:mainfrom
ApexYash11:feat/prompt-bytes-metrics

Conversation

@ApexYash11

Copy link
Copy Markdown

Fixes

Closes #2822

Summary

This PR addresses Issue #2822 by surfacing informational prompt size metrics during session spawn.

After the final prompt and system prompt are assembled, AO now measures their byte lengths using len() and exposes them through the spawn response and CLI output. This gives users visibility into the size of the prompt AO assembles without introducing any provider- or model-specific assumptions.

Changes

  • Measure assembled prompt and system prompt byte sizes in Manager.Spawn()
  • Thread the values through the spawn flow using Go multi-return values
  • Expose promptBytes and systemPromptBytes in the spawn response
  • Display prompt metrics in ao spawn output when non-zero
  • Regenerate the OpenAPI specification and frontend API schema

Design

This implementation is intentionally informational only.

It does not:

  • estimate tokens
  • enforce prompt limits
  • introduce provider-specific logic
  • modify prompt assembly
  • modify prompt delivery
  • introduce new abstractions or agent interfaces

The metrics are computed during spawn and are not persisted.

Testing

Verified with:

  • gofmt
  • go vet ./...
  • go build ./...
  • Relevant unit tests
  • Integration tests
  • OpenAPI/spec generation
  • Frontend schema generation

@somewherelostt

Copy link
Copy Markdown
Collaborator

Thanks for contributing to Agent Orchestrator.

This PR is being picked up by the current external contributor on-call pair:

If someone is already working on this, please continue as usual.
The on-call pair is added for visibility, tracking, and support, not to take over the work.
If you need help with review, direction, reproduction, or next steps, please tag @neversettle17-101 and @somewherelostt here.

For faster context or live questions, you can also join the AO Discord.

Join the session here:
https://discord.gg/H6ZDcUXmq

Come by if you want to see what is being built, ask questions, or just hang around with the community.

@ApexYash11
ApexYash11 force-pushed the feat/prompt-bytes-metrics branch from b7dfdb8 to 40cca6c Compare July 21, 2026 17:43
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.

Worker spawn silently compresses/truncates a too-long task prompt instead of failing fast — pre-flight size check?

5 participants