Skip to main content
Agent<E, State> extends StatefulActor<E>. Subclass it, declare async methods for your inbound surface, and use the protected members inside them.

Type parameters

Construction

You don’t construct agents yourself — the runtime does. On every activation the base constructor also re-arms the task scheduler to the earliest pending task (inside ctx.blockConcurrencyWhile), which is what makes timers survive crashes and restarts. If you need your own one-shot init, override the constructor and call super(ctx, env) first, exactly as with a StatefulActor.

Properties

Plus everything inherited: this.ctx, this.env.

Methods

State and scheduling methods are listed with full semantics on their own pages:

Override hooks

Reserved: alarm()

The SDK claims the actor’s alarm slot to drive the task scheduler: when the alarm fires, Agent.alarm() drains every due task, dispatches each to the method it names, and re-arms to the next deadline. Overriding alarm() in an Agent subclass breaks queue/schedule/every. If you need timed work, schedule a task.