> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Actor Context

> The this.ctx object on a StatefulActor — the instance's identity, per-key storage, single alarm, and one-shot init.

`this.ctx` (an `ActorContext`) holds the instance's identity, per-key storage, single alarm, and one-shot init.

```ts theme={null}
interface ActorContext {
  readonly id: string;             // the name you chose with idFromName(name)
  readonly storage: ActorStorage;  // see Actor Storage
  blockConcurrencyWhile<T>(fn: () => Promise<T>): Promise<T>;
  setAlarm(when: number): Promise<void>;  // alias for ctx.storage.setAlarm(when)
}
```

## `ctx.id`

The customer-supplied `name` for this actor — opaque string. You chose it via `env.<BINDING>.idFromName(name)`. Common patterns: caller E.164, CRM user id, email, or a composite key.

## `ctx.blockConcurrencyWhile(fn)`

One-shot init primitive. Use it inside a subclass constructor to gate all other calls until init finishes. **30s budget** — a callback that exceeds it fails init (`BlockConcurrencyTimeoutError`), and the activation is torn down and retried on the next call.

```ts theme={null}
class MyActor extends StatefulActor<Env> {
  constructor(ctx: ActorContext, env: Env) {
    super(ctx, env);
    ctx.blockConcurrencyWhile(async () => {
      // preload state, set up initial alarm, etc.
      // every other method call to this instance waits until this resolves
    });
  }
}
```

## `ctx.setAlarm(when)`

Top-level alias for `ctx.storage.setAlarm(when)`. `when` is **ms since epoch**. See [Alarms](/docs/edge-compute/stateful-actors/alarms).

## Related

* [Actor Storage](/docs/edge-compute/stateful-actors/api-reference/storage) — `ctx.storage`
* [Base Class](/docs/edge-compute/stateful-actors/api-reference/base) — where `this.ctx` comes from
* [Alarms](/docs/edge-compute/stateful-actors/alarms) — the alarm contract
