golemcloud/golem/golem-parallel-workers-go
Claude Code and agent skill by golemcloud/golem
- community
Checking that the SKILL.md file is still in the repository.
Fan out work to multiple parallel agents and collect results in a Go Golem project. Use when the user asks about parallel execution, fan-out/fan-in, spawning worker agents for parallel work, or aggregating results from multiple agents in a Go Golem project.
Install
npx vskill@latest install golemcloud/golem/golem-parallel-workers-goSKILL.md
The same SKILL.md was published earlier as golemcloud/golem/golem-parallel-workers-go.
Parallel Workers — Fan-Out / Fan-In (Go)
Overview
A single Golem agent admits invocations sequentially. Within one invocation, goroutines can overlap I/O by interleaving at yield points; this does not promise CPU-thread parallelism. Distribute work across multiple agent instances for independent invocation execution. The Go SDK gives you three building blocks:
- `CallAsync` + `Future.Get` — start several cross-agent calls at once, then await each.
Call/MustCallawait one call at a time per goroutine; calls in separate goroutines can overlap at yield points.CallAsyncreturns immediately, so several calls are in flight together, and a goroutine blocked inFuture.Getyields to the component-model event loop while the others proceed. - `Trigger` + promises — fire-and-forget each worker, hand each a promise ID, then await all the promises. Best for long-running work where you don't want a call in flight the whole time.
- `golem.ForkSelf` — copy the running agent, state included, at the current point; the copy continues as a new agent, with a new agent ID and no key.
Platform contract: a single target instance handles one invocation at a time. Independent invocation execution comes from fanning out to different target instances (distinct keys or agent IDs), not from calling the same instance repeatedly. This does not prohibit goroutine concurrency within one invocation.
Approach 1: async fan-out with CallAsync / Future.Get
Start every worker call with CallAsync, collect the *golem.Future[Out] values in a slice, then Get() (or MustGet()) each. All calls are in flight while you await.
Worker definition (agents/worker/worker.go)
Coordinator fan-out (agents/coordinator/impl/impl.go)
Future.Get returns (Out, error); the error is a *golem.RemoteCallError when the worker failed or could not be reached. MustGet panics with it instead, and the panic traps the component, as in Rust. To keep going when one worker fails, use Get and collect the errors. Model expected per-item outcomes as a golem.Result in the worker method's output, then unwrap or inspect each result:
Approach 2: fire-and-forget with promise collection
For long-running work, Trigger each worker (fire-and-forget, no call held open) and pass each a promise ID; the worker completes its promise when done, and the coordinator awaits them all.
Coordinator
Worker completes its promise
Trigger returns a golem.InvocationMetadata, whose InvocationID identifies the invocation (and an error if the invocation could not be enqueued). It does not wait; a failure after the invocation is accepted is not reported at the trigger site — the worker signals completion (or failure) through its promise.
Approach 3: golem.ForkSelf
golem.ForkSelf copies the running agent at the current point. Both copies continue from there: forked tells them apart, and forkedID is the copy's agent ID on both sides. Synchronize them with a promise:
Fork in a loop for N-way fan-out: each iteration's copy takes slice i and returns, while the original awaits every promise. ForkSelf returns an error (a *golem.AgentOperationError) where the host refuses; MustForkSelf panics instead.
When to use which
| Criteria | CallAsync / Future | Trigger + promises | |
|---|---|---|---|
| Short calls, want results inline | ✅ Best fit | Works but heavier | |
| Long-running work, don't hold a call open | ⚠️ Call stays in flight | ✅ Best fit | |
| Need the invocation identity for other work | Future.Metadata (nil if the call was rejected) | Trigger returns InvocationMetadata | |
| Per-item error as a value | Return golem.Result in the method | Encode outcome in the promise payload | |
| Workers need the current state | Pass it as arguments | Pass it as arguments — or use golem.ForkSelf, whose copy inherits it |
Key Constraints
- Sequential invocation admission is not a synchronization guarantee. Goroutines in one invocation can interleave at RPC, HTTP, stream and promise waits; protect shared mutable state as needed. Use distinct worker instances for independent invocation execution; fanning out to the same durable instance serializes.
- Don't hold a
*golem.Futureacross invocations — start it and collect or cancel it within the same handler. A secondGetreturns the same result. To abandon a result, callCancelbefore collecting it: a laterGetreturnsgolem.ErrCallCancelled. Cancellation is best effort; the remote invocation may already have executed.Cancelafter collection does nothing. Future.Getreturns a remote failure as an error, andPromise.Awaitreturns an error only for a payload that does not decode; theirMustforms panic. Model expected outcomes as agolem.Resultin the method output.- Avoid a synchronous cycle: two agents each blocking in
Call/MustCallon the other deadlocks. Break cycles withTrigger/ promises. - Worker instances persist after the coordinator finishes (they are durable by default); give them stable keys you can address again, or make them ephemeral (see
golem-stateless-agent-go).
Related Skills
| Skill | When to Load | |
|---|---|---|
golem-call-another-agent-go | The synchronous / async call mechanics (Call, CallAsync) | |
golem-fire-and-forget-go | Trigger details for fire-and-forget dispatch | |
golem-wait-for-external-input-go | Promises used to collect worker results | |
golem-multi-instance-agent-go | Address many worker instances by key or agent ID |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggolem-skills/skills/go/golem-parallel-workers-go/SKILL.md
Popularity
- Repository stars
- 1,514
- Repository forks
- 210
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/golemcloud/golem/golem-parallel-workers-go)