Fetch the status of an agent response
GET https://app.credal.ai/api/v1/agents/fetchAgentResponse
Polls for the status and result of a previously sent agent message using the job ID returned by sendMessage. Requires the api:agent:message:* scope.
Reference: https://docs.credal.ai/api-reference/v-1/api-reference/agents/fetch-response
Authentication
Section titled “Authentication”Authorizationheader (bearer token, required) — Bearer authentication of the formBearer <token>, where token is your auth token.
Request
Section titled “Request”Query parameters
Section titled “Query parameters”jobId(string, required)
Response
Section titled “Response”Agent response status
agents_fetchResponse_Response_200
Errors
Section titled “Errors”400 Bad Request Error
Section titled “400 Bad Request Error”Invalid request
any
401 Unauthorized Error
Section titled “401 Unauthorized Error”Unauthorized
any
403 Forbidden Error
Section titled “403 Forbidden Error”Forbidden
any
404 Not Found Error
Section titled “404 Not Found Error”Job not found
any
500 Internal Server Error
Section titled “500 Internal Server Error”Internal server error
any
AgentsFetchResponseResponse2000
Section titled “AgentsFetchResponseResponse2000”status(enum, required)- Allowed values:
RUNNING
- Allowed values:
AgentsFetchResponseResponse2001
Section titled “AgentsFetchResponseResponse2001”status(enum, required)- Allowed values:
COMPLETED
- Allowed values:
result(AgentsFetchAgentResponseGetResponsesContentApplicationJsonSchemaOneOf1Result, required)
AgentsFetchResponseResponse2002
Section titled “AgentsFetchResponseResponse2002”status(enum, required)- Allowed values:
FAILED
- Allowed values:
errorMessage(string, required)
AgentsFetchAgentResponseGetResponsesContentApplicationJsonSchemaOneOf1Result
Section titled “AgentsFetchAgentResponseGetResponsesContentApplicationJsonSchemaOneOf1Result”agentResponseText(string, required)
Examples
Section titled “Examples”Response
{
"status": "COMPLETED",
"result": {
"agentResponseText": "Here are the Q4 planning documents I found..."
}
}SDK Code
import { CredalClient } from "@credal/sdk";
async function main() {
const client = new CredalClient({
token: "YOUR_TOKEN_HERE",
});
await client.agents.fetchResponse({
jobId: "jobId",
});
}
main();
from credal import CredalV1
client = CredalV1(
token="YOUR_TOKEN_HERE",
)
client.agents.fetch_response(
job_id="jobId",
)