golem-stateless-agent-moonbit

Creates ephemeral stateless agents in MoonBit Golem projects with fresh instances per invocation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building request-handler style agents in Golem requires understanding when to avoid durable state. This Skill guides you through creating ephemeral agents in MoonBit that get a fresh instance for every invocation, eliminating shared state, replay, and persistence overhead for stateless workloads.

Core Features & Use Cases

  • Ephemeral Agent Declaration: Use #derive.agent("ephemeral") instead of the default durable derive to mark an agent type as stateless.
  • Fresh Instance Semantics: Each invocation calls new(), executes the method, and discards the instance, so counters and fields never accumulate across calls.
  • Use Case: Build a stateless HTTP API adapter or data transformation service in MoonBit where every request is independent, such as a validation service or webhook forwarder that needs no memory of previous calls.

Quick Start

Create an ephemeral stateless agent in my MoonBit Golem project that handles string requests without persisting any state between calls.

Frequently Asked Questions about golem-stateless-agent-moonbit

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

FAQPage Schema
How do I create a stateless agent in MoonBit for Golem?

Use #derive.agent("ephemeral") on your struct instead of the default #derive.agent. Each invocation then calls new() to create a fresh instance, executes the method, and discards the instance entirely.

What is the difference between durable and ephemeral agents in Golem?

Durable agents persist state across calls and replay their oplog for recovery, while ephemeral agents get a fresh instance per invocation with no replay or persistence. An ephemeral counter returns 1 on every increment call instead of accumulating.

When should I use ephemeral agents instead of durable agents?

Use ephemeral agents for stateless HTTP APIs, data transformation, validation services, and webhook forwarding where calls are independent. Avoid them for counters, shopping carts, workflow orchestrators, or any logic depending on previous calls.

Can ephemeral Golem agents still call other agents or make HTTP requests?

Yes, ephemeral agents can call other agents via RPC, make HTTP requests, and use all Golem APIs. Only the state persistence and replay behavior changes; the identity model based on constructor parameters remains the same.

Why does my ephemeral agent lose field values between invocations?

That is the intended behavior: ephemeral agents discard memory after each invocation completes, so every call starts from a clean new() constructor. If you need state across calls, switch to the default durable agent mode.