Golem redeploy agents

From golemcloud/golem · View interactive version

Golem redeploy agents is an AI agent skill from the GitHub repository golemcloud/golem. Redeploying existing agents by deleting and recreating them. Use when asked to redeploy agents, reset agent state while keeping the same key, or force agents to start fresh with the latest component version.

How to use this skill

Skill file

Redeploying Existing Agents

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

Overview

Redeploying an agent means deleting it and recreating it from its constructor parameters and stored per-agent environment and local configuration overrides, but using the currently deployed component version. A keyed agent is recreated with its key, so it keeps its agent ID. An agent without a key is recreated from its constructor parameters, env and config with a new agent ID; the old ID no longer reaches it. Defaults come from that component, so effective environment variables and configuration can change. Unlike an in-place update, redeployment destroys the agent's execution state, including its operation log (oplog) and internal WASM state. Guest key-value storage is scoped by environment, bucket, and key, not by the agent lifecycle: redeploy and reset do not clear it. Clean up application KV data separately when a fully clean start is required.

Use redeployment when:

If you need to preserve agent state across component version changes, use update (--update-agents) instead — see the golem-update-running-agents skill.

Method 1: Redeploy During Deploy

The simplest approach — pass --redeploy-agents to golem deploy:

golem deploy --yes --redeploy-agents

This applies deployment changes, if any, and then processes existing durable agents across all components in the resulting deployment, including unchanged components. Redeployment also runs when there is no deployment diff. Ephemeral agents are not enumerated for redeployment.

  1. Lists the durable agents of each deployed component.
  2. Deletes each agent (destroying its oplog and stored state).
  3. Recreates each agent from its constructor parameters and stored per-agent environment and local configuration overrides, using the currently deployed component and its defaults. A keyed agent keeps its agent ID; an agent without a key gets a new agent ID, which the CLI reports (recreatedAgentId in structured output).

Comparison with Other Post-Deploy Flags

| Flag | Behavior |

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

| --redeploy-agents | Delete and recreate agents (loses execution state, retains guest KV data) |

| --update-agents <MODE> | Update agents in-place via oplog replay (auto) or snapshots (manual) — preserves state |

| --reset | Deploy, then delete existing agents of the deployed components; their state is lost, and the environment is retained |

These flags are mutually exclusive — only one can be used at a time; the CLI rejects combining them.

Unlike --redeploy-agents, --reset does not recreate agents; they are created again on invocation. It does not clear domains, HTTP and MCP deployments, secrets, retry policies, plugins, or component revision history. The deployment still reconciles the manifest and can update these resources. Reset also permits incompatible component configuration changes and replacement of incompatible agent secrets.

Method 2: Environment-Level Default

You can configure --redeploy-agents as the default behavior for an environment in the application manifest (golem.yaml). This is useful during development so you don't have to pass the flag every time:

environments:
  local:
    cli:
      redeployAgents: true

With this configuration, every golem deploy targeting the local environment will automatically redeploy agents. Passing --update-agents, --redeploy-agents, or --reset on the command line overrides this setting.

What Gets Preserved

| Aspect | Preserved? |

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

| Key and agent ID of a keyed agent | ✅ Yes |

| Agent ID of an agent without a key | ❌ No — recreated with a new agent ID (recreatedAgentId) |

| Constructor parameters | ✅ Yes |

| Stored per-agent environment overrides | ✅ Yes — effective defaults can change |

| Stored per-agent local configuration overrides | ✅ Yes — effective defaults can change |

| Component configuration defaults | ❌ No — taken from the currently deployed component |

| Component version | ❌ No — upgraded to latest |

| Operation log (oplog) | ❌ No — deleted |

| Internal WASM state | ❌ No — reset |

| Guest KV storage data | ✅ Yes — separate application cleanup is required |

When to Use Redeploy vs. Update vs. Reset

| Scenario | Recommended Approach |

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

| Iterative development, state doesn't matter | --redeploy-agents or --reset |

| Backward-compatible code change, preserve state | --update-agents auto |

| Breaking change with snapshot migration implemented | --update-agents manual |

| Breaking change, no snapshot migration, state expendable | --redeploy-agents |

| Clear existing agent state without recreating agents | --reset |

Example Workflow

# 1. Make code changes to your component

# 2. Deploy and redeploy all agents
golem deploy --yes --redeploy-agents

# 3. Verify agents are running with the new version
golem agent list --component-name my-component

Notes

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.