Concurrent tool dispatch with execution gating #708
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#708
Reference in new issue
Block a user
Implement concurrent tool dispatch with execution gating classes: never-parallel (e.g. state mutators), parallel-safe (e.g. read-only tools), and path-scoped (same-path tools are serialized, different paths run in parallel). Use sync primitives and a gating engine to classify and schedule tool invocations correctly.
Notes
Investigation 2026-10-25. No loop runs tools in parallel: MaxParallelToolCalls is unset in chat_runtime.go:143 and curators.go:141, and ai-sdk agentloop.Config has no parallelism field (modelloop/loop_runner.go:76). Design: (1) ai-sdk core.Tool gets Concurrency func(input)(exclusive bool, key string); nil means exclusive. executeToolCalls blocks spawns on an exclusive call and chains calls by key, which keeps the model's order for conflicting calls. (2) ai-sdk agentloop: add MaxParallelToolCalls to Config; mutex on runState/loopState (finishCalled, recordChange map, loopbreak); set Concurrency on its builtins. (3) archie: modelloop.BuildToolSetFrom maps idempotent to parallel, mutating with a path to keyed, anything else to exclusive. ask_user, ask_questions and bridge tool_call become exclusive (Telegram tracks one pending reply per chat). MCP tools take ClassIdempotent from readOnlyHint. Lock captureToolSet and memoryNotes. Set the limit in all three loops and bump ai-sdk. MutationQueue and MCP callMu stay. Roughly 120 lines in total.
2026-10-25: implemented. ai-sdk fdeeb8b (local, unpushed): Tool.Concurrency plus executor gating, agentloop MaxParallelToolCalls, locks and built-in declarations. archie (uncommitted, gate green against local ai-sdk via go.work): classification mapped to concurrency in BuildToolSetFrom, limit 8 in chat/curator/container loops, ask_user/ask_questions/tool_call mutating, MCP readOnlyHint maps to idempotent. Blocked on an ai-sdk release tag.
Close reason
ai-sdk v0.4.0 (Tool.Concurrency, agentloop parallelism) + archie
5f3cceb9: classification-driven parallel tool calls in chat, curator and container loops.Imported from beads
archie-core-1786637494585-183-63b2b2a2· GitHub #204 · type task · priority P2 · created 2026-08-08 · closed 2026-10-25