@deepagents/orchestrator 7.0.2 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/arxiv/arxiv.d.ts +9 -3
- package/dist/lib/arxiv/arxiv.d.ts.map +1 -1
- package/dist/lib/arxiv/arxiv.js +3 -11
- package/dist/lib/arxiv/arxiv.js.map +2 -2
- package/dist/lib/citation.js +3 -6
- package/dist/lib/citation.js.map +2 -2
- package/dist/lib/deepplan/demo.js.map +1 -1
- package/dist/lib/deepplan/executors/research-executor.js.map +2 -2
- package/dist/lib/deepplan/plan-and-solve.js +2 -6
- package/dist/lib/deepplan/plan-and-solve.js.map +2 -2
- package/dist/lib/deepplan/planner-agent.d.ts.map +1 -1
- package/dist/lib/deepplan/planner-agent.js +1 -4
- package/dist/lib/deepplan/planner-agent.js.map +2 -2
- package/dist/lib/deepplan/replanner-agent.d.ts.map +1 -1
- package/dist/lib/deepplan/replanner-agent.js +1 -2
- package/dist/lib/deepplan/replanner-agent.js.map +2 -2
- package/dist/lib/deepresearch.v0.d.ts.map +1 -1
- package/dist/lib/deepresearch.v0.js +21 -18
- package/dist/lib/deepresearch.v0.js.map +2 -2
- package/dist/lib/deepresearch.v1.d.ts.map +1 -1
- package/dist/lib/deepresearch.v1.js +3 -5
- package/dist/lib/deepresearch.v1.js.map +2 -2
- package/dist/lib/deepwiki/complete-wiki.js +4 -2
- package/dist/lib/deepwiki/complete-wiki.js.map +2 -2
- package/dist/lib/deepwiki/deepwiki.js +4 -2
- package/dist/lib/deepwiki/deepwiki.js.map +2 -2
- package/dist/lib/deepwiki/gitignore-agent.d.ts +4 -2
- package/dist/lib/deepwiki/gitignore-agent.d.ts.map +1 -1
- package/dist/lib/deepwiki/gitignore-agent.js +2 -3
- package/dist/lib/deepwiki/gitignore-agent.js.map +2 -2
- package/dist/lib/deepwiki/outline-agent.d.ts.map +1 -1
- package/dist/lib/deepwiki/outline-agent.js +4 -2
- package/dist/lib/deepwiki/outline-agent.js.map +2 -2
- package/dist/lib/deepwiki/wiki-writer.js +4 -2
- package/dist/lib/deepwiki/wiki-writer.js.map +2 -2
- package/dist/lib/deepwiki/writer.d.ts.map +1 -1
- package/dist/lib/deepwiki/writer.js +5 -5
- package/dist/lib/deepwiki/writer.js.map +2 -2
- package/dist/lib/evolving.js +1 -1
- package/dist/lib/evolving.js.map +2 -2
- package/dist/lib/openai-deepresearch/clarrify-agent.d.ts +5 -1
- package/dist/lib/openai-deepresearch/clarrify-agent.d.ts.map +1 -1
- package/dist/lib/openai-deepresearch/lead-research.d.ts.map +1 -1
- package/dist/lib/openai-deepresearch/lead-research.js +2 -3
- package/dist/lib/openai-deepresearch/lead-research.js.map +2 -2
- package/dist/lib/openai-deepresearch/openai-deepresearch.js +6 -8
- package/dist/lib/openai-deepresearch/openai-deepresearch.js.map +3 -3
- package/dist/lib/openai-deepresearch/reasearcher.js.map +2 -2
- package/dist/lib/openai-deepresearch/research-brief.d.ts +3 -1
- package/dist/lib/openai-deepresearch/research-brief.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -6,7 +6,7 @@ import { execute as execute2, printer, user as user2 } from "@deepagents/agent";
|
|
|
6
6
|
import { groq as groq2 } from "@ai-sdk/groq";
|
|
7
7
|
import { jsonSchema, tool } from "ai";
|
|
8
8
|
import z from "zod";
|
|
9
|
-
import { agent as agent2, execute,
|
|
9
|
+
import { agent as agent2, execute, user } from "@deepagents/agent";
|
|
10
10
|
import { scratchpad_tool as scratchpad_tool2 } from "@deepagents/toolbox";
|
|
11
11
|
|
|
12
12
|
// packages/orchestrator/src/lib/openai-deepresearch/reasearcher.ts
|
|
@@ -152,16 +152,15 @@ var leadResearcherAgent = agent2({
|
|
|
152
152
|
"The topic to research. Should be a single topic, and should be described in high detail (at least a paragraph)."
|
|
153
153
|
)
|
|
154
154
|
}),
|
|
155
|
-
execute: async ({ research_topic },
|
|
156
|
-
const context = toState(options);
|
|
155
|
+
execute: async ({ research_topic }, { context }) => {
|
|
157
156
|
context.research_iterations++;
|
|
158
|
-
const
|
|
157
|
+
const result2 = await execute(
|
|
159
158
|
researcherAgent,
|
|
160
159
|
[user(research_topic)],
|
|
161
160
|
{},
|
|
162
161
|
{ providerOptions: { groq: { reasoningEffort: "low" } } }
|
|
163
162
|
);
|
|
164
|
-
return await
|
|
163
|
+
return await result2.text;
|
|
165
164
|
}
|
|
166
165
|
})
|
|
167
166
|
}
|
|
@@ -169,11 +168,10 @@ var leadResearcherAgent = agent2({
|
|
|
169
168
|
|
|
170
169
|
// packages/orchestrator/src/lib/openai-deepresearch/openai-deepresearch.ts
|
|
171
170
|
var research_brief = `I want a comprehensive research report on opening a coworking space in Amman, Jordan that includes detailed market insights (size, growth trends, target demographics, and demand drivers), a competitor analysis (existing coworking providers, their locations, pricing models, amenities, and market share), an assessment of demand and pricing elasticity, key operational considerations (optimal locations, regulatory and licensing requirements, staffing needs, technology and infrastructure, cost structure, revenue projections, and risk factors), and actionable recommendations for a go\u2011to\u2011market strategy. Any dimensions not explicitly specified (e.g., preferred target customer segment, budget constraints, or timeline) should be treated as open\u2011ended and explored broadly.`;
|
|
172
|
-
execute2(leadResearcherAgent, [user2(research_brief)], {
|
|
171
|
+
var result = await execute2(leadResearcherAgent, [user2(research_brief)], {
|
|
173
172
|
max_concurrent_research_units: 3,
|
|
174
173
|
max_researcher_iterations: 3,
|
|
175
174
|
research_iterations: 0
|
|
176
|
-
}).then((result) => {
|
|
177
|
-
printer.stdout(result, { reasoning: false });
|
|
178
175
|
});
|
|
176
|
+
await printer.stdout(result, { reasoning: false });
|
|
179
177
|
//# sourceMappingURL=openai-deepresearch.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/openai-deepresearch/openai-deepresearch.ts", "../../../src/lib/openai-deepresearch/lead-research.ts", "../../../src/lib/openai-deepresearch/reasearcher.ts"],
|
|
4
|
-
"sourcesContent": ["import { type UIMessage, generateId, toUIMessageStream } from 'ai';\n\nimport { execute, printer, user } from '@deepagents/agent';\n\nimport {\n type LeadResearcherState,\n leadResearcherAgent,\n} from './lead-research.ts';\n\n// let clarification: z.output<typeof ClarrifyQuestion> = {\n// need_clarification: true,\n// question: '',\n// verification: '',\n// };\n// const messages: UIMessage[] = [];\n// while (clarification.need_clarification) {\n// console.log(clarification.question + '\\n');\n// messages.push(user(await input()));\n// const result = execute(clarrifyAgent, messages, {});\n// const output = await toOutput<z.output<typeof ClarrifyQuestion>>(result);\n// await Array.fromAsync(\n// result.toUIMessageStream({\n// generateMessageId: generateId,\n// originalMessages: messages,\n// onEnd: async ({ responseMessage }) => {\n// messages.push(responseMessage);\n// },\n// }),\n// );\n// await result.consumeStream();\n// clarification = output;\n// }\n// const { output: research_brief } = await generate(researchTopicAgent, clarification.verification, {})\nconst research_brief = `I want a comprehensive research report on opening a coworking space in Amman, Jordan that includes detailed market insights (size, growth trends, target demographics, and demand drivers), a competitor analysis (existing coworking providers, their locations, pricing models, amenities, and market share), an assessment of demand and pricing elasticity, key operational considerations (optimal locations, regulatory and licensing requirements, staffing needs, technology and infrastructure, cost structure, revenue projections, and risk factors), and actionable recommendations for a go\u2011to\u2011market strategy. Any dimensions not explicitly specified (e.g., preferred target customer segment, budget constraints, or timeline) should be treated as open\u2011ended and explored broadly.`;\n\nexecute(leadResearcherAgent, [user(research_brief)], {\n max_concurrent_research_units: 3,\n max_researcher_iterations: 3,\n research_iterations: 0,\n}).then((result) => {\n printer.stdout(result, { reasoning: false });\n});\n\n// await startResearch(research_brief);\n\nasync function startResearch(brief: string) {\n const messages: UIMessage[] = [user(brief)];\n const state: LeadResearcherState = {\n max_concurrent_research_units: 3,\n max_researcher_iterations: 1,\n research_iterations: 0,\n };\n while (true) {\n const result = await execute(leadResearcherAgent, messages, state);\n await Array.fromAsync(\n toUIMessageStream({\n stream: result.stream,\n tools: leadResearcherAgent.toToolset(),\n generateMessageId: generateId,\n originalMessages: messages,\n onEnd: async ({ responseMessage }: { responseMessage: UIMessage }) => {\n messages.push(responseMessage);\n },\n }),\n );\n await result.consumeStream();\n const calls = await result.toolCalls;\n const researchComplete = calls.some(\n (it: { toolName: string }) => it.toolName === 'research_complete',\n );\n const conductResearchTools = calls.filter(\n (it: { toolName: string }) => it.toolName === 'conduct_research',\n );\n\n const exceeded_allowed_iterations =\n state.research_iterations >= state.max_researcher_iterations;\n\n if (researchComplete || exceeded_allowed_iterations || !calls.length) {\n break;\n }\n\n // for (const call of conductResearchTools) {\n // const result = execute(\n // researcherAgent,\n // [user(call.input.research_topic)],\n // {},\n // );\n // const mostRecentMessage = messages[messages.length - 1];\n // if (mostRecentMessage.role === 'assistant') {\n // messages.push({\n // role: 'assistant',\n // // parts: [{}],\n // });\n // }\n // }\n\n state.research_iterations++;\n }\n}\n", "import { groq } from '@ai-sdk/groq';\nimport { jsonSchema, tool } from 'ai';\nimport z from 'zod';\n\nimport { agent, execute, toState, user } from '@deepagents/agent';\nimport { scratchpad_tool } from '@deepagents/toolbox';\n\nimport { researcherAgent } from './reasearcher.ts';\n\nconst lead_researcher_prompt = (\n max_researcher_iterations: number,\n max_concurrent_research_units: number,\n) => `You are a research supervisor. Your job is to conduct research by calling the \"conduct_research\" tool. For context, today's date is ${new Date().toISOString()}.\n\n<Task>\nYour focus is to call the \"conduct_research\" tool to conduct research against the overall research question passed in by the user.\nWhen you are completely satisfied with the research findings returned from the tool calls, then you should call the \"research_complete\" tool to indicate that you are done with your research.\n</Task>\n\n<Available Tools>\nYou have access to three main tools:\n1. **conduct_research**: Delegate research tasks to specialized sub-agents\n2. **research_complete**: Indicate that research is complete\n3. **think_tool**: For reflection and strategic planning during research\n\n**CRITICAL: Use think_tool before calling conduct_research to plan your approach, and after each conduct_research to assess progress. Do not call think_tool with any other tools in parallel.**\n</Available Tools>\n\n<Instructions>\nThink like a research manager with limited time and resources. Follow these steps:\n\n1. **Read the question carefully** - What specific information does the user need?\n2. **Decide how to delegate the research** - Carefully consider the question and decide how to delegate the research. Are there multiple independent directions that can be explored simultaneously?\n3. **After each call to conduct_research, pause and assess** - Do I have enough to answer? What's still missing?\n</Instructions>\n\n<Hard Limits>\n**Task Delegation Budgets** (Prevent excessive delegation):\n- **Bias towards single agent** - Use single agent for simplicity unless the user request has clear opportunity for parallelization\n- **Stop when you can answer confidently** - Don't keep delegating research for perfection\n- **Limit tool calls** - Always stop after ${max_researcher_iterations} tool calls to conduct_research and think_tool if you cannot find the right sources\n\n**Maximum ${max_concurrent_research_units} parallel agents per iteration**\n</Hard Limits>\n\n<Show Your Thinking>\nBefore you call conduct_research tool call, use think_tool to plan your approach:\n- Can the task be broken down into smaller sub-tasks?\n\nAfter each conduct_research tool call, use think_tool to analyze the results:\n- What key information did I find?\n- What's missing?\n- Do I have enough to answer the question comprehensively?\n- Should I delegate more research or call research_complete?\n</Show Your Thinking>\n\n<Scaling Rules>\n**Simple fact-finding, lists, and rankings** can use a single sub-agent:\n- *Example*: List the top 10 coffee shops in San Francisco \u2192 Use 1 sub-agent\n\n**Comparisons presented in the user request** can use a sub-agent for each element of the comparison:\n- *Example*: Compare OpenAI vs. Anthropic vs. DeepMind approaches to AI safety \u2192 Use 3 sub-agents\n- Delegate clear, distinct, non-overlapping subtopics\n\n**Important Reminders:**\n- Each conduct_research call spawns a dedicated research agent for that specific topic\n- A separate agent will write the final report - you just need to gather information\n- When calling conduct_research, provide complete standalone instructions - sub-agents can't see other agents' work\n- Do NOT use acronyms or abbreviations in your research questions, be very clear and specific\n</Scaling Rules>\n`;\n\nexport type LeadResearcherState = {\n max_researcher_iterations: number;\n max_concurrent_research_units: number;\n research_iterations: number;\n};\nexport const leadResearcherAgent = agent<unknown, LeadResearcherState>({\n name: 'lead_researcher',\n model: groq('openai/gpt-oss-20b'),\n prompt: (context) =>\n lead_researcher_prompt(\n context?.max_researcher_iterations || 5,\n context?.max_concurrent_research_units || 3,\n ),\n tools: {\n think_tool: scratchpad_tool,\n research_complete: tool({\n description: 'Call this tool to indicate that research is complete.',\n inputSchema: jsonSchema({\n type: 'object',\n properties: {},\n additionalProperties: true,\n }),\n }),\n conduct_research: tool({\n description: 'Call this tool to conduct research on a specific topic.',\n inputSchema: z.object({\n research_topic: z\n .string()\n .describe(\n 'The topic to research. Should be a single topic, and should be described in high detail (at least a paragraph).',\n ),\n }),\n execute: async ({ research_topic }, options) => {\n const context = toState<LeadResearcherState>(options);\n context.research_iterations++;\n const result = await execute(\n researcherAgent,\n [user(research_topic)],\n {},\n { providerOptions: { groq: { reasoningEffort: 'low' } } },\n );\n return await result.text;\n },\n }),\n },\n});\n", "import { groq } from '@ai-sdk/groq';\n\nimport { agent } from '@deepagents/agent';\nimport { scratchpad_tool } from '@deepagents/toolbox';\n\nconst research_system_prompt = `You are a research assistant conducting research on the user's input topic. For context, today's date is ${new Date().toISOString()}.\n\n<Task>\nYour job is to use tools to gather information about the user's input topic.\nYou can use any of the tools provided to you to find resources that can help answer the research question. You can call these tools in series or in parallel, your research is conducted in a tool-calling loop.\n</Task>\n\n<AvailableTools>\nYou have access to two main tools:\n1. **browser_search**: For conducting web searches to gather information\n2. **think_tool**: For reflection and strategic planning during research\n\n**CRITICAL: Use think_tool after each search to reflect on results and plan next steps. Do not call think_tool with the web_search or any other tools. It should be to reflect on the results of the search.**\n</AvailableTools>\n\n<Instructions>\nThink like a human researcher with limited time. Follow these steps:\n\n1. **Read the question carefully** - What specific information does the user need?\n2. **Start with broader searches** - Use broad, comprehensive queries first\n3. **After each search, pause and assess** - Do I have enough to answer? What's still missing?\n4. **Execute narrower searches as you gather information** - Fill in the gaps\n5. **Stop when you can answer confidently** - Don't keep searching for perfection\n</Instructions>\n\n<HardLimits>\n**Tool Call Budgets** (Prevent excessive searching):\n- **Simple queries**: Use 2-3 search tool calls maximum\n- **Complex queries**: Use up to 5 search tool calls maximum\n- **Always stop**: After 5 search tool calls if you cannot find the right sources\n\n**Stop Immediately When**:\n- You can answer the user's question comprehensively\n- You have 3+ relevant examples/sources for the question\n- Your last 2 searches returned similar information\n</HardLimits>\n\n<ShowYourThinking>\nAfter each search tool call, use think_tool to analyze the results:\n- What key information did I find?\n- What's missing?\n- Do I have enough to answer the question comprehensively?\n- Should I search more or provide my answer?\n</ShowYourThinking>\n`;\n\nexport const researcherAgent = agent({\n name: 'researcher_agent',\n model: groq('openai/gpt-oss-20b'),\n prompt: research_system_prompt,\n tools: {\n think_tool: scratchpad_tool,\n browser_search: (groq as any).tools.browserSearch({}),\n },\n});\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAyB,YAAY,yBAAyB;AAE9D,SAAS,WAAAA,UAAS,SAAS,QAAAC,aAAY;;;ACFvC,SAAS,QAAAC,aAAY;AACrB,
|
|
6
|
-
"names": ["execute", "user", "groq", "agent", "scratchpad_tool", "agent", "groq", "scratchpad_tool", "execute", "user"]
|
|
4
|
+
"sourcesContent": ["import { type UIMessage, generateId, toUIMessageStream } from 'ai';\n\nimport { execute, printer, user } from '@deepagents/agent';\n\nimport {\n type LeadResearcherState,\n leadResearcherAgent,\n} from './lead-research.ts';\n\n// let clarification: z.output<typeof ClarrifyQuestion> = {\n// need_clarification: true,\n// question: '',\n// verification: '',\n// };\n// const messages: UIMessage[] = [];\n// while (clarification.need_clarification) {\n// console.log(clarification.question + '\\n');\n// messages.push(user(await input()));\n// const result = execute(clarrifyAgent, messages, {});\n// const output = await toOutput<z.output<typeof ClarrifyQuestion>>(result);\n// await Array.fromAsync(\n// result.toUIMessageStream({\n// generateMessageId: generateId,\n// originalMessages: messages,\n// onEnd: async ({ responseMessage }) => {\n// messages.push(responseMessage);\n// },\n// }),\n// );\n// await result.consumeStream();\n// clarification = output;\n// }\n// const { output: research_brief } = await generate(researchTopicAgent, clarification.verification, {})\nconst research_brief = `I want a comprehensive research report on opening a coworking space in Amman, Jordan that includes detailed market insights (size, growth trends, target demographics, and demand drivers), a competitor analysis (existing coworking providers, their locations, pricing models, amenities, and market share), an assessment of demand and pricing elasticity, key operational considerations (optimal locations, regulatory and licensing requirements, staffing needs, technology and infrastructure, cost structure, revenue projections, and risk factors), and actionable recommendations for a go\u2011to\u2011market strategy. Any dimensions not explicitly specified (e.g., preferred target customer segment, budget constraints, or timeline) should be treated as open\u2011ended and explored broadly.`;\n\nconst result = await execute(leadResearcherAgent, [user(research_brief)], {\n max_concurrent_research_units: 3,\n max_researcher_iterations: 3,\n research_iterations: 0,\n});\nawait printer.stdout(result, { reasoning: false });\n\n// await startResearch(research_brief);\n\nasync function startResearch(brief: string) {\n const messages: UIMessage[] = [user(brief)];\n const state: LeadResearcherState = {\n max_concurrent_research_units: 3,\n max_researcher_iterations: 1,\n research_iterations: 0,\n };\n while (true) {\n const result = await execute(leadResearcherAgent, messages, state);\n await Array.fromAsync(\n toUIMessageStream({\n stream: result.stream,\n tools: leadResearcherAgent.toToolset(),\n generateMessageId: generateId,\n originalMessages: messages,\n onEnd: async ({ responseMessage }: { responseMessage: UIMessage }) => {\n messages.push(responseMessage);\n },\n }),\n );\n await result.consumeStream();\n const calls = await result.toolCalls;\n const researchComplete = calls.some(\n (it: { toolName: string }) => it.toolName === 'research_complete',\n );\n const conductResearchTools = calls.filter(\n (it: { toolName: string }) => it.toolName === 'conduct_research',\n );\n\n const exceeded_allowed_iterations =\n state.research_iterations >= state.max_researcher_iterations;\n\n if (researchComplete || exceeded_allowed_iterations || !calls.length) {\n break;\n }\n\n // for (const call of conductResearchTools) {\n // const result = execute(\n // researcherAgent,\n // [user(call.input.research_topic)],\n // {},\n // );\n // const mostRecentMessage = messages[messages.length - 1];\n // if (mostRecentMessage.role === 'assistant') {\n // messages.push({\n // role: 'assistant',\n // // parts: [{}],\n // });\n // }\n // }\n\n state.research_iterations++;\n }\n}\n", "import { groq } from '@ai-sdk/groq';\nimport { type ToolExecutionOptions, jsonSchema, tool } from 'ai';\nimport z from 'zod';\n\nimport { agent, execute, user } from '@deepagents/agent';\nimport { scratchpad_tool } from '@deepagents/toolbox';\n\nimport { researcherAgent } from './reasearcher.ts';\n\nconst lead_researcher_prompt = (\n max_researcher_iterations: number,\n max_concurrent_research_units: number,\n) => `You are a research supervisor. Your job is to conduct research by calling the \"conduct_research\" tool. For context, today's date is ${new Date().toISOString()}.\n\n<Task>\nYour focus is to call the \"conduct_research\" tool to conduct research against the overall research question passed in by the user.\nWhen you are completely satisfied with the research findings returned from the tool calls, then you should call the \"research_complete\" tool to indicate that you are done with your research.\n</Task>\n\n<Available Tools>\nYou have access to three main tools:\n1. **conduct_research**: Delegate research tasks to specialized sub-agents\n2. **research_complete**: Indicate that research is complete\n3. **think_tool**: For reflection and strategic planning during research\n\n**CRITICAL: Use think_tool before calling conduct_research to plan your approach, and after each conduct_research to assess progress. Do not call think_tool with any other tools in parallel.**\n</Available Tools>\n\n<Instructions>\nThink like a research manager with limited time and resources. Follow these steps:\n\n1. **Read the question carefully** - What specific information does the user need?\n2. **Decide how to delegate the research** - Carefully consider the question and decide how to delegate the research. Are there multiple independent directions that can be explored simultaneously?\n3. **After each call to conduct_research, pause and assess** - Do I have enough to answer? What's still missing?\n</Instructions>\n\n<Hard Limits>\n**Task Delegation Budgets** (Prevent excessive delegation):\n- **Bias towards single agent** - Use single agent for simplicity unless the user request has clear opportunity for parallelization\n- **Stop when you can answer confidently** - Don't keep delegating research for perfection\n- **Limit tool calls** - Always stop after ${max_researcher_iterations} tool calls to conduct_research and think_tool if you cannot find the right sources\n\n**Maximum ${max_concurrent_research_units} parallel agents per iteration**\n</Hard Limits>\n\n<Show Your Thinking>\nBefore you call conduct_research tool call, use think_tool to plan your approach:\n- Can the task be broken down into smaller sub-tasks?\n\nAfter each conduct_research tool call, use think_tool to analyze the results:\n- What key information did I find?\n- What's missing?\n- Do I have enough to answer the question comprehensively?\n- Should I delegate more research or call research_complete?\n</Show Your Thinking>\n\n<Scaling Rules>\n**Simple fact-finding, lists, and rankings** can use a single sub-agent:\n- *Example*: List the top 10 coffee shops in San Francisco \u2192 Use 1 sub-agent\n\n**Comparisons presented in the user request** can use a sub-agent for each element of the comparison:\n- *Example*: Compare OpenAI vs. Anthropic vs. DeepMind approaches to AI safety \u2192 Use 3 sub-agents\n- Delegate clear, distinct, non-overlapping subtopics\n\n**Important Reminders:**\n- Each conduct_research call spawns a dedicated research agent for that specific topic\n- A separate agent will write the final report - you just need to gather information\n- When calling conduct_research, provide complete standalone instructions - sub-agents can't see other agents' work\n- Do NOT use acronyms or abbreviations in your research questions, be very clear and specific\n</Scaling Rules>\n`;\n\nexport type LeadResearcherState = {\n max_researcher_iterations: number;\n max_concurrent_research_units: number;\n research_iterations: number;\n};\nexport const leadResearcherAgent = agent<unknown, LeadResearcherState>({\n name: 'lead_researcher',\n model: groq('openai/gpt-oss-20b'),\n prompt: (context) =>\n lead_researcher_prompt(\n context?.max_researcher_iterations || 5,\n context?.max_concurrent_research_units || 3,\n ),\n tools: {\n think_tool: scratchpad_tool,\n research_complete: tool({\n description: 'Call this tool to indicate that research is complete.',\n inputSchema: jsonSchema({\n type: 'object',\n properties: {},\n additionalProperties: true,\n }),\n }),\n conduct_research: tool({\n description: 'Call this tool to conduct research on a specific topic.',\n inputSchema: z.object({\n research_topic: z\n .string()\n .describe(\n 'The topic to research. Should be a single topic, and should be described in high detail (at least a paragraph).',\n ),\n }),\n execute: async (\n { research_topic },\n { context }: ToolExecutionOptions<LeadResearcherState>,\n ) => {\n context.research_iterations++;\n const result = await execute(\n researcherAgent,\n [user(research_topic)],\n {},\n { providerOptions: { groq: { reasoningEffort: 'low' } } },\n );\n return await result.text;\n },\n }),\n },\n});\n", "import { groq } from '@ai-sdk/groq';\n\nimport { agent } from '@deepagents/agent';\nimport { scratchpad_tool } from '@deepagents/toolbox';\n\nconst research_system_prompt = `You are a research assistant conducting research on the user's input topic. For context, today's date is ${new Date().toISOString()}.\n\n<Task>\nYour job is to use tools to gather information about the user's input topic.\nYou can use any of the tools provided to you to find resources that can help answer the research question. You can call these tools in series or in parallel, your research is conducted in a tool-calling loop.\n</Task>\n\n<AvailableTools>\nYou have access to two main tools:\n1. **browser_search**: For conducting web searches to gather information\n2. **think_tool**: For reflection and strategic planning during research\n\n**CRITICAL: Use think_tool after each search to reflect on results and plan next steps. Do not call think_tool with the web_search or any other tools. It should be to reflect on the results of the search.**\n</AvailableTools>\n\n<Instructions>\nThink like a human researcher with limited time. Follow these steps:\n\n1. **Read the question carefully** - What specific information does the user need?\n2. **Start with broader searches** - Use broad, comprehensive queries first\n3. **After each search, pause and assess** - Do I have enough to answer? What's still missing?\n4. **Execute narrower searches as you gather information** - Fill in the gaps\n5. **Stop when you can answer confidently** - Don't keep searching for perfection\n</Instructions>\n\n<HardLimits>\n**Tool Call Budgets** (Prevent excessive searching):\n- **Simple queries**: Use 2-3 search tool calls maximum\n- **Complex queries**: Use up to 5 search tool calls maximum\n- **Always stop**: After 5 search tool calls if you cannot find the right sources\n\n**Stop Immediately When**:\n- You can answer the user's question comprehensively\n- You have 3+ relevant examples/sources for the question\n- Your last 2 searches returned similar information\n</HardLimits>\n\n<ShowYourThinking>\nAfter each search tool call, use think_tool to analyze the results:\n- What key information did I find?\n- What's missing?\n- Do I have enough to answer the question comprehensively?\n- Should I search more or provide my answer?\n</ShowYourThinking>\n`;\n\nexport const researcherAgent = agent({\n name: 'researcher_agent',\n model: groq('openai/gpt-oss-20b'),\n prompt: research_system_prompt,\n tools: {\n think_tool: scratchpad_tool,\n browser_search: groq.tools.browserSearch({}),\n },\n});\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAyB,YAAY,yBAAyB;AAE9D,SAAS,WAAAA,UAAS,SAAS,QAAAC,aAAY;;;ACFvC,SAAS,QAAAC,aAAY;AACrB,SAAoC,YAAY,YAAY;AAC5D,OAAO,OAAO;AAEd,SAAS,SAAAC,QAAO,SAAS,YAAY;AACrC,SAAS,mBAAAC,wBAAuB;;;ACLhC,SAAS,YAAY;AAErB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAEhC,IAAM,yBAAyB,6GAA4G,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8C5J,IAAM,kBAAkB,MAAM;AAAA,EACnC,MAAM;AAAA,EACN,OAAO,KAAK,oBAAoB;AAAA,EAChC,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,YAAY;AAAA,IACZ,gBAAgB,KAAK,MAAM,cAAc,CAAC,CAAC;AAAA,EAC7C;AACF,CAAC;;;ADlDD,IAAM,yBAAyB,CAC7B,2BACA,kCACG,wIAAuI,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6CA4BvH,yBAAyB;AAAA;AAAA,YAE1D,6BAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmClC,IAAM,sBAAsBC,OAAoC;AAAA,EACrE,MAAM;AAAA,EACN,OAAOC,MAAK,oBAAoB;AAAA,EAChC,QAAQ,CAAC,YACP;AAAA,IACE,SAAS,6BAA6B;AAAA,IACtC,SAAS,iCAAiC;AAAA,EAC5C;AAAA,EACF,OAAO;AAAA,IACL,YAAYC;AAAA,IACZ,mBAAmB,KAAK;AAAA,MACtB,aAAa;AAAA,MACb,aAAa,WAAW;AAAA,QACtB,MAAM;AAAA,QACN,YAAY,CAAC;AAAA,QACb,sBAAsB;AAAA,MACxB,CAAC;AAAA,IACH,CAAC;AAAA,IACD,kBAAkB,KAAK;AAAA,MACrB,aAAa;AAAA,MACb,aAAa,EAAE,OAAO;AAAA,QACpB,gBAAgB,EACb,OAAO,EACP;AAAA,UACC;AAAA,QACF;AAAA,MACJ,CAAC;AAAA,MACD,SAAS,OACP,EAAE,eAAe,GACjB,EAAE,QAAQ,MACP;AACH,gBAAQ;AACR,cAAMC,UAAS,MAAM;AAAA,UACnB;AAAA,UACA,CAAC,KAAK,cAAc,CAAC;AAAA,UACrB,CAAC;AAAA,UACD,EAAE,iBAAiB,EAAE,MAAM,EAAE,iBAAiB,MAAM,EAAE,EAAE;AAAA,QAC1D;AACA,eAAO,MAAMA,QAAO;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;;;ADtFD,IAAM,iBAAiB;AAEvB,IAAM,SAAS,MAAMC,SAAQ,qBAAqB,CAACC,MAAK,cAAc,CAAC,GAAG;AAAA,EACxE,+BAA+B;AAAA,EAC/B,2BAA2B;AAAA,EAC3B,qBAAqB;AACvB,CAAC;AACD,MAAM,QAAQ,OAAO,QAAQ,EAAE,WAAW,MAAM,CAAC;",
|
|
6
|
+
"names": ["execute", "user", "groq", "agent", "scratchpad_tool", "agent", "groq", "scratchpad_tool", "result", "execute", "user"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/openai-deepresearch/reasearcher.ts"],
|
|
4
|
-
"sourcesContent": ["import { groq } from '@ai-sdk/groq';\n\nimport { agent } from '@deepagents/agent';\nimport { scratchpad_tool } from '@deepagents/toolbox';\n\nconst research_system_prompt = `You are a research assistant conducting research on the user's input topic. For context, today's date is ${new Date().toISOString()}.\n\n<Task>\nYour job is to use tools to gather information about the user's input topic.\nYou can use any of the tools provided to you to find resources that can help answer the research question. You can call these tools in series or in parallel, your research is conducted in a tool-calling loop.\n</Task>\n\n<AvailableTools>\nYou have access to two main tools:\n1. **browser_search**: For conducting web searches to gather information\n2. **think_tool**: For reflection and strategic planning during research\n\n**CRITICAL: Use think_tool after each search to reflect on results and plan next steps. Do not call think_tool with the web_search or any other tools. It should be to reflect on the results of the search.**\n</AvailableTools>\n\n<Instructions>\nThink like a human researcher with limited time. Follow these steps:\n\n1. **Read the question carefully** - What specific information does the user need?\n2. **Start with broader searches** - Use broad, comprehensive queries first\n3. **After each search, pause and assess** - Do I have enough to answer? What's still missing?\n4. **Execute narrower searches as you gather information** - Fill in the gaps\n5. **Stop when you can answer confidently** - Don't keep searching for perfection\n</Instructions>\n\n<HardLimits>\n**Tool Call Budgets** (Prevent excessive searching):\n- **Simple queries**: Use 2-3 search tool calls maximum\n- **Complex queries**: Use up to 5 search tool calls maximum\n- **Always stop**: After 5 search tool calls if you cannot find the right sources\n\n**Stop Immediately When**:\n- You can answer the user's question comprehensively\n- You have 3+ relevant examples/sources for the question\n- Your last 2 searches returned similar information\n</HardLimits>\n\n<ShowYourThinking>\nAfter each search tool call, use think_tool to analyze the results:\n- What key information did I find?\n- What's missing?\n- Do I have enough to answer the question comprehensively?\n- Should I search more or provide my answer?\n</ShowYourThinking>\n`;\n\nexport const researcherAgent = agent({\n name: 'researcher_agent',\n model: groq('openai/gpt-oss-20b'),\n prompt: research_system_prompt,\n tools: {\n think_tool: scratchpad_tool,\n browser_search:
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY;AAErB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAEhC,IAAM,yBAAyB,6GAA4G,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8C5J,IAAM,kBAAkB,MAAM;AAAA,EACnC,MAAM;AAAA,EACN,OAAO,KAAK,oBAAoB;AAAA,EAChC,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,YAAY;AAAA,IACZ,
|
|
4
|
+
"sourcesContent": ["import { groq } from '@ai-sdk/groq';\n\nimport { agent } from '@deepagents/agent';\nimport { scratchpad_tool } from '@deepagents/toolbox';\n\nconst research_system_prompt = `You are a research assistant conducting research on the user's input topic. For context, today's date is ${new Date().toISOString()}.\n\n<Task>\nYour job is to use tools to gather information about the user's input topic.\nYou can use any of the tools provided to you to find resources that can help answer the research question. You can call these tools in series or in parallel, your research is conducted in a tool-calling loop.\n</Task>\n\n<AvailableTools>\nYou have access to two main tools:\n1. **browser_search**: For conducting web searches to gather information\n2. **think_tool**: For reflection and strategic planning during research\n\n**CRITICAL: Use think_tool after each search to reflect on results and plan next steps. Do not call think_tool with the web_search or any other tools. It should be to reflect on the results of the search.**\n</AvailableTools>\n\n<Instructions>\nThink like a human researcher with limited time. Follow these steps:\n\n1. **Read the question carefully** - What specific information does the user need?\n2. **Start with broader searches** - Use broad, comprehensive queries first\n3. **After each search, pause and assess** - Do I have enough to answer? What's still missing?\n4. **Execute narrower searches as you gather information** - Fill in the gaps\n5. **Stop when you can answer confidently** - Don't keep searching for perfection\n</Instructions>\n\n<HardLimits>\n**Tool Call Budgets** (Prevent excessive searching):\n- **Simple queries**: Use 2-3 search tool calls maximum\n- **Complex queries**: Use up to 5 search tool calls maximum\n- **Always stop**: After 5 search tool calls if you cannot find the right sources\n\n**Stop Immediately When**:\n- You can answer the user's question comprehensively\n- You have 3+ relevant examples/sources for the question\n- Your last 2 searches returned similar information\n</HardLimits>\n\n<ShowYourThinking>\nAfter each search tool call, use think_tool to analyze the results:\n- What key information did I find?\n- What's missing?\n- Do I have enough to answer the question comprehensively?\n- Should I search more or provide my answer?\n</ShowYourThinking>\n`;\n\nexport const researcherAgent = agent({\n name: 'researcher_agent',\n model: groq('openai/gpt-oss-20b'),\n prompt: research_system_prompt,\n tools: {\n think_tool: scratchpad_tool,\n browser_search: groq.tools.browserSearch({}),\n },\n});\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,YAAY;AAErB,SAAS,aAAa;AACtB,SAAS,uBAAuB;AAEhC,IAAM,yBAAyB,6GAA4G,oBAAI,KAAK,GAAE,YAAY,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8C5J,IAAM,kBAAkB,MAAM;AAAA,EACnC,MAAM;AAAA,EACN,OAAO,KAAK,oBAAoB;AAAA,EAChC,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,YAAY;AAAA,IACZ,gBAAgB,KAAK,MAAM,cAAc,CAAC,CAAC;AAAA,EAC7C;AACF,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,5 +5,7 @@ export declare const ResearchTopic: z.ZodObject<{
|
|
|
5
5
|
export declare const researchTopicAgent: import("@deepagents/agent").Agent<{
|
|
6
6
|
research_brief: string;
|
|
7
7
|
}, import("@deepagents/agent").ContextVariables, import("@deepagents/agent").ContextVariables>;
|
|
8
|
-
export declare function transformMessagesIntoResearchTopic(userQuery: string): Promise<
|
|
8
|
+
export declare function transformMessagesIntoResearchTopic(userQuery: string): Promise<{
|
|
9
|
+
research_brief: string;
|
|
10
|
+
}>;
|
|
9
11
|
//# sourceMappingURL=research-brief.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research-brief.d.ts","sourceRoot":"","sources":["../../../src/lib/openai-deepresearch/research-brief.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAgCpB,eAAO,MAAM,aAAa;;iBAIxB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;8FAK7B,CAAC;AAEH,wBAAsB,kCAAkC,CAAC,SAAS,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"research-brief.d.ts","sourceRoot":"","sources":["../../../src/lib/openai-deepresearch/research-brief.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAgCpB,eAAO,MAAM,aAAa;;iBAIxB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;8FAK7B,CAAC;AAEH,wBAAsB,kCAAkC,CAAC,SAAS,EAAE,MAAM;;GAYzE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepagents/orchestrator",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@deepagents/agent": "7.0
|
|
42
|
-
"@deepagents/context": "7.0
|
|
41
|
+
"@deepagents/agent": "7.1.0",
|
|
42
|
+
"@deepagents/context": "7.1.0",
|
|
43
43
|
"@ai-sdk/groq": "^4.0.54",
|
|
44
44
|
"@ai-sdk/openai": "^4.0.83",
|
|
45
45
|
"ai": "^7.0.127",
|
|
46
46
|
"zod": "^4.4.3",
|
|
47
47
|
"lodash-es": "^4.18.1",
|
|
48
|
-
"@deepagents/retrieval": "7.0
|
|
49
|
-
"@deepagents/toolbox": "7.0
|
|
48
|
+
"@deepagents/retrieval": "7.1.0",
|
|
49
|
+
"@deepagents/toolbox": "7.1.0",
|
|
50
50
|
"p-limit": "^7.3.0",
|
|
51
51
|
"@tavily/core": "^0.7.6",
|
|
52
52
|
"dedent": "^1.7.2"
|