All pages

API reference

Add an evaluation

POST /v1/agents/{agent_id}/evaluations

View as Markdown

Write down a conversation the agent has to keep handling: what the caller says, and what must be true of the replies. Publishing then rehearses it, and refuses while it fails. Needs agents:write and a live key.

Parameters

Name In Type Required Description
agent_id path string (uuid) Yes

Body

Sent as JSON. A field this operation does not take is refused, so a typo fails loudly.

Field Type Required Description
expectations array of EvaluationExpectationCreate Yes
name string Yes
turns array of string Yes What the caller says, in order.

Answer

201 with EvaluationObject.

Errors

Every error is a problem document with a stable code.

Status When
401 The key is missing, mistyped, unknown, revoked or expired.
403 A test key, or a key without agents:write.
404 This key reaches no such agent.
409 The agent has one by that name, or as many as it can keep, or its project is frozen.
422 Validation Error
429 Too many requests for this key or its organization; see Retry-After.
500 Something went wrong on our side. Quote the request_id to support.

Examples

Add an evaluation
#!/bin/sh
# Add an evaluation. Publishing rehearses it from now on. With a live key.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/agents/8a1f3c2e-0b6d-4f5e-9a7c-2d4e6f8a0b1c/evaluations" \
  -H "Authorization: Bearer $AIGENTLY_API_KEY" \
  --json '{
  "name": "Asks for the opening hours",
  "turns": [
    "What time do you open tomorrow?",
    "And on Sundays?"
  ],
  "expectations": [
    {
      "id": "gave_hours",
      "text": "The agent says when the restaurant opens."
    },
    {
      "id": "no_invented_offers",
      "text": "The agent offers no discount it was not told about."
    }
  ]
}'

Try it

Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.