diff --git a/app/test/e2e/specs/chat-harness-subagent.spec.ts b/app/test/e2e/specs/chat-harness-subagent.spec.ts index a63df08bc..5b95df662 100644 --- a/app/test/e2e/specs/chat-harness-subagent.spec.ts +++ b/app/test/e2e/specs/chat-harness-subagent.spec.ts @@ -3,17 +3,17 @@ * * The default chat agent after onboarding is the **orchestrator** * (`src/openhuman/channels/providers/web.rs::pick_target_agent_id`). - * Its `subagents = [...]` list synthesises one `delegate_` tool per - * archetype at build time (see + * Its `subagents = [...]` list synthesises one delegated archetype tool + * per archetype at build time (see * `src/openhuman/tools/orchestrator_tools.rs`). When the LLM calls - * `delegate_researcher` (or any other `delegate_*`), the tool dispatches + * `research` (or any other delegated archetype tool), the tool dispatches * to a sub-agent which runs the agent harness loop a level deeper — * which means the LLM gets hit at least once more for the sub-agent. * * What this spec scripts and verifies: * * 1. Configure `llmForcedResponses` with THREE responses in order: - * A) orchestrator turn — emits `delegate_researcher` tool_call + * A) orchestrator turn — emits `research` tool_call * B) researcher turn — answers with a plain text finding * C) orchestrator turn — final synthesis text (canary marker) * @@ -56,13 +56,13 @@ const RESEARCHER_REPLY = 'The researcher answer is 42.'; // Three forced responses, popped in order by the mock LLM streamer. const FORCED_RESPONSES = [ - // 1. Orchestrator: emit a delegate_researcher tool call. + // 1. Orchestrator: emit a research tool call. { content: '', toolCalls: [ { - id: 'call_delegate_researcher_1', - name: 'delegate_researcher', + id: 'call_research_1', + name: 'research', arguments: JSON.stringify({ prompt: 'Tell me a marker phrase' }), }, ], diff --git a/src/openhuman/agent/agents/orchestrator/prompt.md b/src/openhuman/agent/agents/orchestrator/prompt.md index c07e521d1..95eb36ba0 100644 --- a/src/openhuman/agent/agents/orchestrator/prompt.md +++ b/src/openhuman/agent/agents/orchestrator/prompt.md @@ -28,7 +28,8 @@ Follow this sequence for every user message: 4. **Does this need other specialised execution?** - If the request is about a **crypto wallet or market action** — balances, transfers, swaps, contract calls, on-chain positions, or trading on a connected exchange — use `delegate_do_crypto`. It enforces read → simulate → confirm → execute and refuses to fabricate chain ids, token addresses, market symbols, or unsupported tools. **Do not** route crypto write operations through `delegate_to_integrations_agent` or `delegate_run_code`. - If code writing/execution/debugging is required, use `delegate_run_code`. - - If web/doc crawling is required, use `delegate_researcher`. + - If web/doc crawling is required, use `research`. + - If the user asks for live/current/time-sensitive facts that are not covered by a direct tool — weather, forecasts, current temperatures, recent news, fresh web facts, or "use Grok/web/live data" — call `research` with a prompt that asks for live sources. Do **not** stop at "on it", and do **not** wait for the exact named provider if it is not wired in. Use the available research tool and then answer with the result. - If complex multi-step decomposition is required, use `delegate_plan`. - If code review is requested, use `delegate_critic`. - If memory archiving or distillation is required, use `delegate_archivist`. diff --git a/src/openhuman/agent/agents/orchestrator/prompt.rs b/src/openhuman/agent/agents/orchestrator/prompt.rs index 874ee2718..ccc224a36 100644 --- a/src/openhuman/agent/agents/orchestrator/prompt.rs +++ b/src/openhuman/agent/agents/orchestrator/prompt.rs @@ -216,6 +216,19 @@ mod tests { assert!(body.contains("Do this even if `memory_tree` could plausibly answer")); } + #[test] + fn build_routes_live_facts_to_research_tool() { + let body = build(&ctx_with(&[])).unwrap(); + assert!(body.contains("use `research`")); + assert!(body.contains("weather, forecasts, current temperatures")); + assert!(body.contains("\"use Grok/web/live data\"")); + assert!(body.contains("Do **not** stop at \"on it\"")); + assert!( + !body.contains("delegate_researcher"), + "orchestrator prompt should name the synthesized researcher tool" + ); + } + #[test] fn build_emits_delegation_guide_with_collapsed_tool() { let integrations = vec![ConnectedIntegration {