getAgentResult
Client function: fetch an async talkToAgent run by job id.
import { getAgentResult } from 'flowstack-sdk'Non-React client function. GET /agents/talk/{job_id}. Returns the same AgentTalkResult shape talkToAgent returns: status: 'done' with the response when finished, status: 'running' while the agent is still working, or status: 'unknown' if the job expired (1h TTL) or never existed.
Signature
getAgentResult(credentials, jobId, config?): Promise<ApiResponse<AgentTalkResult>>Parameters
| Param | Type | Notes | Description |
|---|---|---|---|
credentials | FlowstackCredentials | required | The same owner credentials used for the originating talkToAgent call. |
jobId | string | required | The job_id returned by talkToAgent when it responded with status: 'running'. |
config | FlowstackClientConfig | — | Client config (baseUrl, tenantId as needed). |
Returns
| Field | Type | Description |
|---|---|---|
| — | Promise<ApiResponse<AgentTalkResult>> | The run's current state — done, running, error, or unknown. |
Examples
Poll a running job
const poll = await getAgentResult(credentials, jobId);
if (poll.ok && poll.data.status === 'done') {
console.log(poll.data.response, poll.data.cost_usd);
} else if (poll.ok && poll.data.status === 'unknown') {
// expired (1h TTL) or never existed — re-run the task
}Warning
status: 'unknown' is not an error response — res.ok is still true. It means the job expired (1h TTL) or never existed. Code that only checks res.ok will poll a dead job forever; check for unknown and stop.WarningJobs live for 1 hour. A result not collected within the TTL is gone and the task must be re-run — do not persist a
job_id across a long-lived session and expect it to resolve later.NotePoll every ~20–30s. Tighter polling does not make the agent finish sooner.
See also
Source: src/api/client.ts (agent-to-agent talk, P0-187 FR3b) · Also available in llms-full.txt and registry.json.