Expand description
Agent block — one-shot Claude Code spawn driven by an AgentRef
and a per-call task template.
Phase 1.5 PR 2: replaces the original stub
({ response: "[stub]" }) with a real invocation of
agents::runner::run_agent. The runner spawns
claude --print --output-format=stream-json, drains its stdout
through ClaudeTranslator, and produces a structured
AgentRunResult that this function flattens into the
snake_case drone-block output shape.
Block config (node.data):
task— required. Mustache-style template resolved againstscope.outputs + scope.varsbefore spawning.agent_ref— optional. Object matchingAgentRefshape (camelCase keys): identityId, memoryId, instanceName, workingDirectory. All fields optional; missing = blank agent.max_turns— optional. Hard cap on claude turns.
Output (snake_case to match other drone blocks — see spec §4.5):
{
"response": "<text>",
"tokens": { "input": .., "output": .., "cache_creation": .., "cache_read": .. },
"cost_usd": 0.001,
"status": "done"
}Downstream blocks read {{<this_block_id>.response}} for the
agent’s reply and {{<this_block_id>.cost_usd}} for accounting.