Agents

Ask an agent on a call, deal or account

Changed on

Asks the Modjo AI on a single call, deal or account and waits for the answer, returned as JSON matching the provided schema. The answer is generated by an artificial intelligence system and can be inaccurate, so review it before relying on it and disclose to end users that it was generated by AI. Answers usually take 30 seconds to 2 minutes and can take up to 5 minutes, so set your HTTP client timeout to at least 300 seconds. 502 and 504 errors are safe to retry. With background: true, the API answers 202 at once instead, and you read the result with GET /agents/ask/{runUuid}. This is a private feature: contact your Modjo account manager to learn more and request access.

post/agents/ask

Request

  • Base URL
    https://api.modjo.ai/v2
  • URL
    https://api.modjo.ai/v2/agents/ask
  • Auth
    HTTP bearer

Request body

instructionsstring

Optional free-text guidance for the model, on top of the schema descriptions.

backgroundboolean

Runs the analysis in the background: the API answers 202 at once with the run, whose result you read with GET /agents/ask/{runUuid}.

Example request

{
  "scope": {
    "id": 1
  },
  "instructions": "Answer in English and stay factual.",
  "responseFormat": {
    "json_schema": {
      "name": "call_qualification",
      "schema": {
        "type": "object",
        "properties": {
          "budget": {
            "type": "string",
            "description": "Budget mentioned by the prospect"
          },
          "nextStep": {
            "type": "string",
            "description": "Next step agreed with the prospect"
          }
        },
        "required": [
          "budget",
          "nextStep"
        ],
        "additionalProperties": false
      }
    }
  }
}

Response

Structured answer

idstring required

Identifier of the AI run. Share it with Modjo support when reporting an unexpected answer.

outputobject required

The AI-generated answer, shaped by responseFormat.json_schema.schema. Every field of the schema is present, and a field the data does not answer is null.

Example response

{
  "id": "0b7efa49c2d84e5f9a1b3c5d7e9f0a12",
  "scope": {
    "id": 1
  },
  "output": {
    "budget": "50k EUR",
    "nextStep": null
  }
}

Changes