After sending a trace to Infinium, Maestro (the behavioral intelligence engine) analyzes it and produces an interpretation. You can retrieve this result programmatically.
Fetching Results
Use getInterpretedTaskResult() to retrieve Maestro’s analysis:
const response = await client.sendTaskData(taskData);
const traceId = response.data?.traceId;
const interpretation = await client.getInterpretedTaskResult(traceId);
if (interpretation.success) {
console.log(interpretation.data);
} else {
console.log('Not ready yet or not found');
}
Parameters
| Parameter | Type | Description |
|---|---|---|
taskId | string | The trace ID (UUID) returned from sendTask() or sendTaskData() |
Return Value
ApiResponse with Maestro’s interpretation in data.
Best Practices
- Typical processing time — Maestro usually completes within 5-30 seconds depending on trace complexity
- Polling — If you need to wait for the result, implement a polling loop with appropriate intervals (3-5 seconds)
- Fire and forget — If you don’t need the interpretation immediately, skip polling entirely. The result is always available on the platform dashboard
- Background processing — In production, consider checking for results in a background task rather than blocking your main flow
Polling Example
async function waitForInterpretation(
client: InfiniumClient,
traceId: string,
timeout = 120000,
interval = 3000,
): Promise<ApiResponse> {
const start = Date.now();
while (Date.now() - start < timeout) {
const result = await client.getInterpretedTaskResult(traceId);
if (result.success && result.data) {
return result;
}
await new Promise((resolve) => setTimeout(resolve, interval));
}
throw new Error(`Timed out waiting for interpretation after ${timeout}ms`);
}
// Usage
const response = await client.sendTaskData(taskData);
const interpretation = await waitForInterpretation(client, response.data?.traceId);