golem-multi-instance-agent-scala

Creates multiple distinct Golem agent instances in Scala using phantom IDs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

In Golem, an agent is normally identified by its constructor parameters, so calling get with the same values always returns the same instance. This Skill explains how to use phantom agents in Scala to create multiple independent agent instances that share identical constructor parameters, each distinguished by a unique phantom UUID.

Core Features & Use Cases

  • Phantom Agent Creation: Use newPhantom to spawn a fresh independent agent instance with an auto-generated UUID, even when constructor parameters are identical.
  • Phantom Agent Addressing: Use getPhantom with a specific golem.Uuid to reconnect to an existing phantom agent idempotently.
  • Config Variants: Apply getWithConfig, newPhantomWithConfig, and getPhantomWithConfig when agents declare config fields.
  • Use Case: You need several separate counter agents all named "shared" for different user sessions. Call CounterClient.newPhantom("shared") for each session, store the returned phantom UUIDs, and later reconnect with CounterClient.getPhantom("shared", uuid).

Quick Start

Show me how to create and reconnect to phantom agent instances in Scala using newPhantom and getPhantom with the Golem SDK.

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

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 Scala?

Use phantom agents via the generated client object. Call Client.newPhantom(params) to create a new independent instance with an auto-generated UUID, or Client.getPhantom(params, uuid) to address a specific phantom agent by its UUID.

What is the difference between get, getPhantom, and newPhantom in the Golem Scala SDK?

get returns the single durable agent identified by constructor parameters. newPhantom creates a brand new phantom instance with a generated UUID. getPhantom takes the constructor parameters plus a specific phantom UUID as the last argument and is idempotent.

Are phantom agents durable in Golem?

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

Can ephemeral agents use the get method in Golem Scala?

No, ephemeral agents only get getPhantom and newPhantom methods from the code generator. Only durable agents receive the get method, since ephemeral agents have no persistent identity keyed by constructor parameters.

What does a phantom agent ID look like in Golem?

A phantom agent ID appends the phantom UUID in square brackets after the constructor parameters, for example agent-type(param1, param2)[a09f61a8-677a-40ea-9ebe-437a0df51749]. A non-phantom agent ID has no bracket suffix.