Appearance
Class: ActorWorker
Defined in: packages/ema/src/actor.ts:28
A facade of the actor functionalities between the server (system) and the agent (actor).
Constructors
Constructor
ts
new ActorWorker(
config,
userId,
actorId,
conversationId,
server): ActorWorker;Defined in: packages/ema/src/actor.ts:61
Creates a new actor worker with storage access and event wiring.
Parameters
config
Actor configuration.
userId
number
User identifier for message attribution.
actorId
number
Actor identifier for memory and storage.
conversationId
number
Conversation identifier for message history.
server
Server instance for shared services.
Returns
ActorWorker
Properties
events
ts
readonly events: ActorEventsEmitter;Defined in: packages/ema/src/actor.ts:30
Event emitter for actor events.
Methods
isBusy()
ts
isBusy(): boolean;Defined in: packages/ema/src/actor.ts:157
Reports whether the actor is currently preparing or running.
Returns
boolean
True if not idle; otherwise false.
work()
ts
work(inputs, addToBuffer): Promise<void>;Defined in: packages/ema/src/actor.ts:98
Enqueues inputs and runs the agent sequentially for this actor.
Parameters
inputs
Batch of user inputs for a single request.
addToBuffer
boolean = true
Returns
Promise<void>
A promise that resolves after the input is handled or queued.
Example
ts
// infinite loop of REPL
for (;;) {
const line = prompt("YOU > ");
const input: Content = { type: "text", text: line };
await this.work([input]);
}