Skip to main content

IAgentScheduler Interface

Agent scheduler distributes a set of tasks/variables across connected clients.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/agent-scheduler/legacy.

For more information about our API support guarantees, see here.

Signature​

export interface IAgentScheduler extends IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable

Extends: IProvideAgentScheduler, IEventProvider<IAgentSchedulerEvents>, IFluidLoadable

Methods​

MethodAlertsReturn TypeDescription
pick(taskId, worker)BetaPromise<void>

Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus. Resolves when the tasks are assigned to one of the connected clients.

This method should only be called once per task. Duplicate calls will be rejected.

pickedTasks()Betastring[]Returns a list of all tasks running on this client
register(taskUrls)BetaPromise<void>

Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants a new agent to run but does not have the capability to run the agent inside the host. Client can call pick() later if the capability changes.

This method should only be called once per task. Duplicate calls will be rejected.

release(taskUrls)BetaPromise<void>

Releases a set of tasks for other clients to grab. Resolves when the tasks are released.

Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection. App can call pickedTasks() to get the picked list first.

Method Details​

pick​

Attempts to pick a set of tasks. A client will only run the task if it's chosen based on consensus. Resolves when the tasks are assigned to one of the connected clients.

This method should only be called once per task. Duplicate calls will be rejected.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

pick(taskId: string, worker: () => Promise<void>): Promise<void>;

Parameters​

ParameterTypeDescription
taskIdstring
worker() => Promise<void>callback to run when task is picked up.

Returns​

Return type: Promise<void>

pickedTasks​

Returns a list of all tasks running on this client

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

pickedTasks(): string[];

Returns​

Return type: string[]

register​

Registers a set of new tasks to distribute amongst connected clients. Only use this if a client wants a new agent to run but does not have the capability to run the agent inside the host. Client can call pick() later if the capability changes.

This method should only be called once per task. Duplicate calls will be rejected.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

register(...taskUrls: string[]): Promise<void>;

Parameters​

ParameterTypeDescription
taskUrlsstring[]

Returns​

Return type: Promise<void>

release​

Releases a set of tasks for other clients to grab. Resolves when the tasks are released.

Only previously picked tasks are allowed. Releasing non picked tasks will get a rejection. App can call pickedTasks() to get the picked list first.

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature​

release(...taskUrls: string[]): Promise<void>;

Parameters​

ParameterTypeDescription
taskUrlsstring[]

Returns​

Return type: Promise<void>