The Open Framework for Building Agents
Lower the default subagent delegation depth to 1 (#674)
vercel-gh-bot-3[bot]a325195a6273
diff --git a/.changeset/lower-subagent-depth-default.md b/.changeset/lower-subagent-depth-default.mdnew file mode 100644index 000000000..3c774ff21--- /dev/null+++ b/.changeset/lower-subagent-depth-default.md@@ -0,0 +1,5 @@+---+"eve": patch+---++`limits.maxSubagentDepth` now defaults to `1` instead of `3`. Agents that rely on deeper default delegation should set `limits: { maxSubagentDepth: 3 }` (or another value) explicitly.diff --git a/docs/agent-config.md b/docs/agent-config.mdindex eddccabdb..098e63393 100644--- a/docs/agent-config.md+++ b/docs/agent-config.md@@ -207,7 +207,7 @@ installed package must stay external in hosted output, list it in| -------------- | --------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || `reasoning` | `AgentReasoningDefinition` | provider default | Provider-agnostic reasoning effort forwarded to the agent's turn model calls. || `modelOptions` | `AgentModelOptionsDefinition` | none | Provider option overrides forwarded to the model call. |-| `limits` | `AgentLimitsDefinition` | field-specific | Framework-owned runtime limits. `maxSubagentDepth` defaults to `3`; `maxInputTokensPerSession` defaults to `40_000_000` for root sessions, and delegated subagent sessions inherit the parent's remaining quota; `maxOutputTokensPerSession` is unset unless configured; `false` uncaps a session token limit. |+| `limits` | `AgentLimitsDefinition` | field-specific | Framework-owned runtime limits. `maxSubagentDepth` defaults to `1`; `maxInputTokensPerSession` defaults to `40_000_000` for root sessions, and delegated subagent sessions inherit the parent's remaining quota; `maxOutputTokensPerSession` is unset unless configured; `false` uncaps a session token limit. || `experimental` | `{ workflow?: { world?: string } }` | unset | Opt-in settings that can change or disappear in any release. Treat them as unstable. `workflow.world` selects the Workflow world package backing session state, queues, hooks, and streams on the root agent. || `outputSchema` | Standard Schema or a JSON Schema object | none | Structured return type for task-mode runs (a subagent, schedule, or remote job). Interactive conversation turns ignore it unless the client supplies a per-message schema. || `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |diff --git a/docs/subagents.mdx b/docs/subagents.mdxindex 0ed43579e..99a500b6f 100644--- a/docs/subagents.mdx+++ b/docs/subagents.mdx@@ -77,7 +77,7 @@ The built-in `agent` tool is the exception. Its children share the parent's sandeve lowers every subagent (built-in copy, declared, or [remote](./guides/remote-agents)) into a model-visible tool with the same `{ message, outputSchema? }` shape. The parent packs `message` with everything the child needs, since the child never sees the parent's history. Set `outputSchema` to run the child in task mode, returning structured output as the tool result.-Subagent delegation is capped by default at three child-session levels. Increase+Subagent delegation is capped by default at one child-session level. Increaseor lower that limit with `limits.maxSubagentDepth`:```ts title="agent/agent.ts"diff --git a/packages/eve/src/harness/advertised-tools.test.ts b/packages/eve/src/harness/advertised-tools.test.tsindex df1851fe6..28ce259ce 100644--- a/packages/eve/src/harness/advertised-tools.test.ts+++ b/packages/eve/src/harness/advertised-tools.test.ts@@ -78,7 +78,7 @@ describe("getAdvertisedTools", () => {]) satisfies HarnessToolMap;const advertisedTools = getAdvertisedTools({- session: { rootSessionId: "root-session", subagentDepth: 1 },+ session: { rootSessionId: "root-session", subagentDepth: 1, subagentMaxDepth: 2 },tools,});diff --git a/packages/eve/src/harness/subagent-depth.ts b/packages/eve/src/harness/subagent-depth.tsindex c5d556e57..c4e5cb341 100644--- a/packages/eve/src/harness/subagent-depth.ts+++ b/packages/eve/src/harness/subagent-depth.ts@@ -6,7 +6,7 @@ import type {RuntimeSubagentCallActionRequest,} from "#runtime/actions/types.js";-export const DEFAULT_SUBAGENT_MAX_DEPTH = 3;+export const DEFAULT_SUBAGENT_MAX_DEPTH = 1;export type DelegatedRuntimeActionRequest =| RuntimeRemoteAgentCallActionRequestdiff --git a/packages/eve/src/harness/tool-loop.test.ts b/packages/eve/src/harness/tool-loop.test.tsindex 1922a1ea7..8693c547d 100644--- a/packages/eve/src/harness/tool-loop.test.ts+++ b/packages/eve/src/harness/tool-loop.test.ts@@ -983,6 +983,7 @@ describe("createToolLoopHarness", () => {createTestSession({rootSessionId: "root-session",subagentDepth: 1,+ subagentMaxDepth: 2,}),{ message: "Hi" },);diff --git a/packages/eve/src/shared/agent-definition.ts b/packages/eve/src/shared/agent-definition.tsindex 1b6d2ded7..a4ecddb55 100644--- a/packages/eve/src/shared/agent-definition.ts+++ b/packages/eve/src/shared/agent-definition.ts@@ -158,7 +158,7 @@ export interface AgentLimitsDefinition {* Delegated subagent sessions resolve this against the cap inherited from* the delegating parent; the tighter value wins.*- * @default 3+ * @default 1*/readonly maxSubagentDepth?: number;/**