Agents
Service for retrieving runtime data for UiPath Agents.
See About Agents for an overview of UiPath Agents.
Methods¶
getAll()¶
getAll<
T>(startTime:Date,endTime:Date,options?:T):Promise<TextendsHasPaginationOptions<T> ?PaginatedResponse<AgentListItem> :NonPaginatedResponse<AgentListItem>>
Retrieves the list of agents on the tenant with consumption and health metadata over the requested window.
Returns a PaginatedResponse when pagination options (pageSize,
cursor, or jumpToPage) are provided, otherwise a
NonPaginatedResponse.
Type Parameters¶
| Type Parameter | Default type |
|---|---|
T extends AgentListOptions |
AgentListOptions |
Parameters¶
| Parameter | Type | Description |
|---|---|---|
startTime |
Date |
Inclusive lower bound for the query window |
endTime |
Date |
Exclusive upper bound for the query window |
options? |
T |
Optional pagination, sort, and filters |
Returns¶
Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<AgentListItem> : NonPaginatedResponse<AgentListItem>>
Promise resolving to a paginated or non-paginated list of AgentListItem
Example¶
import { Agents, AgentListSortColumn } from '@uipath/uipath-typescript/agents';
const agents = new Agents(sdk);
// Non-paginated — returns the server default page
const result = await agents.getAll(
new Date('2025-05-01T00:00:00Z'),
new Date('2026-05-14T00:00:00Z'),
);
result.items.forEach((agent) => {
console.log(`${agent.agentName} — ${agent.unitsQuantity} units, health=${agent.healthScore}`);
});
// Paginated — sorted by health score descending
const page = await agents.getAll(
new Date('2025-05-01T00:00:00Z'),
new Date('2026-05-14T00:00:00Z'),
{
pageSize: 25,
orderBy: { column: AgentListSortColumn.HealthScore, desc: true },
folderKeys: ['<folderKey1>'],
},
);
if (page.hasNextPage && page.nextCursor) {
const next = await agents.getAll(
new Date('2025-05-01T00:00:00Z'),
new Date('2026-05-14T00:00:00Z'),
{ cursor: page.nextCursor },
);
}
getErrors()¶
getErrors<
T>(startTime:Date,endTime:Date,options?:T):Promise<TextendsHasPaginationOptions<T> ?PaginatedResponse<AgentError> :NonPaginatedResponse<AgentError>>
Retrieves agent errors (error-classes observed for agents) over the requested window.
Returns a PaginatedResponse when pagination options (pageSize,
cursor, or jumpToPage) are provided, otherwise a
NonPaginatedResponse.
Type Parameters¶
| Type Parameter | Default type |
|---|---|
T extends AgentErrorsOptions |
AgentErrorsOptions |
Parameters¶
| Parameter | Type | Description |
|---|---|---|
startTime |
Date |
Inclusive lower bound for the query window |
endTime |
Date |
Exclusive upper bound for the query window |
options? |
T |
Optional pagination, sort/group, and filters |
Returns¶
Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<AgentError> : NonPaginatedResponse<AgentError>>
Promise resolving to a paginated or non-paginated list of AgentError
Example¶
import { Agents, AgentErrorSortColumn } from '@uipath/uipath-typescript/agents';
const agents = new Agents(sdk);
// Non-paginated — errors in the window
const result = await agents.getErrors(
new Date('2025-05-01T00:00:00Z'),
new Date('2026-05-14T00:00:00Z'),
);
result.items.forEach((error) => {
console.log(`${error.type}: ${error.description} (count=${error.count})`);
});
// Paginated — sorted by execution count descending
const page = await agents.getErrors(
new Date('2025-05-01T00:00:00Z'),
new Date('2026-05-14T00:00:00Z'),
{
pageSize: 25,
orderBy: { column: AgentErrorSortColumn.ExecutionCount, desc: true },
},
);
if (page.hasNextPage && page.nextCursor) {
const next = await agents.getErrors(
new Date('2025-05-01T00:00:00Z'),
new Date('2026-05-14T00:00:00Z'),
{ cursor: page.nextCursor },
);
}