# molted agents

Source: https://molted.email/docs/cli/agents

Multi-agent coordination

| Command | Description |
| - | - |
| [`molted agents register`](#molted-agents-register) | Register an agent |
| [`molted agents heartbeat`](#molted-agents-heartbeat) | Send agent heartbeat |
| [`molted agents lease`](#molted-agents-lease) | Acquire a resource lease |
| [`molted agents release-lease`](#molted-agents-release-lease) | Release a resource lease |
| [`molted agents leases`](#molted-agents-leases) | List active leases |
| [`molted agents consensus create`](#molted-agents-consensus-create) | Create a consensus request |
| [`molted agents consensus get`](#molted-agents-consensus-get) | Get consensus request details |
| [`molted agents consensus vote`](#molted-agents-consensus-vote) | Vote on a consensus request |
| [`molted agents config`](#molted-agents-config) | Get agent config |
| [`molted agents update-config`](#molted-agents-update-config) | Update agent config (humanizer\_enabled, humanizer\_style) |

## Agent context

The agents system enables multiple AI agents to coordinate within a single tenant. It provides registration, heartbeats, resource leasing, consensus voting, and per-agent configuration.

### Register your agent (run once at startup)

```bash
molted agents register --agent-name "outreach-agent" --agent-role outbound \
  --metadata '{"version": "1.0", "owner": "team-a"}'
# → { "id": "agent_...", ..., "apiKeyBinding": "bound" }
# By default this binds your API key to the new agent (#1945), so
# 'molted agents update-config' for this agent applies to this key's sends.
# Binding is PERMANENT for a key: apiKeyBinding is "already_bound" on a
# re-register, "bound_to_other_agent" if this key is already bound
# elsewhere, or "agent_has_other_key" if a different key already answers
# for this agent -- in either case nothing is re-pointed, a warning prints
# on stderr, and the command still exits 0 (registration itself succeeded).
# To use a different agent, register a new API key. "not_requested" is
# --no-bind-key; "not_applicable" means there was no API key to bind.
```

### Send heartbeats (run periodically to signal liveness)

```bash
molted agents heartbeat --agent-id <id>
molted agents heartbeat --agent-name "outreach-agent"
# → { "ok": true }
# Only agents with a heartbeat (or register) in the last 5 minutes count
# toward a consensus majority (more than half of them, at least one vote).
```

Resource leasing (prevent two agents from working on the same contact):

```bash
molted agents lease --agent-id <id> --contact-email alice@example.com \
  --intent outbound_sales --duration 30
# → { "id": "<uuid>", "agentId": "agent_...", "contactEmail": "alice@example.com",
#     "intent": "outbound_sales", "expiresAt": "...", ... }
# → if another agent holds the lease (still a success response):
#   { "conflict": true, "leaseHolder": { "agentId": "...", "agentName": "...", "expiresAt": "..." } }
# Leasing again with the same agent extends its lease.

molted agents release-lease <leaseId>     # release early when done → { "released": true }
molted agents leases                       # list all active leases
```

### Consensus voting (multi-agent decisions)

```bash
molted agents consensus create --agent-id <id> --action "pause campaign" \
  --contact-email ceo@bigcorp.com --reason "Fatigue scores are high"
# → { "id": "<uuid>", "action": "pause campaign", "status": "pending", "timeoutAt": "...", ... }

molted agents consensus get <consensusId>
# → { "id": "<uuid>", "action": "pause campaign", "status": "pending", ... }

molted agents consensus vote <consensusId> \
  --agent-id <id> --vote "approve" --reason "Agreed"
# → { "id": "<uuid>", "vote": "approve", "consensusStatus": "pending", ... }
# consensusStatus turns "approved" or "rejected" once that side has votes from
# a strict majority of the active agents (more than half, at least one vote)
# and outnumbers the other side; an exact tie stays "pending". A key bound
# to an agent can only vote, lease and heartbeat as that agent (403
# agent_mismatch otherwise). A second vote from the same agent replaces its first.
# A vote counts as the voter's heartbeat, so a registered agent that votes is
# active. With no registered active agent, an approve stays pending (it is
# recorded, and the request waits until it expires) while a reject still rejects.
# A request still pending at timeoutAt turns "expired" within about 15 minutes
# (a background sweep). Statuses: pending, approved, rejected, expired.
# A vote on a decided or expired request, or past timeoutAt, is refused with
# 409 consensus_closed and not recorded.
```

Per-agent configuration (humanizer settings only; overrides the account's):

```bash
molted agents config <agentId>
molted agents update-config <agentId> --config '{"humanizer_enabled": false}'
# Keys: humanizer_enabled, humanizer_style (others are dropped; a config with
# no known key fails). Merged into the stored config. Turning the humanizer off
# is always allowed; any other change is a human decision (human gate), and
# turning it on needs a plan that includes it.
```

Related: [`molted adopt`](https://molted.email/docs/cli/adopt.md), [`molted overrides`](https://molted.email/docs/cli/overrides.md), [`molted send`](https://molted.email/docs/cli/send.md)

## Commands

### molted agents register

Register an agent

```bash
molted agents register [options]
```

| Option | Description | Default |
| - | - | - |
| `--agent-name <name>` | Agent name (required) (required) | |
| `--agent-role <role>` | Agent role (e.g. outbound, inbound, classifier; default general) | |
| `--metadata <json>` | Agent metadata (JSON object; accepted but not stored by the server today) | |
| `--no-bind-key` | Do not bind this API key to the newly registered agent (bound by default, #1945) | |

### molted agents heartbeat

Send agent heartbeat

```bash
molted agents heartbeat [options]
```

| Option | Description | Default |
| - | - | - |
| `--agent-id <id>` | Agent ID | |
| `--agent-name <name>` | Agent name (resolved to ID server-side) | |

### molted agents lease

Acquire a resource lease

```bash
molted agents lease [options]
```

| Option | Description | Default |
| - | - | - |
| `--agent-id <id>` | Agent ID | |
| `--agent-name <name>` | Agent name (resolved to ID server-side) | |
| `--contact-email <email>` | Contact email for the lease (required) (required) | |
| `--intent <intent>` | Lease intent (e.g. outbound\_sales; default general) | |
| `--duration <minutes>` | Lease duration in minutes (default 30) | |

### molted agents release-lease

Release a resource lease

```bash
molted agents release-lease <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | | yes |

### molted agents leases

List active leases

```bash
molted agents leases
```

### molted agents consensus create

Create a consensus request

```bash
molted agents consensus create [options]
```

| Option | Description | Default |
| - | - | - |
| `--agent-id <id>` | Requesting agent ID | |
| `--agent-name <name>` | Requesting agent name (resolved to ID server-side) | |
| `--action <action>` | Proposed action (required) (required) | |
| `--contact-email <email>` | Contact email (required) (required) | |
| `--reason <reason>` | Reason for the request (required) (required) | |
| `--timeout <minutes>` | Minutes until the request's timeoutAt (default 5); a still-pending request turns expired within about 15 minutes after it | |

### molted agents consensus get

Get consensus request details

```bash
molted agents consensus get <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | | yes |

### molted agents consensus vote

Vote on a consensus request

```bash
molted agents consensus vote [options] <id>
```

| Argument | Description | Required |
| - | - | - |
| `<id>` | | yes |

| Option | Description | Default |
| - | - | - |
| `--agent-id <id>` | Voting agent ID (required) (required) | |
| `--vote <option>` | Your vote (approve or reject) (required) (required) | |
| `--reason <reason>` | Reason for vote | |

### molted agents config

Get agent config

```bash
molted agents config <agentId>
```

| Argument | Description | Required |
| - | - | - |
| `<agentId>` | | yes |

### molted agents update-config

Update agent config (humanizer\_enabled, humanizer\_style)

```bash
molted agents update-config [options] <agentId>
```

| Argument | Description | Required |
| - | - | - |
| `<agentId>` | | yes |

| Option | Description | Default |
| - | - | - |
| `--config <json>` | Config object (JSON) (required) (required) | |

See [CLI overview](https://molted.email/docs/cli.md) for global options, credentials and output format.
