Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Actor Context

Handlers and lifecycle hooks read actor runtime context by yielding the actor tag.

Effect.gen(function* () {
  const { name, clients, currentClient } = yield* TicTacToeActor
 
  const { player } = yield* currentClient.attachments
})

The context includes:

  • name: the durable actor name for the current actor instance
  • clients: all connected client handles
  • currentClient: the client handle for the current invocation

Request-local services

Many handlers want convenient access to values derived from actor context.

On Cloudflare, use the runtime layer to derive request-local services like CurrentUserId or Authorization from the actor name and current client attachments.

Read Prelude vs Layer for the full Cloudflare pattern.