Skip to Content
The Ngamia platform API is in preview. Endpoints may change before general availability.

Agents

Create and manage agent definitions.

List agents

GET /v1/agents

Parameters

ParameterInTypeNotes
include_archivedquerybooleandefault false
curl -X GET https://api.ngamia.com/v1/agents \ -H "Authorization: Bearer $NGAMIA_TOKEN"

Response 200 fields

FieldTypeRequiredNotes
agentsarray of object

Responses

StatusMeaning
200Agents

Create an agent (developer)

POST /v1/agents

Request body (application/json)

FieldTypeRequiredNotes
slugstringURL name, unique in the workspace; cannot change. Required on create. pattern ^[a-z][a-z0-9-]{1,62}[a-z0-9]$
display_namestringyesmin length 1, max length 200
descriptionstringmax length 2000
instructionsstringyesThe agent’s system instructions. min length 1, max length 32000
modelstringModel name at the Ngamia model gateway; defaults to the workspace’s, then the platform’s default. max length 200
knowledgebooleanGive the agent the knowledge_search tool over this workspace’s knowledge. Answers then cite their sources. default false
memorybooleanRemember facts about each end user across runs (when the memory engine is enabled). default false
toolsarray of stringExact tool_id@version names from the tools engine. Only tools the operator has enabled are offered. max items 32
max_stepsintegerModel calls per run. min 1, max 64, default 8
max_total_tokensintegermin 1000, max 1000000, default 60000
curl -X POST https://api.ngamia.com/v1/agents \ -H "Authorization: Bearer $NGAMIA_TOKEN" \ -H 'content-type: application/json' \ -d '{"slug": "duka-helper", "display_name": "Duka helper", "instructions": "You help customers of Duka la Asha. Answer in the customer's language. Be brief.", "knowledge": true}'

Response 201 fields

FieldTypeRequiredNotes
agentobject

Responses

StatusMeaning
201Created
400The request is invalid (invalid_request).
403The role or key scope does not allow this (forbidden).
409Conflicts with the current state, e.g. a stale version or a taken slug (conflict).

Get an agent

GET /v1/agents/{slug}

Parameters

ParameterInTypeNotes
slugpathstringrequired
curl -X GET https://api.ngamia.com/v1/agents/<slug> \ -H "Authorization: Bearer $NGAMIA_TOKEN"

Response 200 fields

FieldTypeRequiredNotes
agentobject

Responses

StatusMeaning
200The agent
404Not found in this workspace (not_found).

Replace an agent’s definition (developer)

PUT /v1/agents/{slug}

Send the whole definition. Include the version you edited: if someone saved a newer version first, the update fails with 409 and nothing changes. Runs in progress keep the definition they started with; new runs use the new one within 30 seconds.

Parameters

ParameterInTypeNotes
slugpathstringrequired

Request body (application/json)

FieldTypeRequiredNotes
slugstringURL name, unique in the workspace; cannot change. Required on create. pattern ^[a-z][a-z0-9-]{1,62}[a-z0-9]$
display_namestringyesmin length 1, max length 200
descriptionstringmax length 2000
instructionsstringyesThe agent’s system instructions. min length 1, max length 32000
modelstringModel name at the Ngamia model gateway; defaults to the workspace’s, then the platform’s default. max length 200
knowledgebooleanGive the agent the knowledge_search tool over this workspace’s knowledge. Answers then cite their sources. default false
memorybooleanRemember facts about each end user across runs (when the memory engine is enabled). default false
toolsarray of stringExact tool_id@version names from the tools engine. Only tools the operator has enabled are offered. max items 32
max_stepsintegerModel calls per run. min 1, max 64, default 8
max_total_tokensintegermin 1000, max 1000000, default 60000
archivedbooleanArchived agents cannot start runs.
versioninteger
curl -X PUT https://api.ngamia.com/v1/agents/<slug> \ -H "Authorization: Bearer $NGAMIA_TOKEN" \ -H 'content-type: application/json' \ -d '{"display_name": "…", "instructions": "…"}'

Response 200 fields

FieldTypeRequiredNotes
agentobject

Responses

StatusMeaning
200Updated (version incremented)
409Conflicts with the current state, e.g. a stale version or a taken slug (conflict).

Delete an agent (developer)

DELETE /v1/agents/{slug}

Parameters

ParameterInTypeNotes
slugpathstringrequired
curl -X DELETE https://api.ngamia.com/v1/agents/<slug> \ -H "Authorization: Bearer $NGAMIA_TOKEN"

Responses

StatusMeaning
204Deleted
404Not found in this workspace (not_found).