diff --git a/navi/tools/spawn_agent.py b/navi/tools/spawn_agent.py index 14e2828..6e00f07 100644 --- a/navi/tools/spawn_agent.py +++ b/navi/tools/spawn_agent.py @@ -25,12 +25,15 @@ "SYNCHRONOUS — blocks until the sub-agent fully completes. " "There is no background process and no continuation.\n\n" "USER CANNOT SEE sub-agent output — synthesise findings into your own response.\n\n" - "USE when a step requires 3+ tool calls to complete as a single logical unit.\n" + "USE when a step requires 3+ tool calls to complete as a single logical unit. " "DO NOT USE for a single tool call — call the tool directly.\n\n" - "PROFILE SELECTION: omit profile_id to use the parent session's current profile. " - "Set profile_id only when the sub-task clearly belongs to another profile. " - "The sub-agent uses that selected profile's subagent_tools, falling back to " - "enabled_tools when subagent_tools is empty.\n\n" + "PROFILE SELECTION: if your plan says to use a specific profile (e.g. 'server_admin' for remote ops, " + "'developer' for coding, 'secretary' for research), you MUST pass that exact profile_id in the JSON. " + "Only omit profile_id when the plan does NOT specify a profile — then the parent session's current profile is used.\n\n" + "Examples (copy this structure exactly):\n" + ' {\"task\": \"...\", \"profile_id\": \"server_admin\", \"briefing\": \"...\"}\n' + ' {\"task\": \"...\", \"profile_id\": \"developer\"}\n' + ' {\"task\": \"...\"} ← only when plan does not specify a profile\n\n' ) parameters = { "type": "object", @@ -120,7 +123,9 @@ user_message = task # Resolve profile: explicit override → parent session's profile → first available - profile_id = params.get("profile_id", "").strip() + # Support both 'profile_id' and 'profile' as parameter names since models sometimes + # use 'profile' when the description says "Profile to use". + profile_id = (params.get("profile_id") or params.get("profile") or "").strip() if not profile_id: profile_id = await self._resolve_parent_profile(ctx) try: