Golem create agent instance effect

From golemcloud/golem · View interactive version

Golem create agent instance effect is an AI agent skill from the GitHub repository golemcloud/golem. Pre-creating Effect-based Golem agent instances with golem agent create or golem agent upsert. Use when asked to create, instantiate, or initialize an agent without invoking a method.

How to use this skill

Skill file

Creating an Effect Golem Agent Instance with `golem agent create`

Both golem and golem-cli can be used — all commands below work with either binary.

Usage

golem agent create <AGENT_TYPE>(<PARAMETERS>) [--keyed] [OPTIONS]
golem agent upsert <AGENT_TYPE>(<PARAMETERS>)

golem agent create creates a new agent instance without invoking any method on it. The agent

is initialized with its agent id fields and starts idle, ready to receive invocations. The command

prints the new agent's agent ID (a UUID that Golem issues) and fingerprint. If the agent's

component has not been deployed and the CLI is run from an application directory, the command

automatically builds and deploys the component first.

same agent id fields. Only its agent ID reaches it later.

addresses later. It fails when that keyed agent already exists.

golem agent upsert gets the keyed agent of the agent id fields, and creates it when it does not

exist. It takes no environment variables or configuration.

Unlike golem agent invoke, which implicitly creates the keyed agent on its first call,

golem agent create explicitly pre-creates it. Use this when environment variables or typed

configuration must be supplied before any invocation.

Inside a component, the programmatic equivalent is the typed client's `create(input, { keyed,

config, env }); see golem-multi-instance-agent-effect`.

Agent Addresses

AgentTypeName(params) is the agent's key: it addresses the keyed agent of the agent type and its

agent id fields:

AgentTypeName(param1, param2, ...)

For an Effect agent declared with defineAgent, use the exact name string as AgentTypeName and

pass values in the declaration order of id. Do not infer the type name from the

exported TypeScript constant, filename, or description, and do not append an Agent suffix unless

it is present in name.

For example, this declaration is addressed as Counter("c1"), not CounterAgent("c1"):

export const Counter = defineAgent({
  name: "Counter",
  id: { name: Schema.String },
  // ...
});

Before creating an instance, inspect the agent's defineAgent declaration or discover deployed

constructors with golem agent-type list and golem agent-type get <AGENT_TYPE>. If the CLI reports

that a type is not found, use the exact name from its list of available deployed constructors.

AgentTypeName[<agent-id>] and a bare <agent-id> address an agent by its agent ID. Every form

can optionally be prefixed with environment or application paths:

| Format | Description |

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

| AgentTypeName(params) | Keyed agent |

| AgentTypeName[<agent-id>] or <agent-id> | Agent by its ID |

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

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

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

For agents with no agent id fields, use empty parentheses: AgentTypeName().

Examples

Create an agent with no agent id fields

golem agent create 'MyAgent()'

Create the keyed agent of agent id fields

golem agent create --keyed 'Counter("c1")'

Get or create the keyed agent

golem agent upsert 'Counter("c1")'

Create an agent with environment variables

golem agent create 'MyAgent("user-123")' --env API_KEY=[REDACTED:api-key] --env LOG_LEVEL=debug

Create an agent with configuration

golem agent create 'MyAgent()' --config maxRetries=5 --config timeoutSeconds=30

Create an agent in a specific environment

golem agent create 'staging/MyAgent("user-123")'

Combine environment variables and configuration

golem agent create 'OrderProcessor("us-east")' \
  --env DATABASE_URL=postgres://... \
  --config batchSize=100 \
  --config retryPolicy.maxAttempts=3

Available Options

| Option | Description |

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

| --keyed | Create the keyed agent of the agent id fields; fails 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> | Typed configuration entries using dot-separated paths (can be repeated). Only configuration declared by the agent can be provided. If omitted, defaults come from agents.*.config in the manifest. |

Auto-Deploy

When run from an application directory, golem agent create automatically builds and deploys an

agent component that has not been deployed yet.

Verify Creation Without Invoking a Method

Use golem agent get with the key of a keyed agent, or with the agent ID that create printed,

to verify that the pre-created instance exists:

golem agent get 'Counter("c1")'

A successful metadata lookup verifies existence without calling an agent method. Do not require a

particular textual entry from golem agent oplog: pre-creation does not guarantee that the CLI's

rendered oplog contains a create line.

Effect CLI Value Syntax

Effect components are reported as TypeScript source, so constructor values use **TypeScript

syntax**, even though the agent implementation uses Effect Schema:

golem agent create 'UserManager({ region: "us-east", maxConnections: 10 })'

These are CLI expressions, not in-process Effect values. Do not put Option.some(...),

Result.succeed(...), or an Effect Schema tagged-union object into the shell command.

Quote agent addresses containing parentheses, strings, objects, or spaces so the shell passes the entire

ID as one argument.

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

configuration before any invocation.

automatically on first invocation if it does not exist.

created without --keyed by the agent ID that create printed:

golem agent invoke 'AgentTypeName[<agent-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.