Skip to content

[docs] Plan progressive tool disclosure for the playground build kit - #5405

Open
ashrafchowdury wants to merge 5 commits into
mainfrom
doc/planing-to-improve-the-internal-tool-manage
Open

[docs] Plan progressive tool disclosure for the playground build kit#5405
ashrafchowdury wants to merge 5 commits into
mainfrom
doc/planing-to-improve-the-internal-tool-manage

Conversation

@ashrafchowdury

@ashrafchowdury ashrafchowdury commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Context

Open a playground agent that shows "Tools: None", type "hi", and the turn carries 18,353 prompt tokens of platform-op schema before the model has done anything. The cost is the build kit. It injects 13 platform ops into the agent template and advertises every one of them on every turn.

Measuring it changed the shape of the problem. The cost is not spread across the catalog, it is concentrated in two schemas. test_run (7,777) and commit_revision (6,878) each embed the same 6,441-token agent-template object, so 70% of the bill is one object counted twice. Add query_spans and three ops account for 88% of the total. The remaining ten ops cost 2,120 tokens combined.

The same always-on tools also hurt reliability. The internal-tools review found that extra visible tools become "wander targets" that derail runs.

What this adds

A planning workspace. No code, no runtime change. It records the measurement, the current wiring with file:line references, the design, a phased plan, and every alternative that was weighed and closed.

The plan: two levers

Token cost and tool count are different problems that need different fixes. Shrinking a schema does nothing for wander. Removing a tool does little for tokens once the schemas are small. Conflating them is what sent the first draft of this plan at the expensive, risky lever first.

Phase Lever From To Effort
1-2 schema diet 18,353 ~3,000 one Python file
3 lazy schema ~3,000 ~500 one runner function

Schema diet. Stop expanding the agent-template object inline into commit_revision and test_run. Emit the top-level keys with one-line descriptions and point at references/config-schema.md, a prose reference that already ships as a skill file and that the skill already tells the model to read before its first commit. That reference also states the commit endpoint does not validate the config shape, so the embedded JSON Schema enforces nothing.

Lazy schema. Ops stay advertised under their real names with a one-liner and a stub schema. A load_op tool returns the full schema when the model asks for it. This lands at one site, advertisedToolSpecs in services/runner/src/tools/public-spec.ts, which all three harnesses read through.

Nothing is proxied and no tool is renamed, so no permission code changes.

What changed since the first version of this PR

The original proposal was a card/menu invoker: one agenta_op(op, args) tool routing all 13 ops. It is now rejected, and the analysis is kept in alternatives.md so it is not re-proposed.

Routing every op through one name breaks the permission ladder. readOnlyHint comes from spec.readOnly and drives the allow_reads default, so one invoker spec would cover thirteen ops and no static value is correct. Set it true and every write executes silently. Set it false and every read prompts. Separately, ruleMatches compares the tool name exactly, so a policy rule written as remove_schedule: deny stops matching once calls arrive as agenta_op. It does not error, it falls through to the default. Repairing this means re-resolving the target spec in four fail-closed sites, where a missed site fails open.

Lazy schema gets the same token win without any of that, because the model still calls commit_revision by its own name.

Two corrections also landed:

  • The handler flag AGENTA_AGENT_ENABLE_PLATFORM_HANDLERS defaults on, not off. Earlier drafts carried an alternate 10,576-token figure that does not exist. All 13 ops advertise, so 18,353 is the live number.
  • Shrinking an advertised schema does not lose required-argument checking. The runner re-validates against the private spec in relay.ts before executing. Only the location of the error moves, from the harness to the relay.

For reviewers

The point of a plan-only PR is to settle these before anyone writes code:

  1. Ship the diet alone first? It is 84% of the win in one Python file, with no runner change. (rec: yes)
  2. Is lazy schema worth one extra round-trip per op for the remaining 13%? It is also the structural fix, so catalog growth stops inflating the prompt. (rec: yes)
  3. Lazy activation, the lever that would actually cut tool count, is out of scope. It buys roughly 100 tokens over lazy schema, its wander case is unmeasured, and it is the only lever needing per-harness transport work. Agreed to leave it out? (rec: yes, revisit with wander data)
  4. What token and pass-rate target flips the flag to default-on? (needs a team number)

Notes

Docs only, nothing to run. The 18,353 figure is reproducible with the script in baseline.md (tiktoken o200k_base, live catalog on main). Every file:line in research.md was re-checked against main on 2026-07-26.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 20, 2026
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jul 27, 2026 7:29am

Request Review

@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Jul 20, 2026
@ashrafchowdury
ashrafchowdury requested a review from mmabrouk July 20, 2026 11:56
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0201130f-da5c-496f-8412-ae4895863320

