golem-fire-and-forget-scala

Triggers asynchronous agent method invocations in Scala Golem projects without awaiting results.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Awaited agent-to-agent calls in Golem can block execution or cause deadlocks when agents call each other cyclically. This Skill shows how to enqueue agent method invocations that return immediately, letting the target agent process work asynchronously.

Core Features & Use Cases

  • Fire-and-Forget Invocation: Uses the .trigger() method on per-method client wrappers to enqueue calls without waiting for results.
  • Deadlock Prevention: Breaks RPC cycles when agent A calls agent B and B needs to call back into A.
  • Fan-Out and Background Work: Trigger work on many agents in parallel or enqueue background tasks without blocking the caller.
  • CLI Equivalent: Supports golem agent invoke --trigger for command-line fire-and-forget calls.
  • Use Case: A data pipeline agent needs to notify a monitoring agent when a batch finishes. Instead of awaiting the notification (which risks a deadlock if the monitor calls back), it uses .trigger() to enqueue the notification and continue processing.

Quick Start

Show me how to make a fire-and-forget call to another agent from my Scala Golem agent using the trigger method.

Frequently Asked Questions about golem-fire-and-forget-scala

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

FAQPage Schema
How do I make a fire-and-forget agent call in Scala Golem?

Call the .trigger() method on a per-method wrapper of the generated agent client, for example counter.increment.trigger(). This enqueues the invocation on the target agent and returns immediately without awaiting the result.

How do I avoid deadlocks when Golem agents call each other?

Use .trigger() for the callback leg of a cyclic call. If agent A awaits a call to agent B, and B needs to notify A, B should use a fire-and-forget trigger back to A instead of an awaited call, which would deadlock.

Can I trigger a Golem agent invocation from the command line?

Yes, use golem agent invoke with the --trigger flag, passing the agent instance and the fully qualified method name. This enqueues the invocation asynchronously just like the Scala .trigger() API.

When should I not use fire-and-forget invocation in Golem?

Avoid fire-and-forget when the caller needs the return value or must confirm the invocation succeeded, since .trigger() returns immediately with no result. Use a normal awaited call when the response data drives subsequent logic.

Does fire-and-forget work with method arguments in Scala Golem agents?

Yes, pass arguments directly to the trigger call, such as processor.processBatch.trigger(batchData). The arguments are serialized with the enqueued invocation and delivered to the target agent for asynchronous processing.