diff --git a/src/lib/agents/search/researcher/actions/done.ts b/src/lib/agents/search/researcher/actions/done.ts index 3c3e5f3..d2c4ed6 100644 --- a/src/lib/agents/search/researcher/actions/done.ts +++ b/src/lib/agents/search/researcher/actions/done.ts @@ -11,7 +11,7 @@ const doneAction: ResearchAction = { name: 'done', schema: z.object({}), getToolDescription: () => - 'Only call this after 0_reasoning AND after any other needed tool calls when you truly have enough to answer. Do not call if information is still missing.', + 'Only call this after __reasoning_preamble AND after any other needed tool calls when you truly have enough to answer. Do not call if information is still missing.', getDescription: () => actionDescription, enabled: (_) => true, execute: async (params, additionalConfig) => { diff --git a/src/lib/agents/search/researcher/actions/plan.ts b/src/lib/agents/search/researcher/actions/plan.ts index 05f2e13..d89d64c 100644 --- a/src/lib/agents/search/researcher/actions/plan.ts +++ b/src/lib/agents/search/researcher/actions/plan.ts @@ -23,7 +23,7 @@ YOU CAN NEVER CALL ANY OTHER TOOL BEFORE CALLING THIS ONE FIRST, IF YOU DO, THAT `; const planAction: ResearchAction = { - name: '0_reasoning', + name: '__reasoning_preamble', schema: schema, getToolDescription: () => 'Use this FIRST on every turn to state your plan in natural language before any other action. Keep it short, action-focused, and tailored to the current query.', diff --git a/src/lib/agents/search/researcher/actions/webSearch.ts b/src/lib/agents/search/researcher/actions/webSearch.ts index 3c712a2..4d60b79 100644 --- a/src/lib/agents/search/researcher/actions/webSearch.ts +++ b/src/lib/agents/search/researcher/actions/webSearch.ts @@ -32,11 +32,11 @@ Start initially with broader queries to get an overview, then narrow down with m Your queries shouldn't be sentences but rather keywords that are SEO friendly and can be used to search the web for information. For example if the user is asking about Tesla, your actions should be like: -1. 0_reasoning "The user is asking about Tesla. I will start with broader queries to get an overview of Tesla, then narrow down with more specific queries based on the results I receive." then +1. __reasoning_preamble "The user is asking about Tesla. I will start with broader queries to get an overview of Tesla, then narrow down with more specific queries based on the results I receive." then 2. web_search ["Tesla", "Tesla latest news", "Tesla stock price"] then -3. 0_reasoning "Based on the previous search results, I will now narrow down my queries to focus on Tesla's recent developments and stock performance." then +3. __reasoning_preamble "Based on the previous search results, I will now narrow down my queries to focus on Tesla's recent developments and stock performance." then 4. web_search ["Tesla Q2 2025 earnings", "Tesla new model 2025", "Tesla stock analysis"] then done. -5. 0_reasoning "I have gathered enough information to provide a comprehensive answer." +5. __reasoning_preamble "I have gathered enough information to provide a comprehensive answer." 6. done. You can search for 3 queries in one go, make sure to utilize all 3 queries to maximize the information you can gather. If a question is simple, then split your queries to cover different aspects or related topics to get a comprehensive understanding. diff --git a/src/lib/agents/search/researcher/index.ts b/src/lib/agents/search/researcher/index.ts index f01b6fb..d653281 100644 --- a/src/lib/agents/search/researcher/index.ts +++ b/src/lib/agents/search/researcher/index.ts @@ -87,7 +87,7 @@ class Researcher { if (partialRes.toolCallChunk.length > 0) { partialRes.toolCallChunk.forEach((tc) => { if ( - tc.name === '0_reasoning' && + tc.name === '__reasoning_preamble' && tc.arguments['plan'] && !reasoningEmitted && block && @@ -109,7 +109,7 @@ class Researcher { }, ]); } else if ( - tc.name === '0_reasoning' && + tc.name === '__reasoning_preamble' && tc.arguments['plan'] && reasoningEmitted && block && diff --git a/src/lib/prompts/search/researcher.ts b/src/lib/prompts/search/researcher.ts index d402ad5..537d488 100644 --- a/src/lib/prompts/search/researcher.ts +++ b/src/lib/prompts/search/researcher.ts @@ -109,12 +109,12 @@ const getBalancedPrompt = ( Fulfill the user's request with concise reasoning plus focused actions. - You must call the 0_reasoning tool before every tool call in this assistant turn. Alternate: 0_reasoning → tool → 0_reasoning → tool ... and finish with 0_reasoning → done. Open each 0_reasoning with a brief intent phrase (e.g., "Okay, the user wants to...", "Searching for...", "Looking into...") and lay out your reasoning for the next step. Keep it natural language, no tool names. + You must call the __reasoning_preamble tool before every tool call in this assistant turn. Alternate: __reasoning_preamble → tool → __reasoning_preamble → tool ... and finish with __reasoning_preamble → done. Open each __reasoning_preamble with a brief intent phrase (e.g., "Okay, the user wants to...", "Searching for...", "Looking into...") and lay out your reasoning for the next step. Keep it natural language, no tool names. Your knowledge is outdated; if you have web search, use it to ground answers even for seemingly basic facts. - You can call at most 6 tools total per turn: up to 2 reasoning (0_reasoning counts as reasoning), 2-3 information-gathering calls, and 1 done. If you hit the cap, stop after done. + You can call at most 6 tools total per turn: up to 2 reasoning (__reasoning_preamble counts as reasoning), 2-3 information-gathering calls, and 1 done. If you hit the cap, stop after done. Aim for at least two information-gathering calls when the answer is not already obvious; only skip the second if the question is trivial or you already have sufficient context. Do not spam searches—pick the most targeted queries. @@ -144,7 +144,7 @@ const getBalancedPrompt = ( - YOU MUST CALL 0_reasoning BEFORE EVERY TOOL CALL IN THIS ASSISTANT TURN. IF YOU DO NOT CALL IT, THE TOOL CALL WILL BE IGNORED. + YOU MUST CALL __reasoning_preamble BEFORE EVERY TOOL CALL IN THIS ASSISTANT TURN. IF YOU DO NOT CALL IT, THE TOOL CALL WILL BE IGNORED. ${actionDesc} @@ -160,16 +160,16 @@ const getBalancedPrompt = ( 5. **Overthinking**: Keep reasoning simple and tool calls focused -6. **Skipping the reasoning step**: Always call 0_reasoning first to outline your approach before other actions +6. **Skipping the reasoning step**: Always call __reasoning_preamble first to outline your approach before other actions - NEVER output normal text to the user. ONLY call tools. -- Start with 0_reasoning and call 0_reasoning before every tool call (including done): open with intent phrase ("Okay, the user wants to...", "Looking into...", etc.) and lay out your reasoning for the next step. No tool names. +- Start with __reasoning_preamble and call __reasoning_preamble before every tool call (including done): open with intent phrase ("Okay, the user wants to...", "Looking into...", etc.) and lay out your reasoning for the next step. No tool names. - Choose tools based on the action descriptions provided above. - Default to web_search when information is missing or stale; keep queries targeted (max 3 per call). -- Use at most 6 tool calls total (0_reasoning + 2-3 info calls + 0_reasoning + done). If done is called early, stop. +- Use at most 6 tool calls total (__reasoning_preamble + 2-3 info calls + __reasoning_preamble + done). If done is called early, stop. - Do not stop after a single information-gathering call unless the task is trivial or prior results already cover the answer. - Call done only after you have the needed info or actions completed; do not call it early. - Do not invent tools. Do not return JSON. @@ -210,15 +210,15 @@ const getQualityPrompt = ( Conduct the deepest, most thorough research possible. Leave no stone unturned. - Follow an iterative reason-act loop: call 0_reasoning before every tool call to outline the next step, then call the tool, then 0_reasoning again to reflect and decide the next step. Repeat until you have exhaustive coverage. - Open each 0_reasoning with a brief intent phrase (e.g., "Okay, the user wants to know about...", "From the results, it looks like...", "Now I need to dig into...") and describe what you'll do next. Keep it natural language, no tool names. + Follow an iterative reason-act loop: call __reasoning_preamble before every tool call to outline the next step, then call the tool, then __reasoning_preamble again to reflect and decide the next step. Repeat until you have exhaustive coverage. + Open each __reasoning_preamble with a brief intent phrase (e.g., "Okay, the user wants to know about...", "From the results, it looks like...", "Now I need to dig into...") and describe what you'll do next. Keep it natural language, no tool names. Finish with done only when you have comprehensive, multi-angle information. Your knowledge is outdated; always use the available tools to ground answers. This is DEEP RESEARCH mode—be exhaustive. Explore multiple angles: definitions, features, comparisons, recent news, expert opinions, use cases, limitations, and alternatives. - You can call up to 10 tools total per turn. Use an iterative loop: 0_reasoning → tool call(s) → 0_reasoning → tool call(s) → ... → 0_reasoning → done. + You can call up to 10 tools total per turn. Use an iterative loop: __reasoning_preamble → tool call(s) → __reasoning_preamble → tool call(s) → ... → __reasoning_preamble → done. Never settle for surface-level answers. If results hint at more depth, reason about your next step and follow up. Cross-reference information from multiple queries. @@ -264,7 +264,7 @@ const getQualityPrompt = ( - YOU MUST CALL 0_reasoning BEFORE EVERY TOOL CALL IN THIS ASSISTANT TURN. IF YOU DO NOT CALL IT, THE TOOL CALL WILL BE IGNORED. + YOU MUST CALL __reasoning_preamble BEFORE EVERY TOOL CALL IN THIS ASSISTANT TURN. IF YOU DO NOT CALL IT, THE TOOL CALL WILL BE IGNORED. ${actionDesc} @@ -291,14 +291,14 @@ const getQualityPrompt = ( 5. **Premature done**: Don't call done until you've exhausted reasonable research avenues -6. **Skipping the reasoning step**: Always call 0_reasoning first to outline your research strategy +6. **Skipping the reasoning step**: Always call __reasoning_preamble first to outline your research strategy - NEVER output normal text to the user. ONLY call tools. -- Follow an iterative loop: 0_reasoning → tool call → 0_reasoning → tool call → ... → 0_reasoning → done. -- Each 0_reasoning should reflect on previous results (if any) and state the next research step. No tool names in the reasoning. +- Follow an iterative loop: __reasoning_preamble → tool call → __reasoning_preamble → tool call → ... → __reasoning_preamble → done. +- Each __reasoning_preamble should reflect on previous results (if any) and state the next research step. No tool names in the reasoning. - Choose tools based on the action descriptions provided above—use whatever tools are available to accomplish the task. - Aim for 4-7 information-gathering calls covering different angles; cross-reference and follow up on interesting leads. - Call done only after comprehensive, multi-angle research is complete.