Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(selfmod): configure subagent reasoning (#3342)

prha7ad2740335f7
diff --git a/.changeset/self-modification-reasoning.md b/.changeset/self-modification-reasoning.md
new file mode 100644
index 000000000..8408dad95
--- /dev/null
+++ b/.changeset/self-modification-reasoning.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Allow the self-modification agent arguments to set the reasoning effort used by its subagent.
diff --git a/packages/eve/src/self-modification/agent.test.ts b/packages/eve/src/self-modification/agent.test.ts
new file mode 100644
index 000000000..357967292
--- /dev/null
+++ b/packages/eve/src/self-modification/agent.test.ts
@@ -0,0 +1,28 @@
+import type { DynamicResolveContext } from "#dynamic/definition.js";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { defineSelfModificationAgent } from "./agent.js";
+
+afterEach(() => {
+ delete process.env.EVE_DEV;
+});
+
+describe("self-modification agent", () => {
+ it("forwards the configured reasoning effort to the subagent", async () => {
+ process.env.EVE_DEV = "1";
+ const agent = defineSelfModificationAgent({ reasoning: "high" });
+ const context: DynamicResolveContext = {
+ channel: {},
+ messages: [],
+ model: null,
+ session: {
+ auth: { current: null, initiator: null },
+ id: "session",
+ },
+ };
+
+ const resolved = await agent.events["session.started"]?.({}, context);
+
+ expect(resolved).toMatchObject({ reasoning: "high" });
+ });
+});
diff --git a/packages/eve/src/self-modification/agent.ts b/packages/eve/src/self-modification/agent.ts
index 0c6f34f38..1c9413e52 100644
--- a/packages/eve/src/self-modification/agent.ts
+++ b/packages/eve/src/self-modification/agent.ts
@@ -1,5 +1,10 @@
import type { DynamicResolveContext } from "#dynamic/definition.js";
-import { defineAgent, defineDynamic, type AgentStaticModelDefinition } from "#public/index.js";
+import {
+ defineAgent,
+ defineDynamic,
+ type AgentReasoningDefinition,
+ type AgentStaticModelDefinition,
+} from "#public/index.js";
import { resolveSelfModificationConfig, type SelfModificationConfig } from "./config.js";
import { hasGitHubCredential } from "./credentials.js";
@@ -18,6 +23,10 @@ export interface SelfModificationAgentOptions {
* @default "anthropic/claude-sonnet-5"
*/
readonly model?: AgentStaticModelDefinition;
+ /**
+ * Reasoning effort used by the self-modification subagent.
+ */
+ readonly reasoning?: AgentReasoningDefinition;
}
function renderDescription(sections: readonly string[]): string {
@@ -58,6 +67,7 @@ const deployedEffectiveEdits =
/** Defines the environment-aware self-modification dynamic subagent. */
export function defineSelfModificationAgent(options: SelfModificationAgentOptions = {}) {
const model = options.model ?? DEFAULT_SELF_MODIFICATION_MODEL;
+ const reasoning = options.reasoning;
const config = resolveSelfModificationConfig(options.config);
const resolve = async (_event: unknown, ctx: DynamicResolveContext) => {
@@ -72,7 +82,7 @@ export function defineSelfModificationAgent(options: SelfModificationAgentOption
followUpDelegation,
mode === "local" ? localEffectiveEdits : deployedEffectiveEdits,
]);
- if (mode === "local") return defineAgent({ description, model });
+ if (mode === "local") return defineAgent({ description, model, reasoning });
if (mode !== "deployed" || config.deployed === undefined) return null;
if (config.deployed.credentials.kind === "pat" && !hasGitHubCredential()) return null;
try {
@@ -87,7 +97,7 @@ export function defineSelfModificationAgent(options: SelfModificationAgentOption
} catch {
return null;
}
- return defineAgent({ description, model });
+ return defineAgent({ description, model, reasoning });
};
return defineDynamic({