Decisions
Service for recording and reading decisions made on a trace.
A decision captures who decided what, field by field: the value an agent proposed, the value the reviewer finally accepted, and whether the reviewer accepted, edited or rejected the proposal. Use it to keep an audit trail of human and agent decisions, and to find where reviewers override agent proposals.
Methods¶
create()¶
create(
traceId:string,decisions:DecisionCreateInput[],folderKey:string):Promise<DecisionIngestAck[]>
Writes one or more decisions to a trace. Rewriting an existing decisionId on the same trace updates that decision.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
traceId |
string |
Trace the decisions belong to (32 hex characters) |
decisions |
DecisionCreateInput[] |
Decisions to write; each decisionId is the id of the completing span (16 hex characters) |
folderKey |
string |
Folder (GUID) the decisions are written to |
Returns¶
Promise<DecisionIngestAck[]>
Promise resolving to one DecisionIngestAck per decision, in input order
Examples¶
import { Decisions } from '@uipath/uipath-typescript/traces';
const decisions = new Decisions(sdk);
const acks = await decisions.create('<traceId>', [{
decisionId: '<spanId>',
data: {
amount: {
disposition: 'Accepted',
proposedBy: { identity: '<agentId>', kind: 'Agent' },
},
},
actor: { identity: '<userEmail>', kind: 'Human' },
acceptedOutcome: 'Approve',
decisionTimestamp: new Date().toISOString(),
platform: 'ActionCenter',
}], '<folderKey>');
console.log(acks[0].feedbackId);
// Record the proposed and final values for a field
const acks = await decisions.create('<traceId>', [{
decisionId: '<spanId>',
data: {
amount: {
proposedValue: 1065,
finalValue: 1065,
disposition: 'Accepted',
proposedBy: { identity: '<agentId>', kind: 'Agent' },
},
},
actor: { identity: '<userEmail>', kind: 'Human' },
acceptedOutcome: 'Approve',
decisionTimestamp: new Date().toISOString(),
platform: 'ActionCenter',
}], '<folderKey>');
getAll()¶
getAll<
T>(options?:T):Promise<TextendsHasPaginationOptions<T> ?PaginatedResponse<DecisionResponse> :NonPaginatedResponse<DecisionResponse>>
Gets decisions, optionally filtered by trace, process and time range. Returns a flat list, or a paginated page when pagination options are passed.
Type Parameters¶
| Type Parameter | Default type |
|---|---|
T extends DecisionGetAllOptions |
DecisionGetAllOptions |
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options? |
T |
Optional filters and pagination |
Returns¶
Promise<T extends HasPaginationOptions<T> ? PaginatedResponse<DecisionResponse> : NonPaginatedResponse<DecisionResponse>>
Promise resolving to a paginated or non-paginated list of DecisionResponse
Examples¶
import { Decisions } from '@uipath/uipath-typescript/traces';
const decisions = new Decisions(sdk);
const result = await decisions.getAll();
result.items.forEach((item) => console.log(item.decision.decisionId, item.decision.acceptedOutcome));
// Decisions for one process since a start time, paginated
const page = await decisions.getAll({
processKey: '<processKey>',
from: new Date('2026-01-01T00:00:00Z'),
pageSize: 25,
});
if (page.hasNextPage && page.nextCursor) {
const next = await decisions.getAll({ cursor: page.nextCursor });
}
getById()¶
getById(
decisionId:string,options?:DecisionGetOptions):Promise<DecisionResponse>
Gets a single decision by its decision ID, including the decision body and, unless disabled, the span it is attached to.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
decisionId |
string |
Decision ID (16 hex characters), as returned by DecisionsServiceModel.create |
options? |
DecisionGetOptions |
Optional folder scope and span inclusion |
Returns¶
Promise<DecisionResponse>
Promise resolving to the DecisionResponse
Examples¶
import { Decisions } from '@uipath/uipath-typescript/traces';
const decisions = new Decisions(sdk);
const decision = await decisions.getById('<decisionId>');
console.log(decision.decision.acceptedOutcome, decision.updatedTime);
// Scope the read to a folder and skip the span lookup
const decision = await decisions.getById('<decisionId>', {
folderKey: '<folderKey>',
includeSpans: false,
});
query()¶
query(
options?:DecisionQueryOptions):Promise<DecisionsPageResponse>
Finds decisions with a richer filter than getAll: by process, actor, outcome or whether the actor overrode a proposal.
Filters on decision content are limited to the most recent 90 days, reported as effectiveFrom on the returned page.
Parameters¶
| Parameter | Type | Description |
|---|---|---|
options? |
DecisionQueryOptions |
Optional filters, paging and sort |
Returns¶
Promise<DecisionsPageResponse>
Promise resolving to a DecisionsPageResponse with items, totalCount and effectiveFrom