release: task tool + ask_user_question + model inheritance (#589)

Merged
SW
5mo ago
+644-29

Summary

  • Port the task (subagent) and ask_user_question composite tools from open-agents
  • Subagent now inherits the parent's model via getSubagentModel(ctx) โ†’ ctx.subagentModel ?? ctx.model, mirroring open-agents' AgentContext shape
  • AgentContext gains model: LanguageModel (required) / subagentModel?: LanguageModel; DurableAgentContext = Omit<AgentContext, "model" | "subagentModel"> is the JSON-serializable shape passed through Vercel Workflow durable inputs
  • runAgentStep constructs callModel = gateway(input.modelId) per-step and attaches it to experimental_context โ€” matches open-agents' prepareCall pattern
  • New getMainModel / getSubagentModel helpers (SRP, one per file) mirror open-agents' tools/utils.ts
  • Bug fix: subagent's streamText was previously called with messages: [] and a system-only prompt, causing NoOutputGeneratedError. Now passes an explicit user-side trigger prompt, matching open-agents

Test plan

  • Unit tests: 3077/3077 pass; lint clean
  • E2E on preview: task tool delegated to subagent, subagent ran bash internally, parent relayed summary, finishReason: "stop"
  • Cross-checked against open-agents production (sandbox.recoupable.com) โ€” same behavior shape, same model-inheritance semantics

๐Ÿค– Generated with Claude Code


Summary by cubic

Adds task subagent delegation and ask_user_question tools, and aligns model handling with open-agents so subagents inherit the parent model. This completes the 11-tool surface and fixes a subagent prompt bug that could throw NoOutputGeneratedError.

  • New Features

    • Added task tool that runs a capped sub-streamText with a curated set of executor tools only (bash, read, write, edit, grep, glob); no recursion or client-side tools.
    • Added ask_user_question tool for UI-driven questions; no server execute, answers are returned on the next turn and summarized via toModelOutput.
    • Subagent model inheritance: AgentContext now includes model: LanguageModel and optional subagentModel; runAgentStep builds the per-step model and attaches it to experimental_context. New getMainModel/getSubagentModel helpers mirror open-agents.
    • Introduced DurableAgentContext for workflow inputs; runAgentStep widens it into full AgentContext. buildAgentTools now registers task and ask_user_question by default; skill remains conditional on discovered skills.
  • Bug Fixes

    • Subagent calls now include an explicit user-side prompt, preventing NoOutputGeneratedError when only a system prompt was provided.