golem-parallel-workers-rust

Implements fan-out and fan-in parallel execution across Golem agents in Rust.

1.5k|212|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill golem-parallel-workers-rust
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-parallel-workers-rust
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/rust/golem-parallel-workers-rust
Command: npx skills add https://github.com/golemcloud/golem --skill golem-parallel-workers-rust

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires futures-concurrency, golem-rust.

What problem does it solve?

Golem agents process invocations sequentially, so a single agent cannot run work in parallel. This Skill shows how to distribute concurrent work across multiple agent instances in a Rust Golem project and aggregate the results.

Core Features & Use Cases

  • Child Agent Fan-Out: Spawn child agents via AgentClient::get(id), dispatch work concurrently, and collect results using Join or TryJoin from the futures-concurrency crate.
  • Promise-Based Coordination: Trigger fire-and-forget child agents and collect results asynchronously through Golem promises with create_promise, await_promise, and complete_promise.
  • Fork-Based Parallelism: Clone the current agent with fork() so forked copies inherit state, then synchronize via promises for multi-way parallel execution.
  • Error Handling Strategies: Short-circuit on the first failure with TryJoin, or collect partial successes and failures per item with Join.
  • Use Case: A coordinator agent receives a list of regions, spawns one worker agent per region to generate reports in parallel, and returns the combined results to the caller.

Quick Start

Ask the AI to implement a fan-out pattern in your Rust Golem project that spawns child agents for each work item and collects their results concurrently.

Frequently Asked Questions about golem-parallel-workers-rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run work in parallel across Golem agents in Rust?

Spawn child agents with AgentClient::get(id), build a Vec of async futures calling each child, and await them concurrently with futures.join().await from the futures-concurrency crate. A single Golem agent executes sequentially, so parallelism requires multiple agent instances.

What is the difference between child agents and fork() in Golem?

Child agents have persistent identities and independent state, making them ideal for independent stateless work. fork() clones the current agent with its existing state into an ephemeral phantom instance, which suits parallel work that needs shared starting state.

How do I collect results from fire-and-forget Golem agents?

Create one Golem promise per child with create_promise, pass each promise ID to the triggered child, and have children call complete_promise with their results. The coordinator then awaits all promises concurrently with await_promise inside futures.join().

Should I use Join or TryJoin for parallel agent calls?

Use TryJoin when any child failure should cancel the remaining work and return an error immediately. Use Join with per-future error wrapping when you want partial results, collecting successes and failures separately so one failure does not abort siblings.

Why do Golem agents deadlock when calling each other?

Deadlocks occur when two agents synchronously await each other's results in a cycle. Break cycles by using fire-and-forget trigger_ methods combined with promises, so neither agent blocks waiting on the other.