Resolution criteria can be managed inline when creating or updating an agent. See agents.md for full agent payload docs.
// POST /agents or PATCH /agents/:id{ "name": "Sales Agent", "instructions": "...", "resolutionCriteria": [ { "label": "Needs assessment completed", "description": "Customer's requirements and budget were established" }, { "label": "Product recommendation made", "description": "At least one product was recommended based on needs" } ]}
Behavior:Important: On update, this is a declarative replace — existing criterion UUIDs are soft-deleted and new ones are created. This counts as a “significant change” and increments the agent version.
List all active resolution criteria for an agent, ordered…
Status Codes:
Code
Description
200
List of criteria (may be empty)
404
Agent not found
curl -X GET https://api.gomobile.ma/api/agents/550e8400-e29b-41d4-a716-446655440000/resolution-criteria \ -H "x-api-key: YOUR_API_KEY"
Response:
[ { "id": "a1b2c3d4-0000-0000-0000-000000000001", "agentId": "550e8400-e29b-41d4-a716-446655440000", "label": "Needs assessment completed", "description": "Customer's current usage, budget, and pain points were discussed and understood", "position": 0, "createdAt": "2025-01-15T10:30:00.000Z", "updatedAt": "2025-01-15T10:30:00.000Z" }, { "id": "a1b2c3d4-0000-0000-0000-000000000002", "agentId": "550e8400-e29b-41d4-a716-446655440000", "label": "Product recommendation made", "description": "At least one specific plan or product was recommended based on the customer's stated needs", "position": 1, "createdAt": "2025-01-15T10:30:00.000Z", "updatedAt": "2025-01-15T10:30:00.000Z" }]
curl -X POST https://api.gomobile.ma/api/agents/550e8400-e29b-41d4-a716-446655440000/resolution-criteria \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "label": "Next step agreed", "description": "Customer agreed to a concrete follow-up action such as a demo, callback, or signup"}'
Response:
{ "id": "a1b2c3d4-0000-0000-0000-000000000003", "agentId": "550e8400-e29b-41d4-a716-446655440000", "label": "Next step agreed", "description": "Customer agreed to a concrete follow-up action such as a demo, callback, or signup", "position": 2, "createdAt": "2025-01-15T11:00:00.000Z", "updatedAt": "2025-01-15T11:00:00.000Z"}
When a call connects to an agent, the criteria are loaded from the database and frozen into the conversation handle. Changes to criteria mid-conversation have no effect.
If the agent has criteria, the end_conversation tool is dynamically extended with a resolution field. The criteria descriptions are injected into the tool schema so the LLM knows exactly what to evaluate.
When the LLM calls end_conversation, it must evaluate every criterion with a boolean judgment and brief evidence. The schema enforces resolution.length === criteria.length.
GET /agents/:id/resolution-metrics uses COUNT(*) FILTER (WHERE ...) for efficient single-pass aggregation. No materialized views or caching — computed on each request.
Agent settings page — Add a “Resolution Criteria” section where users can add/edit/remove criteria (max 5). Use the inline resolutionCriteria field on agent update for atomic saves.
Criteria form — Each criterion needs:
label input (required, max 255 chars) — short name shown in metrics
description textarea (required) — detailed description the LLM uses for evaluation
Max limit UX — Disable “Add criterion” button when 5 criteria exist. Show remaining count.