Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

feat(selfmod): inherit the parent agent model by default (#2307)

prha5cb418995c74
diff --git a/packages/eve/src/self-modification/agent.ts b/packages/eve/src/self-modification/agent.ts
index 4c12fd44e..7daff3801 100644
--- a/packages/eve/src/self-modification/agent.ts
+++ b/packages/eve/src/self-modification/agent.ts
@@ -4,24 +4,24 @@ import {
defineDynamic,
type AgentReasoningDefinition,
type AgentStaticModelDefinition,
+ type DynamicSentinel,
+ type DynamicSubagentDefinition,
} from "#public/index.js";
+import { DEFAULT_AGENT_MODEL_ID } from "#shared/default-agent-model.js";
+
import { resolveSelfModificationConfig, type SelfModificationConfig } from "./config.js";
import { hasGitHubCredential } from "./credentials.js";
import { resolveSelfModificationMode } from "./mode.js";
-/** Default model used by the self-modification subagent. */
-export const DEFAULT_SELF_MODIFICATION_MODEL = "anthropic/claude-sonnet-5";
+/** Fallback model when neither the self-modification agent nor its parent configures one. */
+export const FALLBACK_SELF_MODIFICATION_MODEL = DEFAULT_AGENT_MODEL_ID;
/** Configuration for the self-modification subagent. */
export interface SelfModificationAgentOptions {
/** Policy shared with the sandbox and extension mount. */
readonly config?: SelfModificationConfig;
- /**
- * Model used by the self-modification subagent.
- *
- * @default "anthropic/claude-sonnet-5"
- */
+ /** Model used by the self-modification subagent; defaults to the effective parent model. */
readonly model?: AgentStaticModelDefinition;
/**
* Reasoning effort used by the self-modification subagent.
@@ -69,13 +69,15 @@ const deployedEffectiveEdits =
"Source edits do not affect the caller’s current turn. The subagent can publish only a draft pull request, and changes become effective only after review, merge, and redeployment.";
/** Defines the environment-aware self-modification dynamic subagent. */
-export function defineSelfModificationAgent(options: SelfModificationAgentOptions = {}) {
- const model = options.model ?? DEFAULT_SELF_MODIFICATION_MODEL;
+export function defineSelfModificationAgent(
+ options: SelfModificationAgentOptions = {},
+): DynamicSentinel<DynamicSubagentDefinition | null> {
const reasoning = options.reasoning;
const config = resolveSelfModificationConfig(options.config);
const resolve = async (_event: unknown, ctx: DynamicResolveContext) => {
const mode = resolveSelfModificationMode(config);
+ const model = options.model ?? ctx.model?.id ?? FALLBACK_SELF_MODIFICATION_MODEL;
const description = renderDescription([
"Delegate here when the user asks to change this eve agent or its authored source.",
sourceDelegation,