Table of Contents

Codeunit "Agent Task"

ID 4303
Namespace: System.Agents

Properties

Name Value
InherentEntitlements X
InherentPermissions X

Methods

TaskExists

Check if a task exists for the given agent user and conversation

procedure TaskExists(AgentUserSecurityId: Guid; ExternalId: Text): Boolean

Parameters

Name Type Description
AgentUserSecurityId Guid

The user security ID of the agent.

ExternalId Text

The external ID to check.

Returns

Type Description
Boolean

True if task exists, false if not.

GetTaskByExternalId

procedure GetTaskByExternalId(AgentUserSecurityId: Guid; ExternalId: Text)

Parameters

Name Type Description
AgentUserSecurityId Guid
ExternalId Text

SetStatusToReady

Set the status of the task to ready if the task is in the state that it can be started again. The agent task will be be picked up for processing shortly after updating the status.

procedure SetStatusToReady(AgentTaskID: BigInteger)

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to set to ready.

SetStatusToReady

Obsolete

This element will become obsolete from version 29.0. Use the overload that takes AgentTaskID instead.

[Obsolete(Use the overload that takes AgentTaskID instead.,29.0)]
procedure SetStatusToReady(AgentTask: __MissingTypeSymbol__)

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__

CanSetStatusToReady

Checks if the task can be set to ready and started again.

procedure CanSetStatusToReady(AgentTaskID: BigInteger): Boolean

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to check.

Returns

Type Description
Boolean

True if agent task can be set to ready, false otherwise

CanSetStatusToReady

procedure CanSetStatusToReady(AgentTask: __MissingTypeSymbol__): Boolean

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__

Returns

Type Description
Boolean

StopTask

Stops the agent task.

procedure StopTask(AgentTaskID: BigInteger; UserConfirm: Boolean)

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to stop.

UserConfirm Boolean

Whether to show a confirmation dialog to the user.

StopTask

Obsolete

This element will become obsolete from version 29.0. Use the overload that takes AgentTaskID instead.

[Obsolete(Use the overload that takes AgentTaskID instead.,29.0)]
procedure StopTask(AgentTask: __MissingTypeSymbol__; UserConfirm: Boolean)

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__
UserConfirm Boolean

RestartTask

Restarts the agent task by setting its status to ready.

procedure RestartTask(AgentTaskID: BigInteger; UserConfirm: Boolean)

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to restart.

UserConfirm Boolean

Whether to show a confirmation dialog to the user.

RestartTask

Obsolete

This element will become obsolete from version 29.0. Use the overload that takes AgentTaskID instead.

[Obsolete(Use the overload that takes AgentTaskID instead.,29.0)]
procedure RestartTask(AgentTask: __MissingTypeSymbol__; UserConfirm: Boolean)

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__
UserConfirm Boolean

IsTaskRunning

Checks if the agent task is currently running.

procedure IsTaskRunning(AgentTaskID: BigInteger): Boolean

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to check.

Returns

Type Description
Boolean

True if the task is running, false otherwise.

IsTaskRunning

procedure IsTaskRunning(AgentTask: __MissingTypeSymbol__): Boolean

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__

Returns

Type Description
Boolean

IsTaskCompleted

Checks if the agent task is completed.

procedure IsTaskCompleted(AgentTaskID: BigInteger): Boolean

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to check.

Returns

Type Description
Boolean

True if the task is completed, false otherwise.

IsTaskCompleted

procedure IsTaskCompleted(AgentTask: __MissingTypeSymbol__): Boolean

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__

Returns

Type Description
Boolean

IsTaskStopped

Checks if the agent task is stopped (by user or system).

procedure IsTaskStopped(AgentTaskID: BigInteger): Boolean

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to check.

Returns

Type Description
Boolean

True if the task is stopped, false otherwise.

IsTaskStopped

procedure IsTaskStopped(AgentTask: __MissingTypeSymbol__): Boolean

Parameters

Name Type Description
AgentTask __MissingTypeSymbol__

Returns

Type Description
Boolean

GetCopilotCreditsConsumed

Obsolete

This element will become obsolete from version 29.0. Use the methods in the "Agent Consumption Overview" codeunit instead.

Gets the total Copilot credits consumed by the agent task.

[Obsolete(Use the methods in the "Agent Consumption Overview" codeunit instead.,29.0)]
procedure GetCopilotCreditsConsumed(AgentTaskID: BigInteger): Decimal

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to get consumed credits for.

Returns

Type Description
Decimal

The total Copilot credits consumed by the agent task.

GetStepsDoneCount

Gets the number of steps done for the specified agent task.

procedure GetStepsDoneCount(AgentTaskID: BigInteger): Integer

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task.

Returns

Type Description
Integer

The number of steps done.

OpenAgentTaskLogEntries

Opens the agent task log entries page for the specified agent task.

procedure OpenAgentTaskLogEntries(AgentTaskID: BigInteger)

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task to show log entries for.

GetModelId

Gets the model ID of the agent task.

procedure GetModelId(AgentTaskID: BigInteger): Code[30]

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task.

Returns

Type Description
Code[30]

The model ID of the agent task. Must be valid value from Agent Model table.

GetModelName

Gets the model name of the agent task.

procedure GetModelName(AgentTaskID: BigInteger): Text[70]

Parameters

Name Type Description
AgentTaskID BigInteger

The ID of the agent task.

Returns

Type Description
Text[70]

The model name of the agent task.

See also