Ctrl AI

Inference

Run AI queries with trust-tagged responses and full audit trails.

The inference endpoint is the core of Ctrl AI. It takes a natural language query, finds matching verified units, executes them, and returns a trust-tagged response with per-claim attribution.

Run a Query

POST /api/v1/inference

Request Body

FieldTypeRequiredDescription
querystringYesThe natural language question
domainIdstringNoScope to a specific domain
jurisdictionstringNoJurisdiction filter (e.g., "US", "EU")
sessionIdstringNoResume a multi-turn session
additionalInputsobjectNoAnswers to pending gate questions
includeUnverifiedbooleanNoInclude candidate units (default: false)

Example Request

curl -X POST https://app.ctrlai.com/api/v1/inference \
  -H "Authorization: Bearer ctrlai_pk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is the credit risk assessment for an applicant with income $85,000 and credit score 720?"
  }'

Response

{
  "data": {
    "response": "Based on the verified credit risk assessment framework...",
    "segments": [
      {
        "text": "The applicant's DTI ratio of 28% is below the 43% threshold",
        "trustLevel": "verified",
        "unitId": "01HX...",
        "unitName": "DTI Threshold Check"
      },
      {
        "text": "Credit score of 720 places the applicant in the 'good' tier",
        "trustLevel": "expert_reviewed",
        "unitId": "01HY...",
        "unitName": "Credit Score Classification"
      }
    ],
    "trustSummary": {
      "verified": 2,
      "expertReviewed": 3,
      "synthesized": 0,
      "neural": 1
    },
    "coveragePercent": 83,
    "unitsUsed": [
      {
        "id": "01HX...",
        "name": "DTI Threshold Check",
        "type": "program",
        "status": "verified",
        "verificationScore": 100
      }
    ],
    "mode": "full_coverage",
    "sessionId": null,
    "pendingQuestions": [],
    "modelsUsed": {
      "parse": { "provider": "gemini", "model": "gemini-2.5-flash" },
      "evaluate": { "provider": "gemini", "model": "gemini-2.5-flash" },
      "prose": { "provider": "gemini", "model": "gemini-2.5-flash" }
    }
  }
}

Response Fields

FieldTypeDescription
responsestringFull prose response
segmentsarrayTrust-tagged response segments
segments[].trustLevelstringverified, expert_reviewed, synthesized, or neural
segments[].unitIdstringID of the unit that produced this segment
trustSummaryobjectCount of segments per trust level
coveragePercentnumberPercentage of query covered by verified units
unitsUsedarrayUnits that fired during execution
modestringfull_coverage, partial_coverage, or neural_only
sessionIdstringNon-null if this is a multi-turn session
pendingQuestionsarrayQuestions the user needs to answer (protocol gates)
modelsUsedobjectLLM provider + model for each role

Multi-Turn Sessions (Agentic Flows)

When a Protocol unit has an interactive gate, execution pauses and returns pending questions:

{
  "data": {
    "response": "I need additional information to proceed...",
    "sessionId": "01HZ...",
    "pendingQuestions": [
      {
        "question": "Has the applicant's identity been verified?",
        "options": ["Yes, verified", "No, not yet", "Escalate to compliance"]
      }
    ]
  }
}

Resume the session by including sessionId and additionalInputs:

curl -X POST https://app.ctrlai.com/api/v1/inference \
  -H "Authorization: Bearer ctrlai_pk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "01HZ...",
    "additionalInputs": {
      "identity_verified": "Yes, verified"
    }
  }'

Save as Unit

Convert a useful response segment into a candidate unit:

POST /api/v1/inference/save-as-unit
FieldTypeRequiredDescription
segmentTextstringYesThe response text to formalize
domainIdstringYesTarget domain
unitTypestringNoPreferred unit type

Feedback

Record feedback on inference claims:

POST /api/v1/inference/feedback
FieldTypeRequiredDescription
inferenceLogIdstringYesThe inference log entry
segmentIndexnumberYesWhich segment
feedbackstringYesconfirm or incorrect

On this page