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

Build an agent

Write the instructions

Say who the agent serves, what it must do, what it must not do, its tone and its language. See Write good agents.

Create it

curl -s 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 are the customer assistant of Duka la Asha, a shop in Dar es Salaam. Answer in the language the customer uses. Use the shop knowledge for facts; if it does not say, tell the customer you will ask a person. Never promise discounts. Be brief and friendly.", "knowledge": true, "max_steps": 6 }'

Test it

curl -s https://api.ngamia.com/v1/agents/duka-helper/runs -H "Authorization: Bearer $NGAMIA_TOKEN" \ -H 'content-type: application/json' -d '{"input":"Mnauza simu za Samsung?"}'

Try real customer questions in both languages, including ones the knowledge does not answer. The agent should say it does not know, not guess.

Change it

# read the current version curl -s https://api.ngamia.com/v1/agents/duka-helper -H "Authorization: Bearer $NGAMIA_TOKEN" | jq .agent.version # send the full definition with that version curl -s -X PUT https://api.ngamia.com/v1/agents/duka-helper -H "Authorization: Bearer $NGAMIA_TOKEN" \ -H 'content-type: application/json' -d '{ "display_name": "Duka helper", "instructions": "…", "knowledge": true, "version": 3 }'

A 409 means someone saved first: reload and merge.

Retire it

Set "archived": true to stop new runs and keep the definition, or delete it with DELETE /v1/agents/{slug}.