feat(eve): subagent sessions inherit the parent's remaining token quota#555
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Bundle + Package Summary:
|
| Area | Metric | Baseline | Current | Delta |
|---|---|---|---|---|
| Package | Packed tarball | 3.53 MB | 3.53 MB | +2.4 kB |
| Package | Unpacked publish size | 12.81 MB | 12.82 MB | +8.4 kB |
| Package | Installed footprint | 51.90 MB | 51.91 MB | +8.4 kB |
| Package | Published files | 2437 | 2441 | +4 |
| Package | Installed files | 5664 | 5668 | +4 |
| Runtime | Unique function payloads | 2 | 2 | 0 |
| Runtime | Total function bytes | 9.24 MB | 9.25 MB | +2.2 kB |
| Runtime | Public routes | 9 | 9 | 0 |
Changed function payloads vs main (5ef4ec6) (2)
| Function | Status | Baseline | Current | Delta | Route changes |
|---|---|---|---|---|---|
functions/.well-known/workflow/v1/flow.func |
changed | 5.76 MB | 5.77 MB | +2.5 kB |
none |
functions/__server.func |
changed | 3.48 MB | 3.48 MB | -244 B ✅ | none |
eve init install
| Metric | Baseline | Current | Delta |
|---|---|---|---|
| Installed footprint | 91.69 MB | 91.69 MB | +8.4 kB |
| Installed packages | 120 | 120 | 0 |
| dependencies | 4 | 4 | 0 |
| devDependencies | 2 | 2 | 0 |
| Dependency package bytes | 26.97 MB | 26.98 MB | +8.4 kB |
| devDependency package bytes | 4.81 MB | 4.81 MB | 0 B ➖ |
Build Metadata
- Preset:
vercel - Nitro:
nitro@3.0.260610-beta - Output directory:
apps/fixtures/weather-agent/.vercel/output - Build metadata timestamp: 2026-07-07T01:15:50.285Z
- Route aliases: 9 public, 1 internal (10 total aliases)
- Vercel routes in config: 10
- Severity legend: 🔴 dominant/large, 🟠 notable, 🟡 watch, ⚪ small
Package Drill-Down
Package Details
- Package:
eve@0.20.0 - Package directory:
packages/eve - Tarball: 3.53 MB (
eve-0.20.0.tgz) - Unpacked payload: 12.82 MB across 2441 published files
- Installed footprint: 51.91 MB across 5668 installed files
- Installed root package: 11.54 MB
- Installed dependencies: 40.36 MB
- Runtime dependencies: 1
- Peer dependencies: 5 (4 optional)
Installed footprint is measured from an isolated temporary npm install of the packed tarball.
Heavy installed dependencies
@rolldown/binding-linux-x64-gnu: 19.18 MB (36.9%)eve: 11.54 MB (22.2%)ai: 6.34 MB (12.2%)zod: 5.04 MB (9.7%)nitro: 2.41 MB (4.6%)
Publish payload breakdown
Published file size
🟠 dist/src/compiled/experimental-ai-sdk-code-mo... [####....................] 1.51 MB 11.7%
🟡 dist/src/compiled/@workflow/core/runtime.js [##......................] 794.4 kB 6.2%
🟡 dist/src/compiled/@vercel/sandbox/index.js [##......................] 632.2 kB 4.9%
🟡 dist/src/compiled/@chat-adapter/slack/index.js [#.......................] 433.8 kB 3.4%
🟡 dist/src/compiled/_chunks/workflow/attribute-... [#.......................] 371.6 kB 2.9%
🔴 Other published files [########################] 9.08 MB 70.8%
Installed footprint breakdown
Installed package size
🔴 @rolldown/binding-linux-x64-gnu [########################] 19.18 MB 36.9%
🔴 eve [##############..........] 11.54 MB 22.2%
🔴 ai [########................] 6.34 MB 12.2%
🔴 zod [######..................] 5.04 MB 9.7%
🟠 nitro [###.....................] 2.41 MB 4.6%
🟡 rolldown [#.......................] 771.7 kB 1.5%
🔴 Other installed packages [########................] 6.63 MB 12.8%
Runtime dependencies (1)
| Package | Range | Notes |
|---|---|---|
nitro |
3.0.260610-beta |
Peer dependencies (5)
| Package | Range | Notes |
|---|---|---|
@opentelemetry/api |
^1.0.0 |
optional peer |
ai |
catalog: |
|
braintrust |
^3.0.0 |
optional peer |
just-bash |
^3.0.0 |
optional peer |
microsandbox |
^0.5.0 |
optional peer |
eve init install drill-down
eve init install details
- Command:
eve init my-agent - Package manager:
npm - Installed footprint: 91.69 MB across 7420 installed files
- Installed packages: 120 total (114 transitive-only)
- dependencies: 4 direct packages totaling 26.98 MB
- devDependencies: 2 direct packages totaling 4.81 MB
- Other transitive package files: 59.90 MB
Installed footprint is measured from an isolated temporary eve init my-agent using the current packed eve tarball.
Heavy installed dependencies
@typescript/typescript-linux-x64: 29.69 MB (32.4%)@rolldown/binding-linux-x64-gnu: 19.18 MB (20.9%)eve: 11.54 MB (12.6%)zod: 9.00 MB (9.8%)ai: 6.34 MB (6.9%)
Installed footprint breakdown
Installed package size
🔴 @typescript/typescript-linux-x64 [########################] 29.69 MB 32.4%
🔴 @rolldown/binding-linux-x64-gnu [###############.........] 19.18 MB 20.9%
🔴 eve [#########...............] 11.54 MB 12.6%
🔴 zod [#######.................] 9.00 MB 9.8%
🔴 ai [#####...................] 6.34 MB 6.9%
🟠 @types/node [##......................] 2.54 MB 2.8%
🔴 Other installed packages [###########.............] 13.40 MB 14.6%
dependencies (4)
| Package | Range | Installed size | Share |
|---|---|---|---|
@vercel/connect |
0.2.2 |
98.6 kB | 0.1% |
ai |
^7.0.0 |
6.34 MB | 6.9% |
eve |
file:eve-0.20.0.tgz |
11.54 MB | 12.6% |
zod |
4.4.3 |
9.00 MB | 9.8% |
devDependencies (2)
| Package | Range | Installed size | Share |
|---|---|---|---|
@types/node |
24.x |
2.54 MB | 2.8% |
typescript |
7.0.1-rc |
2.27 MB | 2.5% |
Function Drill-Down
Payload Size Graph
Unique function payload size and share of total
🔴 functions/.well-known/workflow/v1/flow.func [########################] 5.77 MB 62.4%
🟠 functions/__server.func [##############..........] 3.48 MB 37.6%
Top Function Payloads
🟠 functions/.well-known/workflow/v1/flow.func • 1 public route • 5.77 MB
| Metric | Value |
|---|---|
| Public routes | /.well-known/workflow/v1/flow |
| Runtime | nodejs24.x |
| Handler | index.mjs |
| Payload | 5.77 MB |
| Function files | 5.77 MB across 26 files |
| Traced dependencies | 0 B |
| Signal | 🟠 Bundled file __eve_nitro_handler__.mjs is 1.99 MB (34.6%) |
🟠 🔎 Dependency Analysis
📦 Bundled files:
Bundled file size
🟠 __eve_nitro_handler__.mjs [########################] 1.99 MB 34.6%
🟠 _chunks/runtime.mjs [############............] 983.9 kB 17.1%
🟡 _chunks/sandbox.mjs [#########...............] 766.3 kB 13.3%
🟡 _chunks/attribute-changes-zAifvEhb.mjs [######..................] 473.4 kB 8.2%
🟡 _libs/@ai-sdk/gateway+[...].mjs [#####...................] 413.5 kB 7.2%
🟠 Other bundled files [##############..........] 1.14 MB 19.7%
🧾 Vercel Config
{
"handler": "index.mjs",
"launcherType": "Nodejs",
"shouldAddHelpers": false,
"supportsResponseStreaming": true,
"runtime": "nodejs24.x",
"environment": {
"NODE_OPTIONS": "--experimental-require-module"
},
"maxDuration": "max",
"experimentalTriggers": [
{
"type": "queue/v2beta",
"topic": "__eve776561746865722d6167656e74_wkf_workflow_*",
"consumer": "default",
"retryAfterSeconds": 5,
"initialDelaySeconds": 0
}
]
}🟠 functions/__server.func • 8 public routes, 1 internal alias • 3.48 MB
| Metric | Value |
|---|---|
| Public routes | //eve/v1/callback/[token]/eve/v1/connections/[name]/callback/[token]/eve/v1/health/eve/v1/info/eve/v1/session/eve/v1/session/[sessionId]/eve/v1/session/[sessionId]/stream |
| Internal aliases | /__server |
| Runtime | nodejs24.x |
| Handler | index.mjs |
| Payload | 3.48 MB |
| Function files | 3.48 MB across 21 files |
| Traced dependencies | 0 B |
| Signal | 🟠 Bundled file _chunks/dev-runtime-artifacts.mjs is 914.5 kB (26.3%) |
🟠 🔎 Dependency Analysis
📦 Bundled files:
Bundled file size
🟠 _chunks/dev-runtime-artifacts.mjs [########################] 914.5 kB 26.3%
🟠 _chunks/runtime.mjs [#######################.] 891.6 kB 25.6%
🟠 _chunks/sandbox.mjs [####################....] 766.3 kB 22.0%
🟡 _chunks/attribute-changes-zAifvEhb.mjs [############............] 449.0 kB 12.9%
⚪ _libs/zod.mjs [###.....................] 114.2 kB 3.3%
🟡 Other bundled files [#########...............] 343.4 kB 9.9%
🧾 Vercel Config
{
"handler": "index.mjs",
"launcherType": "Nodejs",
"shouldAddHelpers": false,
"supportsResponseStreaming": true,
"runtime": "nodejs24.x"
}28ddd01 to
ce56416
Compare
Delegated subagent sessions previously received a fixed 5M input-token cap regardless of what the delegating parent had left to spend, and a child's spend never counted against the parent's quota — a parent could fan out children whose combined spend was unbounded by the root's configured limit. Three changes make the session quota coherent across a delegation tree: - Dispatch computes the parent's remaining quota (limit minus accumulated usage) and grants it to the child as its budget (RunInput.subagentTokenBudget -> eve.subagentTokenBudget -> child session creation). An authored child limit applies only when tighter; a child cannot self-exempt from the parent's grant. The fixed 5M default is removed: uncapped parents delegate uncapped children. - Completed child usage (surfaced by #488) folds into the parent's session totals on resume, so limits and later grants account for what the tree already spent. Turn totals stay untouched — child spend is attributed by the caller-side invoke_agent span, not the turn tags. - Session token limits accept false to uncap an axis explicitly, and durable sessions rehydrate persisted limits verbatim so an uncapped session stays uncapped instead of re-acquiring the root default. Known slack: parallel children each receive the remaining quota at their own dispatch (overshoot bounded by fan-out), and failed child runs carry no usage (pre-existing in the result contract). Signed-off-by: Rui Conti <ruiconti@gmail.com>
ce56416 to
73bb09b
Compare
The parent's remaining quota previously traveled as a bespoke context key (eve.subagentTokenBudget) serialized into the child's run context and defensively re-parsed at session creation. Carry it instead as a typed RunInput.limits field forwarded explicitly through the workflow entry payload, reusing the limit field names authors already configure (maxInputTokensPerSession / maxOutputTokensPerSession) with false marking an uncapped axis. The serialization round-trip, its validation helpers, and the SubagentTokenBudget type all go away. Capping now happens in createSessionStep where the inherited limits meet the resolved agent config; createSession no longer knows about delegation. Subagent dispatch starts child runs via a new startWorkflowRuntimeRun instead of constructing a throwaway Runtime per action, since the run input (not runtime config) now carries the per-child limits. Behavior is unchanged: tighter of configured vs inherited wins, an authored false cannot self-exempt from an inherited cap, and uncapped parents still delegate uncapped children. Signed-off-by: Rui Conti <ruiconti@gmail.com>
RunSessionLimits grows maxSubagentDepth and maxSubagents, replacing the standalone RunInput.subagentMaxDepth field so every inherited cap rides the same typed limits channel as the token quota. A new WorkflowMaxSubagentsKey carries the parent's effective Workflow fan-out cap into delegated children: both dispatch paths and turnStep resolve the child's configured limits.maxSubagents against the inherited value, tighter wins, so a delegated child cannot run wider Workflow fan-outs than the tree that spawned it allows. The resolution helpers move to execution/run-session-limits.ts: resolveInheritedTokenLimit (from create-session-step; false only uncaps before inheritance, an inherited cap still binds) and the new resolveInheritedCountLimit. Signed-off-by: Rui Conti <ruiconti@gmail.com>
Inherited limits now have one transport (the typed workflow-entry payload) and one resolution point (createSessionStep), with effective values materialized on the session: - workflowMaxSubagents joins subagentMaxDepth as session state, resolved at creation and read from the session by turnStep and both dispatch steps. The WorkflowMaxSubagentsKey context channel and the per-step re-resolution against config go away, as does node-step's hidden config fallback. - The SubagentMaxDepthKey context channel was a zombie after the payload migration: written into the child context and parsed on entry, but the parsed value was discarded. Key, write, and parse deleted; readSerializedSubagentSessionDepth narrows to readSerializedSubagentDepth. - Behavior change: maxSubagentDepth now resolves min(configured, inherited) like every other axis, instead of inherited-wins, so a child agent can tighten its subtree's delegation depth. Each resolution site documents its axis semantics. - workflow-runtime.ts returns to main's shape; the startWorkflowRuntimeRun extraction had one caller left after dispatch went back to createWorkflowRuntime. Its only remaining delta vs main is forwarding RunInput.limits into the entry payload. Signed-off-by: Rui Conti <ruiconti@gmail.com>
AndrewBarba
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delegated subagent sessions got a fixed 5M input-token cap no matter what the delegating parent had left to spend, and a completed child's spend never counted against the parent's quota. Both halves were wrong in opposite directions: a parent near its limit could grant a child 5M it didn't have, and a parent nowhere near its limit could fan out children whose combined spend was unbounded by the root's configured budget. #488 surfaced child usage to callers; this PR closes the loop and makes the session quota coherent across a delegation tree.
What
floor(remaining / delegationFanOut), where the fan-out counts the batch's local subagent calls. One batch is collectively bounded by the parent's remainder — N parallel children cannot each spend the full amount. The grant travelsRunInput.subagentTokenBudget->eve.subagentTokenBudgetserialized context key -> child session creation, mirroring the existingsubagentDepthplumbing. The fixed 5M default is gone.resolvePendingRuntimeActions), so the parent's limit check and the shares granted to later batches account for what the tree already spent. Turn totals stay untouched: child spend is attributed by the caller-sideinvoke_agentspan from feat(eve): surface subagent usage to callers #488, so turn tags don't double-count.maxInputTokensPerSession/maxOutputTokensPerSessionacceptfalseto uncap an axis explicitly. An uncapped parent delegates uncapped children regardless of fan-out; an authored child limit applies only when tighter than the parent's grant, and a child authoringfalsestill gets the grant. A child can restrict itself, never exempt itself.Why this shape
The alternative was keeping a smaller fixed subagent default. Any fixed number is wrong twice: too generous when the parent is nearly spent, too stingy for a deep task under a large budget. The parent's remainder split across the batch is the only grant with grounding at dispatch time, and #488 made it computable. This also moves toward #551 (uncapped sessions as the default) without touching the root 40M default — that removal stays with the research plan.
Remote-agent calls do not count toward the fan-out: they run on their own deployment under their own limits, so they never dilute the local shares.
Known slack
usage(pre-existing in the result contract, seedelegated-parent-notification.ts), so an errored child's spend doesn't draw down the parent.Review notes
Rebased over #528 (
maxSubagents) with one trivial conflict in the manifest limits schema.session.test.tshydration expectations changed with the verbatim-rehydration semantics: no stored limits now means uncapped, not re-defaulted.