---
title: "alpacon event"
description: "Watch Alpacon events or wait for one outcome from the CLI. Choose an event type and target, understand reconnect behavior, and find the right event command."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# alpacon event

Watch Alpacon events or wait for a specific outcome.

## Usage

`alpacon event [command]`

## Key facts

- Use `watch` for a continuous stream and `wait` for one outcome.
- Select an event type with `--type` on either subcommand.
- No past events are replayed; events during a disconnected period can be lost.
- `events` is an alias for `event`.

## Flags

Running `alpacon event` alone shows its help. To list recent command executions, use [`alpacon exec ls`](/reference/cli/exec/#exec-ls). The inherited `--output` flag is also available on `watch` and `wait`.

| Flag | Type | Description | Default |
| --- | --- | --- | --- |
| `-h, --help` | `bool` | help for event | `false` |
| `--output` | `string` | Output format: table or json | `table` |

## Examples

Watch notifications

```bash
alpacon event watch --type notification
```

Wait for a work session

```bash
alpacon event wait --type work_session --target a1b2c3d4-5678-abcd-ef01-234567890abc
```

## What the event channel is

Some things in Alpacon take a while: a work session waits for a reviewer, a long command keeps producing output, a cloud integration works through a queue of servers. Without the event channel, the only way to learn the result is to keep asking—run a command, read the status, sleep, run it again.

The event channel turns that around. You subscribe once, and Alpacon sends you each change as it happens. A person watching a terminal sees new lines appear; a script or an AI agent gets one line per event on stdout, or a single exit code once the outcome is decided.

Every event has three parts:

| Part | What it means | Example |
|------|---------------|---------|
| **Event type** | The kind of thing you are subscribing to. You choose it with `--type`. | `work_session` |
| **Sub type** | What actually happened to it, for an event type that publishes one | `approved` |
| **Target** | Which specific resource it happened to. You choose it with `--target`. | The work session's ID |

So a single line of output like this:

```
14:32:07	work_session	approved	a1b2c3d4-5678-abcd-ef01-234567890abc
```

reads as: at 14:32:07, the work session `a1b2c3d4-…` was approved.

## Event types you can subscribe to

Alpacon defines the list of event types, so `--type` accepts more than the CLI knows names for. These are the ones you are most likely to use:

| Event type | What it reports | `--target` |
|------------|-----------------|------------|
| `work_session` | A [work session](/reference/cli/work-session/) moving through its lifecycle: `approved`, `activated`, `rejected`, `expired`, `revoked`, `cancelled`, `completed` | Required: the work session ID |
| `notification` | Your own notification feed | Optional: defaults to you, and another user's ID is rejected |
| `command_output` | Output produced by one running command | Required: the command ID |
| `sudo` | Sudo approval requests raised during a terminal session | Required: the session ID |
| `cloud_discovery`, `cloud_install`, `cloud_reconcile`, `cloud_account` | Progress of cloud integration jobs | Optional: give the Alpacon ID (the end of its console page's address, not the AWS ID) of a cloud account (`cloud_discovery`, `cloud_account`) or cloud instance (`cloud_install`, `cloud_reconcile`) that you can see to receive events for that one only; omitting it (admin only) matches every account and instance |
| `metric_threshold_crossed`, `metric_threshold_resolved` | A metric alert rule crossing its threshold, or clearing back below it. Only available when the workspace has the metrics extension. | Optional: a server ID scopes it to that server; omitting it (admin only) matches every server |

A rule that stops receiving data entirely is reported the same way, as `metric_threshold_crossed` with a `reason` of `no_data`, rather than as a separate event type.

Two cloud event types ask for more than seeing the target. Unless you are an admin, `cloud_discovery` also needs [`cloud_account:regions`](/reference/scopes/#cloud_account-regions) and [`cloud_account:summary`](/reference/scopes/#cloud_account-summary) on the account, and `cloud_install` needs [`installation_job:read`](/reference/scopes/#installation_job-read) on the instance's account. When the CLI is logged in with an API token, the token must carry the same scopes: [`cloud_account:read`](/reference/scopes/#cloud_account-read) for `cloud_account`, the two above for `cloud_discovery`, [`cloud_instance:read`](/reference/scopes/#cloud_instance-read) and `installation_job:read` for `cloud_install`, and `cloud_instance:read` for `cloud_reconcile`. A token only carries a scope you hold workspace-wide, so if your access is granted on a single cloud account, log in with `alpacon login` without `-t`. A service token cannot subscribe to cloud events.

A subscription you are not allowed to make—someone else's notifications, a work session you cannot see, a cloud account or instance you cannot see, a cloud event without a target when you are not an admin, a metric threshold event on a workspace without the metrics extension—is rejected, and the command exits with an error instead of waiting.

## What to expect from a subscription

- **No history.** You receive only what is published after you subscribe. Nothing that happened earlier is replayed.
- **Gaps are possible.** If the connection drops, it is re-established automatically, but events published while it was down are lost. Both the drop and the recovery are reported on stderr.
- **An outcome can slip past.** If you subscribe just after the thing you were waiting for happened, no event will ever arrive. [`wait`](/reference/cli/event/wait/) handles this for you: with `--target`, it reads the current state once right after subscribing, and again after every reconnect.

## Which subcommand to use

| What you want | Use |
|---------------|-----|
| Follow everything of one type as it happens, until you stop it | [`watch`](/reference/cli/event/watch/) |
| Block until one outcome is decided, then continue or fail a script | [`wait`](/reference/cli/event/wait/) |

`watch` never exits on its own—it streams until interrupted. `wait` exits as soon as one event decides the result, and its exit code tells you which result it was, so a script or an agent can branch without reading any text.

## Related commands

  
    Stream events until interrupted
  
  
    Wait for one event, then exit with its outcome

Source: https://docs.alpacax.com/reference/cli/event/
