Golem create agent instance go

From golemcloud/golem · View interactive version

Golem create agent instance go is an AI agent skill from the GitHub repository golemcloud/golem. Creating a new Go Golem agent instance with golem agent create or golem agent upsert. Use when the user asks to create, instantiate, or pre-create an agent without invoking a method in a Go Golem project.

How to use this skill

Skill file

Creating a Go Golem Agent Instance with `golem agent create`

Overview

golem agent create creates a new agent instance without invoking any method on it. The agent is initialized with its constructor parameters and starts in an idle state, ready to receive invocations. The command prints the new agent's agent ID, a UUID that Golem issues.

golem agent upsert gets the keyed agent of the constructor parameters and creates it when it does not exist. It takes no environment variables or configuration.

golem agent invoke with a key also creates the keyed agent on first call. Use golem agent create when you need to set environment variables or configuration at creation time, or when you want an agent without a key.

Both golem and golem-cli can be used — every command below works with either binary.

Steps

  1. Identify the agent by its type name and constructor parameters (CounterAgent("my-counter")).
  2. Choose keyed or not — --keyed — and any creation-time settings — --env, --config — if needed.
  3. Run golem agent create to pre-create the instance (or golem agent upsert for the keyed agent without settings).
  4. Invoke it later with golem agent invoke: by its key for a keyed agent, or by the printed agent ID ('CounterAgent[<agent-id>]') for an agent without a key.

Usage

golem agent create <AGENT_KEY> [--keyed] [OPTIONS]
golem agent upsert <AGENT_KEY>

Agent Key Format

Both commands take a key: the agent type and its constructor parameters:

AgentTypeName(param1, param2, ...)

For a Go agent, the constructor parameters are the fields of its ID struct in declaration order. CounterAgent's ID is struct{ Name string }, so its key is CounterAgent("my-counter"). For an agent whose ID has no fields (a singleton), use empty parentheses: AgentTypeName().

The key can optionally be prefixed with environment or application paths:

| Format | Description |

|--------|-------------|

| AgentTypeName(params) | Key without a prefix |

| env/AgentTypeName(params) | Environment-specific |

| app/env/AgentTypeName(params) | Application and environment-specific |

| account/app/env/AgentTypeName(params) | Account, application, and environment-specific |

Examples

Create an agent without a key

golem agent create 'CounterAgent("my-counter")'
# Invoke it by the agent ID that the command prints
golem agent invoke 'CounterAgent[<agent-id>]' increment

Create the keyed agent

golem agent create --keyed 'CounterAgent("my-counter")'
# Invoke it by its key
golem agent invoke 'CounterAgent("my-counter")' increment

Get or create the keyed agent

golem agent upsert 'CounterAgent("my-counter")'

Create a singleton agent (no constructor parameters)

golem agent create --keyed 'CounterAgent()'

Retry a create safely

# The same idempotency key returns the agent of the first create
golem agent create -i create-42 'CounterAgent("my-counter")'

Create an agent with environment variables

golem agent create 'CounterAgent("my-counter")' --env API_KEY=sk-abc123 --env LOG_LEVEL=debug

Create an agent with configuration

golem agent create 'CounterAgent("my-counter")' --config max_retries=5 --config timeout_seconds=30

Create an agent in a specific environment

golem agent create 'staging/CounterAgent("my-counter")'

Combine environment variables and configuration

golem agent create --keyed 'CounterAgent("my-counter")' \
  --env DATABASE_URL=postgres://... \
  --config batch_size=100 \
  --config retry_policy.max_attempts=3

Available Options

The options of golem agent create (golem agent upsert takes none):

| Option | Description |

|--------|-------------|

| --keyed | Create the keyed agent of the constructor parameters; fail when it already exists |

| -i, --idempotency-key <KEY> | Idempotency key of the create; a create retried with the same key returns the agent of the first create |

| -e, --env <ENV=VAL> | Environment variables visible to the agent (can be repeated) |

| -c, --config <PATH=VALUE> | Configuration entries for the agent, using dot-separated paths (can be repeated). Only configuration declared by the agent can be provided. If not provided, the default from the manifest (agents.*.config) is used. |

When to Use `golem agent create` vs `golem agent invoke`

Value Syntax

Key parameters use Go syntax, read against the agent's schema:

For example: golem agent invoke 'ShelfAgent({zone: "a", level: 2}, closed, {"x"})' describe '"fragile"' '{ "k" => 2 }'.

Key Constraints

Related Skills

| Skill | When to Load |

|-------|--------------|

| golem-invoke-agent-go | Invoke a method on the agent (creates it if absent) |

| golem-trigger-agent-go | Fire-and-forget invocation from the CLI |

| golem-add-agent-go | Define the agent, its ID, and its methods |

| golem-multi-instance-agent-go | Address many instances of an agent by ID |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.