golem-wait-for-external-input-moonbit

Implements durable promise-based suspension for MoonBit agents awaiting external input on Golem.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Agents often need to pause execution until an external event occurs, such as human approval, a webhook callback, or a signal from another agent. This Skill shows how to use Golem promises in a MoonBit project so an agent durably suspends without consuming resources until the promise is completed.

Core Features & Use Cases

  • Promise lifecycle API: Create, await, complete, and poll promises using @api.create_promise, @api.await_promise, @api.complete_promise, and @api.get_promise from the Golem MoonBit SDK.
  • External completion via REST: Expose the PromiseId's agent_id and oplog_idx so external systems can complete the promise through the Golem REST API.
  • Use Case: Build a human-in-the-loop approval workflow where an agent starts an approval, returns the oplog index, and durably waits until a human approves or rejects via an HTTP call.

Quick Start

Ask the AI to implement a MoonBit Golem agent that creates a promise and waits for external approval before continuing its workflow.

Frequently Asked Questions about golem-wait-for-external-input-moonbit

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

FAQPage Schema
How do I wait for external input in a Golem MoonBit agent?

Create a promise with @api.create_promise, pass the promise ID to the external system, then call @api.await_promise with that ID. The Golem runtime durably suspends the agent, consuming no resources, until the promise is completed.

How to complete a Golem promise from an external system?

External systems complete a promise via the Golem REST API by POSTing to /v1/components/{component_id}/workers/{agent_name}/complete with the oplogIdx and byte data. The agent must expose the PromiseId's agent_id and oplog_idx fields for this to work.

Can I poll a Golem promise without blocking the agent?

Yes, use @api.get_promise to obtain a PromiseResult handle, then call subscribe to get a pollable and get to check the current value. The get method returns Some(data) when completed or None when not ready.

What are Golem promises used for in agent workflows?

Golem promises support human-in-the-loop approvals, webhook callbacks, inter-agent synchronization, and external event ingestion. One agent creates and awaits the promise while another agent or external system completes it with a byte payload.

Does awaiting a Golem promise consume compute resources?

No, the Golem runtime durably suspends the agent while it awaits a promise, so it consumes no resources during the wait. Execution resumes automatically once the promise is fulfilled with data.