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.