Agents
Create and manage agent definitions.
List agents
GET /v1/agents
Parameters
| Parameter | In | Type | Notes |
|---|---|---|---|
include_archived | query | boolean | default false |
curl -X GET https://api.ngamia.com/v1/agents \
-H "Authorization: Bearer $NGAMIA_TOKEN"Response 200 fields
| Field | Type | Required | Notes |
|---|---|---|---|
agents | array of object |
Responses
| Status | Meaning |
|---|---|
200 | Agents |
Create an agent (developer)
POST /v1/agents
Request body (application/json)
| Field | Type | Required | Notes |
|---|---|---|---|
slug | string | URL name, unique in the workspace; cannot change. Required on create. pattern ^[a-z][a-z0-9-]{1,62}[a-z0-9]$ | |
display_name | string | yes | min length 1, max length 200 |
description | string | max length 2000 | |
instructions | string | yes | The agent’s system instructions. min length 1, max length 32000 |
model | string | Model name at the Ngamia model gateway; defaults to the workspace’s, then the platform’s default. max length 200 | |
knowledge | boolean | Give the agent the knowledge_search tool over this workspace’s knowledge. Answers then cite their sources. default false | |
memory | boolean | Remember facts about each end user across runs (when the memory engine is enabled). default false | |
tools | array of string | Exact tool_id@version names from the tools engine. Only tools the operator has enabled are offered. max items 32 | |
max_steps | integer | Model calls per run. min 1, max 64, default 8 | |
max_total_tokens | integer | min 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
| Field | Type | Required | Notes |
|---|---|---|---|
agent | object |
Responses
| Status | Meaning |
|---|---|
201 | Created |
400 | The request is invalid (invalid_request). |
403 | The role or key scope does not allow this (forbidden). |
409 | Conflicts with the current state, e.g. a stale version or a taken slug (conflict). |
Get an agent
GET /v1/agents/{slug}
Parameters
| Parameter | In | Type | Notes |
|---|---|---|---|
slug | path | string | required |
curl -X GET https://api.ngamia.com/v1/agents/<slug> \
-H "Authorization: Bearer $NGAMIA_TOKEN"Response 200 fields
| Field | Type | Required | Notes |
|---|---|---|---|
agent | object |
Responses
| Status | Meaning |
|---|---|
200 | The agent |
404 | Not 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
| Parameter | In | Type | Notes |
|---|---|---|---|
slug | path | string | required |
Request body (application/json)
| Field | Type | Required | Notes |
|---|---|---|---|
slug | string | URL name, unique in the workspace; cannot change. Required on create. pattern ^[a-z][a-z0-9-]{1,62}[a-z0-9]$ | |
display_name | string | yes | min length 1, max length 200 |
description | string | max length 2000 | |
instructions | string | yes | The agent’s system instructions. min length 1, max length 32000 |
model | string | Model name at the Ngamia model gateway; defaults to the workspace’s, then the platform’s default. max length 200 | |
knowledge | boolean | Give the agent the knowledge_search tool over this workspace’s knowledge. Answers then cite their sources. default false | |
memory | boolean | Remember facts about each end user across runs (when the memory engine is enabled). default false | |
tools | array of string | Exact tool_id@version names from the tools engine. Only tools the operator has enabled are offered. max items 32 | |
max_steps | integer | Model calls per run. min 1, max 64, default 8 | |
max_total_tokens | integer | min 1000, max 1000000, default 60000 | |
archived | boolean | Archived agents cannot start runs. | |
version | integer |
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
| Field | Type | Required | Notes |
|---|---|---|---|
agent | object |
Responses
| Status | Meaning |
|---|---|
200 | Updated (version incremented) |
409 | Conflicts with the current state, e.g. a stale version or a taken slug (conflict). |
Delete an agent (developer)
DELETE /v1/agents/{slug}
Parameters
| Parameter | In | Type | Notes |
|---|---|---|---|
slug | path | string | required |
curl -X DELETE https://api.ngamia.com/v1/agents/<slug> \
-H "Authorization: Bearer $NGAMIA_TOKEN"Responses
| Status | Meaning |
|---|---|
204 | Deleted |
404 | Not found in this workspace (not_found). |