Ordered streaming tool execution

From ychampion/cskill-agents · View interactive version

Ordered streaming tool execution is an AI agent skill from the GitHub repository ychampion/cskill-agents. Buffer and execute streaming tool calls with concurrency awareness so results appear in request order even when multiple runners overlap.

How to use this skill

Skill file

SKILL: Ordered Streaming Tool Execution

Domain: tool-orchestration

Trigger: Streaming toolUse input where progress must be shown in the original queue order, even if some tools run concurrently.

Source Pattern: Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.

Core Method

Maintain an ordered queue of tracked tools whose statuses include queued, executing, and completed. When a tool becomes eligible, start it only if no incompatible executor is running (non-concurrency-safe tools block the queue) and mark it executing. Buffer results and progress messages per tool and never yield them until all previous tools have finished; only then append their buffered messages to the output stream in the original order. This preserves a deterministic user view while still allowing safe tools to run in parallel.

Key Rules

Example Application

Implement a streaming tool runner for a conversational agent by streaming helper tasks into the executor, letting concurrency-safe tools run in parallel, and deferring emission until all prior toolUse entries have completed so the transcript matches the request order.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.