Developers / Agents
Set an agent's knowledge search
https://api.echonova.ai/v1/agents/{agentId}/ragTurns answering from knowledge on or off, and sets how many passages it reads and how close they must be. Fields you leave out keep their value. Free. Needs the agents:write scope on the key.
Headers
Bearer, a space, then your API key, which starts with ek_. Create keys in the portal under Developers, API Keys.
Path parameters
The agent id, as GET /v1/agents returned it.
Request body
application/json
Whether the agent answers from its knowledge.
How many knowledge passages to read for each answer.
How close a passage must be to the question to be used, from 0 to 1.
Response
200 application/json Every response uses this envelope.
The result.
Whether the agent answers from its knowledge.
How many knowledge passages it reads for each answer.
How close a passage must be to the question to be used, from 0 to 1.
true for a successful call.
Repeats the HTTP status.
null on success.
Errors
Same envelope, with success false and data null. All errors
When. agentId or sessionId is not a 24-character hexadecimal id.
Fix. Use the id exactly as GET /v1/agents or the conversations list returned it.
When. enabled is missing or is not true or false.
Fix. Send enabled as a JSON boolean.
When. topK is above 20, or below 1 (the message then names the lower bound).
Fix. Send topK from 1 to 20.
When. minSimilarity is above 1, or below 0 (the message then names the lower bound).
Fix. Send minSimilarity from 0 to 1.
When. The body or query carries a field the endpoint does not define.
Fix. Remove the field.
When. The Authorization header is missing or is not Bearer ek_..., no key matches the token, or the key is deleted, disabled, expired or its account is closed.
Fix. Send Authorization: Bearer ek_... with an enabled key from this environment.
When. The workspace that owns the key has no subscription.
Fix. Check the workspace's plan in the portal.
When. The subscription is in a state other than active or trial.
Fix. Renew the subscription.
When. The key does not have the agents:write scope.
Fix. Edit the key and give it the agents:write scope, or use another key.
When. The member who created the key has left the workspace, or no longer has both the Manage agents and Manage developer API permissions. It is checked on every call.
Fix. Give that member both permissions again, or create a key as a member who has them.
When. The agent id is unknown, or the agent belongs to another workspace.
Fix. Use an id from GET /v1/agents with a key of the agent's workspace.
When. The agent is archived. Only duplicate, archive and restore work on an archived agent.
Fix. Restore it with POST /v1/agents/{agentId}/restore, or duplicate it and change the copy.
When. The JSON body of an agent write is over 512 KB; the request is rejected before the API key is checked, so it has no Activity row.
Fix. Send a smaller body; split long knowledge text into several sources.
When. The request has a body whose Content-Type is not application/json.
Fix. Send Content-Type: application/json.
When. The key made more than 100 requests to one endpoint in 60 seconds, or one IP address made more than 100 requests to one endpoint in 60 seconds (the IP limit is counted before the key is checked, so it can answer with no key at all); a Retry-After header carries the seconds to wait.
Fix. Wait Retry-After seconds, then retry.
When. An error the API did not classify.
Fix. Check the request, then retry after a short wait; contact support if it persists.
When. A transient outage inside the API.
Fix. Retry after a short wait.
When. A transient timeout inside the API.
Fix. Retry after a short wait.
curl -X PATCH "https://api.echonova.ai/v1/agents/{agentId}/rag" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"enabled":true}'{
"data": {
"enabled": true,
"topK": 5,
"minSimilarity": 0.3
},
"success": true,
"statusCode": 200,
"errorMessage": null
}