AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help
Structured Decisions

TypeSafe Decisions

Use Jev for condition judgments, classification, scoring, and tool selection.

Decisions uses Jev to evaluate text or business state and returns answers that you can read directly in code. The API returns JSON synchronously and does not support streaming.

POST/v1/decisions

Authorization

bearerAuth
AuthorizationBearer <token>

Use an API Key issued by the current site.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

Request examples

The following examples use jev-1.13.0. Select a question scenario and code language to copy the corresponding request.

Determine whether a refund is requested

curl --request POST 'https://api.agtcloud.cn/v1/decisions' \
  --header 'Authorization: Bearer your-api-key' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "jev-1.13.0",
  "state": "My subscription was charged twice. Please refund the duplicate charge.",
  "questions": {
    "ticket": {
      "type": "noul",
      "instructions": "Does the customer explicitly request a refund?",
      "criteria": {
        "true": "The message explicitly asks for a refund.",
        "false": "The message does not ask for a refund."
      }
    }
  }
}'

Question types

TypePurposeReturned fields
noulDetermine whether a condition holds, such as whether a customer requests a refundnoul: probability that the condition holds
choiceSelect a category or action from candidates, such as the team responsible for a ticketchoice, probabilities, confidence
scoreScore against ordered criteria, such as ticket urgencyscore, legend, probabilities, confidence

Provide the content to evaluate in state and the questions and criteria in questions. A request can contain multiple questions and mix the three types; every question shares the same state.

Reading results

answers uses the same question IDs as questions. For example, if the question ID is ticket, read the answer from answers.ticket.

  • Judgment: Read noul. Values range from 0–1; near 1 indicates a tendency toward true, and near 0 toward false. Set a decision threshold according to your business needs.
  • Classification: Read choice for the selected option name, and use probabilities to inspect each option's probability.
  • Scoring: Read score. Levels are numbered from 0 by their array position in criteria; three levels correspond to 0–2, and scores can be fractional. legend maps level numbers to their descriptions.

For choice and score, confidence indicates the certainty of the probability distribution, not the accuracy of the answer. Probabilities, scores, and Token usage vary with each request.

Tool selection uses choice to return an action name, such as lookup_payment. Your application performs the subsequent operation based on that name; the decision request itself does not execute tools or generate OpenAI tool_calls.

Token usage and costs

usage.input_tokens and usage.output_tokens record input and output Token usage respectively. Jev charges for input Tokens only; output Tokens are not charged. Multiple questions and candidate descriptions also affect input usage. For current prices, see the Model Marketplace.

Official references