golem-multi-instance-agent-moonbit

Create multiple independent MoonBit agent instances sharing constructor parameters using phantom UUIDs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

In Golem, an agent is uniquely identified by its constructor parameters, so calling get with the same parameters always returns the same instance. This Skill explains how to use phantom agents in MoonBit to create multiple fully independent, durable agent instances that share identical constructor parameters, distinguished by an extra phantom UUID.

Core Features & Use Cases

  • Phantom Instance Creation: Use the generated client methods new_phantom, get_phantom, and their scoped and with_config variants to create or reconnect to phantom agents.
  • Phantom ID Management: Retrieve an agent's phantom UUID via the phantom_id() method and reconnect later with get_phantom, which is idempotent for the same UUID and parameters.
  • HTTP-Mounted Phantom Agents: Set mount_phantom to true so every incoming HTTP request is handled by a fresh phantom instance.
  • Use Case: A chat application needs a separate Counter agent per user session even though all sessions use the same name parameter; new_phantom creates an isolated instance per session while get_phantom reconnects to it later.

Quick Start

Show me how to create and reconnect to phantom agent instances in MoonBit using the generated client methods.

Frequently Asked Questions about golem-multi-instance-agent-moonbit

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

FAQPage Schema
How do I create multiple agent instances with the same parameters in Golem MoonBit?

Use the generated client method new_phantom, which appends a random phantom UUID to the agent identity. Each call creates a distinct durable instance even when constructor parameters are identical, and get_phantom reconnects using a known UUID.

What is a phantom agent in Golem?

A phantom agent is a Golem agent whose identity includes an extra phantom UUID appended in square brackets, like agent-type(param)[uuid]. This lets many independent instances share the same constructor parameters without sharing state.

How do I reconnect to an existing phantom agent in MoonBit?

Call phantom_id() on the client to get its UUID, then use get_phantom with the same parameters and that UUID. The call is idempotent, so the same UUID and parameters always return the same agent.

Can HTTP requests create a new phantom agent instance automatically?

Yes. Set mount_phantom to true on an HTTP-mounted agent so every incoming request is handled by a fresh phantom instance with its own UUID, even when all instances share the same constructor parameters.

Do phantom agents share state with non-phantom agents?

No. Phantom and non-phantom agents with the same constructor parameters are different agents and do not share state. Phantom agents are fully durable and persist just like regular agents.

When should I use scoped phantom client variants in MoonBit?

Use scoped, scoped_new_phantom, or scoped_get_phantom when you want the client to call drop() automatically after the closure completes. This avoids manually managing client lifecycle for short-lived interactions.