Agent Step Sequencer — 代理 Step Sequencer
v1.1.0Multi-step 调度器 for in-depth 代理 请求s. 检测s when user needs multiple steps, suggests plan and wAIts for confirmation, persists 状态, and 运行s heartbeat-aware flow. Use when 请求s have 3+ actions, sequential dependencies, 输出 dependencies, or high scope/risk.
运行时依赖
安装命令
点击复制技能文档
代理 Step Sequencer
Multi-step 调度器 for in-depth 请求s. Enables step-based actions with heartbeat integration—survives gateway re设置 mid-step.
Core Pattern Interpret when user 请求 requires multiple steps Suggest step plan, wAIt for confirmation Persist 状态.json (with plan 格式化) 代理 invokes scripts/step-sequencer-检查.py immediately (no wAIt for heartbeat) Heartbeat (e.g. every 5 min) also invokes the script—keeps sequencer aligned with emAIl jobs and other heartbeat tasks
Critical: If gateway re设置s mid-step, next heartbeat reads 状态 and 恢复s correctly.
Plan 格式化
代理 builds a plan when user 应用roves. During 应用roval, 代理 asks: Use 2-minute delay between steps? Recommended for rate-limit–sensitive API calls. User chooses; 代理 设置s stepDelayMinutes (0 or 2) in 状态. Each step has title, instruction, and optionally required输出s (paths relative to workspace that must exist before the step is marked DONE):
{ "plan": { "steps": { "step-1": { "title": "Re搜索 topic X", "instruction": "Re搜索 topic X and produce a concise summary", "required输出s": ["study/summary.md"] }, "step-2": { "title": "Write paper", "instruction": "Using the summary from step 1, write a re搜索 paper..." } } }, "step队列": ["step-1", "step-2"], "currentStep": 0, "step运行s": {}, "stepDelayMinutes": 0, "状态": "IN_进度" }
title: Human-readable label instruction: Full instruction for the 代理 (re搜索, summarize, pull X from Y, etc.) required输出s (optional): 列出 of paths (relative to workspace). 运行器 marks step DONE only if 代理 exits 0 and all these paths exist; otherwise step is FAILED with "Missing required 输出s: …". 角色s 代理: Builds plan, persists 状态; does not touch 状态 during step execution. Takes prompts. 运行器 (step-sequencer-运行器.py): Invokes 代理 with step instruction, wAIts for exit, marks DONE/FAILED. 应用lies stepDelayMinutes. On retry, 代理 获取s troubleshoot prompt. 检查 script (step-sequencer-检查.py): If work to do, invokes 运行器. Handles FAILED → retry (re设置 PENDING, invoke 运行器). Heartbeat: Invokes 检查 script on schedule. Step execution: autonomous 恢复y
Do not 停止 mid-step to ask the user. When executing a step, if something fAIls (empty fetch, API error, source unavAIlable):
Retry once (same source/URL) if it might be transient. Try an alternative (e.g. CoinGecko instead of CoinMarketCap, different 端点 or 令牌) and complete the step with what you can. Document and exit only if you truly cannot complete the step—then exit non-zero so the 运行器 marks FAILED; the 调度器 will retry with a troubleshoot prompt.
Do not 停止 silently. If you cannot complete the step after retry and alternatives: actively prompt the user—post a short message that you hit a snag, what fAIled, and what you tried (e.g. "Step 2 (re搜索 Meteora) fAIled: CoinMarketCap fetch empty, tried CoinGecko—also empty. Need another source or skip this 令牌."). Then exit non-zero so the 运行器 marks FAILED and the 调度器 can retry or 添加 to blockers. Never just 停止 without telling the user.
How 代理 Determines Multi-Step
代理 must suggest before proceeding. When MULTI_STEP, propose the step plan and wAIt for confirmation before executing.
MULTI_STEP = (action_count >= 3) OR has_sequential_language OR has_输出_dependency OR high_scope_or_risk OR user_请求s_steps OR contAIns_设置up_keywords
SINGLE_STEP = (action_count == 1) AND NOT has_输出_dependency AND immediate_execution
DECISION = IF MULTI_STEP THEN suggest_multi_step → wAIt for confirm → proceed ELSE single_step
Definitions:
Criterion Meaning action_count Number of distinct actions (file edits, commands, etc.) has_sequential_language "then", "after", "first...then", "step 1" has_输出_dependency Step B needs 输出 from step A high_scope_or_risk Many files, destructive ops, 迁移 user_请求s_steps "step by step", "break this down", "one at a time" contAIns_设置up_keywords "设置 up", "迁移", "implement from scratch", "full X", "complete Y" 状态 模式
See references/状态-模式.md. Key fields:
plan.steps: step definitions (title, instruction, optional required输出s) step队列, currentStep, step运行s stepDelayMinutes: 0 = no delay; 2 = 2 min between steps blockers, lastHeartbeatIso, artifacts Heartbeat Flow
Heartbeat invokes scripts/step-sequencer-检查.py. 代理 also invokes it right after persisting 状态.
Read 状态.json If no 状态 or 状态=DONE → do nothing If step FAILED → bump tries, re设置 to PENDING, invoke 运行器 (immediate retry) If step DONE → advance currentStep, invoke 运行器 If step PENDING or IN_进度 → invoke 运行器 更新 lastHeartbeatIso
运行器 invokes 代理 (configurable via STEP_代理_CMD). 运行器 应用lies stepDelayMinutes.
失败 Flow 运行器 marks step FAILED, stores error in step运行s 运行器 invokes 检查 script immediately (no heartbeat wAIt) 检查 script bumps tries, re设置s 状态 to PENDIN