📥 Commits

Reviewing files that changed from the base of the PR and between c35d470 and 0aadf39.

📒 Files selected for processing (7)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/alternatives.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/baseline.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md
🚧 Files skipped from review as they are similar to previous changes (7)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/baseline.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/alternatives.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added comprehensive design and research documentation for progressive tool disclosure.
    • Documented measured baseline prompt costs and identified the highest-impact contributors.
    • Defined a phased plan to reduce tool-schema overhead through schema simplification followed by on-demand schema loading.
    • Clarified safety, validation, permission, discovery, measurement, and scope considerations.
    • Compared alternative approaches and documented rejected strategies and open questions.

Walkthrough

Adds planning documentation for progressive tool disclosure in the playground. It records an 18,353-token baseline and defines phased schema dieting followed by lazy schema loading, while excluding lazy activation and rejecting a card/menu invoker alternative.

Changes

Progressive tool disclosure

Layer / File(s) Summary
Baseline and scope
docs/design/.../README.md, baseline.md, context.md, plan.md, research.md
Establishes token measurements, terminology, success criteria, harness boundaries, and phased planning constraints.
Advertisement architecture
docs/design/.../research.md, design.md
Documents private tool specs, advertised projections, harness consumers, execution paths, and validation seams.
Schema diet and lazy schema rollout
docs/design/.../design.md, plan.md
Defines shallow schema expansion, query-schema trimming, on-demand load_op schemas, invariants, and measurement phases.
Alternatives and closed decisions
docs/design/.../alternatives.md, README.md
Records lazy activation boundaries, card/menu invoker rejection, locked decisions, corrections, open questions, and related documentation.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the documentation-only plan to progressively disclose tools in the playground build kit.
Description check ✅ Passed The description matches the PR scope, detailing the token-cost analysis, phased plan, and rejected alternatives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch doc/planing-to-improve-the-internal-tool-manage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cd91cd3-59eb-49de-9205-786764ff4f1d

📥 Commits

Reviewing files that changed from the base of the PR and between 3588f13 and 0db3f6d.

📒 Files selected for processing (6)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/status.md

Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md Outdated
- Revised the implementation plan for the progressive tool disclosure project, emphasizing the schema diet as the primary focus and deferring the meta-toolset.
- Updated the measured token costs in baseline.md, reflecting a re-baseline on 2026-07-26, with detailed per-op costs and implications for slicing.
- Added security.md to outline the risks associated with collapsing multiple ops into a single tool name, detailing permission decision impacts and required test coverage.
- Enhanced research.md with insights on token costs and the necessity for a re-measurement of the live advertised set.
- Created baseline.md to document the measured advertised token costs and the rationale behind the schema diet's low-risk profile.
- Updated status.md to reflect the latest changes and decisions made on 2026-07-26, including corrections to earlier drafts and open questions for future consideration.
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jul 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 31a3541b-18c7-40e5-ae51-d2d04e9f987b

📥 Commits

Reviewing files that changed from the base of the PR and between 0db3f6d and 4373db7.

📒 Files selected for processing (8)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/baseline.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/security.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/status.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md

Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/baseline.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/security.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/security.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/security.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/status.md Outdated
… token costs, correct handler mode defaults, and refine slice implementation details.
- Revised the implementation plan for the progressive tool disclosure project, focusing on a diet-first strategy to reduce token costs significantly.
- Updated the research documentation to clarify argument validation processes and the implications of schema changes on permission handling.
- Removed the security.md and status.md files, consolidating security considerations into the main plan and ensuring clarity on the risks associated with the meta-toolset.
- Enhanced the description of seams and their interactions with the schema diet and lazy schema implementations.
- Documented the decision-making process for proceeding with the meta-toolset based on evidence from the diet phase.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cdffb36-3eb0-46d7-9d24-6b37c5b16e44

📥 Commits

Reviewing files that changed from the base of the PR and between 4373db7 and c35d470.

📒 Files selected for processing (7)
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/README.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/alternatives.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/baseline.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/context.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/plan.md
  • docs/design/agent-workflows/projects/progressive-tool-disclosure/research.md

Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/alternatives.md Outdated
Comment thread docs/design/agent-workflows/projects/progressive-tool-disclosure/design.md Outdated
@ashrafchowdury

Copy link
Copy Markdown
Contributor Author

@mmabrouk I have iterated on this plan and made it simple and easy to implement

  1. Phase is diet - trimming down the extra fat content from the tools
  2. Phase 2 is lazy schema — tools keep their real names and stay visible, but their schema is fetched with load_op only when the model needs it.

… argument handling, schema constraints, and token cost implications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant