golem-fire-and-forget-moonbit

Trigger asynchronous MoonBit Golem agent invocations without waiting for results.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When one Golem agent needs to call another agent, awaiting the result can cause deadlocks (in cyclic calls) or block the caller unnecessarily. This Skill shows how to enqueue agent method invocations in MoonBit that return immediately while the target agent processes the work asynchronously.

Core Features & Use Cases

  • Trigger Methods: Every auto-generated AgentClient method has a trigger_ variant that enqueues the call and returns immediately.
  • Deadlock Breaking: Use trigger_ for callbacks between agents (A calls B, B notifies A) to avoid RPC cycles.
  • Fan-Out and Background Work: Trigger work on many agents in parallel or enqueue background tasks without blocking the current agent.
  • Use Case: An agent processing a batch job needs to notify its caller when done. Instead of awaiting the callback (which would deadlock), it uses client.trigger_on_work_done(result) to fire-and-forget the notification.

Quick Start

Show me how to trigger a fire-and-forget invocation on another Golem agent from my MoonBit agent code using the trigger_ client method.

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

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

FAQPage Schema
How do I trigger a fire-and-forget agent call in MoonBit Golem?

Use the trigger_ variant of any method on the auto-generated AgentClient. Call AgentClient::scoped with the agent name, then invoke client.trigger_method_name(args), which enqueues the invocation and returns immediately without waiting for the result.

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

Use fire-and-forget trigger_ calls for callbacks between agents. If agent A awaits a call to B and B awaits a call back to A, a deadlock occurs; making B's callback a trigger_ invocation breaks the cycle.

What is the difference between trigger_ methods and regular agent client methods?

Regular client methods await the target agent's response and return its result. The trigger_ variants enqueue the invocation and return immediately with no result, letting the target agent process the call asynchronously.

Can I fire-and-forget a Golem agent from the command line?

Yes, use the golem CLI with the --trigger flag, for example: golem agent invoke --trigger 'CounterAgent("my-counter")' increment. This is the CLI equivalent of the in-code trigger_ methods.

When should I not use fire-and-forget agent invocations?

Avoid trigger_ calls when you need the target agent's return value, must confirm the work completed, or depend on ordering guarantees. Fire-and-forget provides no result or completion signal to the caller.