golem-stateless-agent-scala

Creates ephemeral stateless agents in Scala 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-scala
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golem-stateless-agent-scala
Source: https://github.com/golemcloud/golem/tree/main/golem-skills/skills/scala/golem-stateless-agent-scala
Command: npx skills add https://github.com/golemcloud/golem --skill golem-stateless-agent-scala

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building request-handler style agents in Golem often requires no shared state between calls, but the default durable agent mode persists state and replays oplogs. This Skill shows how to define ephemeral agents in Scala that get a fresh instance for every invocation, avoiding unintended state accumulation.

Core Features & Use Cases

  • Ephemeral Agent Definition: Set mode = DurabilityMode.Ephemeral on the @agentDefinition annotation so each invocation constructs a fresh instance with no replay or persistence.
  • HTTP Endpoint Mounting: Combine ephemeral mode with mount paths and @post methods to build stateless REST-style request handlers.
  • Use Case: Imagine you need a stateless string-conversion API. Define an ephemeral ConverterAgent mounted at /api/convert/{name} with toUpper and toLower methods, and every request runs against a brand-new instance with no leftover state.

Quick Start

Create an ephemeral stateless agent in my Scala Golem project that handles HTTP requests without keeping state between calls.

Frequently Asked Questions about golem-stateless-agent-scala

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

FAQPage Schema
How do I create a stateless agent in a Scala Golem project?

Pass mode = DurabilityMode.Ephemeral to the @agentDefinition annotation on your trait, then implement it with @agentImplementation. Each invocation constructs a fresh instance, so field values never carry over between calls.

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

Durable agents (the default) persist state across calls and replay their oplog for recovery. Ephemeral agents create a fresh instance per invocation, never replay the oplog, and discard memory after each call completes.

Can ephemeral Golem agents expose HTTP endpoints?

Yes. Add a mount path like "/api/convert/{name}" to @agentDefinition and annotate methods with @post and @body. Ephemeral agents are a natural fit for stateless HTTP request handlers.

When should I not use ephemeral agents in Golem?

Avoid ephemeral mode for counters, shopping carts, workflow orchestrators, sagas, or any agent where one call depends on a previous call. Those scenarios need durable agents with oplog-based recovery.

Do ephemeral agents still record an oplog in Golem?

Yes, an oplog is recorded lazily and can be inspected via golem agent oplog for debugging. However, it is never replayed, so there is no automatic recovery on failure.