Back to all guides
Agent Gateway

Intent Agent: turn a prompt into AuthZEN evaluations

The IndyKite Intent Agent reads a natural-language prompt and answers with what it asks, as AuthZEN subject, action, resource and context entries, in the vocabulary of your knowledge graph and active KBAC policies. What to send, what comes back, how to get a decision from it, and a demo to try.

What is the Intent Agent?

The Intent Agent turns a sentence into an authorization question. An AI agent receives "Can I retrieve the quote stock_quote?"; the Intent Agent answers with what that sentence asks, in the shape the AuthZEN API decides on:

{
  "subject": { "type": "User", "id": "roy" },
  "action": { "name": "CAN_RETRIEVE" },
  "resource": { "type": "Quote", "id": "stock_quote" },
  "context": { "parameters": {} }
}

It is a self-hosted A2A service, shipped as the indykite/intent-agent Docker image, with its source on GitHub at indykite/intent-agent, and it works in the vocabulary of your project: it only uses node types from your data schema and actions that your ACTIVE KBAC policies grant.

It does It does not
Split a prompt into one or more AuthZEN evaluations or searches.Decide anything. The decision stays with AuthZEN.
Fill the subject with the user the caller names, so prompt text can never speak for someone else.Take a subject from the prompt, except for a "who can …?" search or a question about a second, named person (see the shapes).
Refuse unclear, out-of-scope and manipulative prompts with an explanation the caller can show or feed to its own LLM.Guess: a prompt no policy covers is refused, not forced onto the nearest action.
Write one audit record per request, to a file or a webhook.Read or return graph data.

How does a request flow?

A caller, an AI agent or the Agent Gateway, sends the Intent Agent a prompt with the user's subject_type and subject_id and a Bearer token. The Intent Agent introspects the token at the identity provider, reads the data schema and active KBAC policies from the IndyKite platform, extracts the intent with an LLM, writes an audit record, and answers with a list of AuthZEN evaluations. The caller then asks AuthZEN for the decision.
  1. The caller sends the prompt as an A2A SendMessage, naming the user in message.metadata and authenticating itself with a Bearer token.
  2. The Intent Agent checks the caller's token at your identity provider (RFC 7662 introspection): it must be active and issued for the agent's audience, intent_agent by default.
  3. It reads the vocabulary from the IndyKite platform with its AppAgent credential: the data schema (GET /data-schema/v1/) and the ACTIVE KBAC policies of the user's type (GET /access/v1/policies). Both are cached for 5 minutes.
  4. It extracts the intent with an LLM (Google Gemini), constrained to that vocabulary, and checks the answer against it.
  5. It answers with the intent: {prompt, evaluations}, or a refusal {prompt, error, reason, obligation}.
  6. It writes one audit record for the request.
  7. The caller asks AuthZEN for the decision on each evaluation (from intent to decision).

What do I send?

One JSON-RPC SendMessage call, the A2A 1.0 transport, to the agent's URL (port 6003 by default). It is not a REST API: note the A2A-Version header, the method name and the ROLE_USER role.

curl -X POST http://localhost:6003/ \
  -H "Content-Type: application/json" \
  -H "A2A-Version: 1.0" \
  -H "Authorization: Bearer $CALLER_TOKEN" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "SendMessage",
    "params": {
      "message": {
        "role": "ROLE_USER",
        "messageId": "msg-1",
        "parts": [{ "text": "Can I retrieve the quote stock_quote?" }],
        "metadata": {
          "subject_type": "User",
          "subject_id": "roy"
        }
      }
    }
  }'
Part What it is
Authorization: BearerThe caller's token, not the user's identity. It must be active at the introspection endpoint and carry the agent's audience (EXPECTED_TOKEN_AUDIENCE, default intent_agent). A delegation token from the Token Service works, as does a client-credentials token of the calling agent.
parts[].textThe prompt, in plain language.
metadata.subject_typeRequired. The user's node type in the graph, e.g. User or Customer. Its ACTIVE policies are the actions the agent may use.
metadata.subject_idRequired. The user's external_id. Every evaluation about "I" or "me" gets this subject. A caller that only has the user's token gets both values from ContX IQ whoami.

Only SendMessage is served; GetTask, ListTasks and CancelTask answer "unsupported operation". The answer comes in the same HTTP response; there is no streaming.

What do I get back?

An A2A task. Two fields matter: result.task.status.state and the text of the result artifact, a JSON string holding the intent.

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "task": {
      "id": "…",
      "contextId": "…",
      "status": { "state": "TASK_STATE_COMPLETED" },
      "artifacts": [
        {
          "name": "result",
          "parts": [{ "text": "{\"prompt\": \"Can I retrieve the quote stock_quote?\", \"evaluations\": [ … ]}" }]
        }
      ]
    }
  }
}
State Artifact text
TASK_STATE_COMPLETEDThe intent: {"prompt": "…", "evaluations": [ … ]}.
TASK_STATE_FAILEDA refusal: {"prompt": "…", "error": "…", "reason": "…", "obligation": "…"} (when it cannot answer).

prompt echoes the prompt as sent. Each entry of evaluations is one question:

Roy asks: Can I retrieve the quote stock_quote? The Intent Agent splits it into one evaluation. The subject User roy comes from the request metadata the caller supplied, never from the prompt. The action CAN_RETRIEVE comes from an active KBAC policy. The resource Quote stock_quote comes from the prompt, its type from the data schema. The context carries parameters, CEL filters and qualifiers.
Field Meaning
subject.type, subject.idWho acts. The caller's subject_type and subject_id; only a subject search or a second-subject question differs.
action.nameAn action one of the user's ACTIVE KBAC policies grants. Absent in an action search.
resource.type, resource.idWhat is acted on. A node type of the schema, and the external_id the prompt names. No id when the prompt is about many resources.
context.parametersAlways present, often {}. Values from the prompt that fit no other field, such as {"tier": "tier_1"}.
context.filtersOnly when the prompt narrows a set: a CEL expression over resource.<property>, such as resource.status == 'overdue'.
context.qualifiersOnly when the prompt mentions them: circumstances such as a time or a place.

What shapes can an intent take?

The examples use the CanBank graph of the demo. Each row shows the user, the prompt, and the evaluations in short form: subject → ACTION → resource.

Shape User asks Intent
Evaluation: one yes/no questionroy: "Can I retrieve the quote stock_quote?"User roy → CAN_RETRIEVE → Quote stock_quote
Several questions: one evaluation each, in orderrebecca: "Which accounts do I own and which of my invoices can I view?"Customer rebecca → OWNS → Account
Customer rebecca → VIEW_INVOICE → Invoice
Resource search: "which …?", the resource has no idleslie: "Which invoices can I view?"User leslie → CAN_VIEW → Invoice
Subject search: "who can …?", the subject has a type and no idmillicent: "Who can access the document refund_policy?"User → CAN_ACCESS_FOLDER_DOCUMENT → Document refund_policy
Action search: "what can I do …?", no actionroy: "What can I do with the quote stock_quote?"User roy → (any) → Quote stock_quote
About the user as resource: the resource is the callerflo: "Who reports to me?"User → REPORTS_TO → User flo
Second subject: a question about another named person, behind a gatemillicent: "Does leslie work in the support department?"User millicent → CAN_QUERY_USER → User leslie (the gate)
User leslie → WORKS_IN → Department support
Filters: criteria on a setalison: "Which of my unpaid invoices are over 500?"Customer alison → VIEW_UNPAID_INVOICE → Invoice, filters double(resource.amount) > 500.0
Parameters: a value the policy readsbob: "Do I have a tier_1 account?"Customer bob → HAS → AccountTier, parameters {"tier": "tier_1"}
Qualifiers: time, placeroy: "Can I retrieve the quote stock_quote from the Toronto branch this afternoon?"User roy → CAN_RETRIEVE → Quote stock_quote, qualifiers for the location and the time

The second subject is the one case where the subject is someone else, and it always comes with a gate first: an evaluation asking whether the user may query that person at all. Decide the gate first and ignore the rest when it is denied. The two full answers below show a resource search with a filter and a subject search.

{
  "prompt": "Which of my unpaid invoices are over 500?",
  "evaluations": [
    {
      "subject": { "type": "Customer", "id": "alison" },
      "action": { "name": "VIEW_UNPAID_INVOICE" },
      "resource": { "type": "Invoice" },
      "context": {
        "filters": "double(resource.amount) > 500.0",
        "parameters": {}
      }
    }
  ]
}
{
  "prompt": "Who can access the document refund_policy?",
  "evaluations": [
    {
      "subject": { "type": "User" },
      "action": { "name": "CAN_ACCESS_FOLDER_DOCUMENT" },
      "resource": { "type": "Document", "id": "refund_policy" },
      "context": { "parameters": {} }
    }
  ]
}

What if it cannot answer?

The task ends TASK_STATE_FAILED and the artifact holds a refusal instead of evaluations. reason and obligation are plain sentences, written to be shown to the user or handed to the caller's own LLM, for example to ask the user to rephrase.

{
  "prompt": "Who is allowed to approve this?",
  "error": "Unable to extract intent from prompt.",
  "reason": "The prompt doesn't match the Knowledge Graph Schema, or is unclear.",
  "obligation": "Ask the prompter to clarify their request or ensure it's relevant to the system."
}
reason When
The prompt doesn't match the Knowledge Graph Schema, or is unclear.The prompt is ambiguous ("Can I access it?"), no policy covers it ("Is my driver's license still valid?"), or it tries to steer the answer: dictated fields, claimed overrides, encoded payloads, SQL. The reason is the same in every case, so a refusal never reveals the vocabulary.
subject_type is not a valid entity type for the current data schema.The subject_type sent is not a node type of the schema.
Access policies for the supplied subject type are unavailable.No ACTIVE KBAC policy exists for that type, or the AppAgent lacks ReadAuthZConfigs.
Data schema unavailable - cannot verify the supplied subject type against it.The schema cannot be read: the AppAgent lacks ReadDataSchema, or the platform is unreachable.
Data schema is available but the data model hasn't been populated with any entity types yet.The project holds no data yet. The schema is updated at most once a minute after an ingest.

How do I turn the intent into a decision?

Send each evaluation to the AuthZEN endpoint that matches its shape, with the AppAgent credential (AuthZEN guide):

The evaluation has Call Answer
subject id, action, resource idPOST /access/v1/evaluation, or all of them at once with POST /access/v1/evaluationsallow / deny
resource without idPOST /access/v1/search/resourcewhich resources
subject without idPOST /access/v1/search/subjectwhich subjects
no actionPOST /access/v1/search/actionwhich actions
  • Pass context.parameters as context.input_params when the granting policy's Cypher reads them (such as $tier).
  • AuthZEN does not read filters or qualifiers: they are carried, not enforced. Apply a filter yourself to the resources a search returns.
  • For a second subject, decide the gate (the first evaluation) before the others.

How do I run it?

What the project needs

  • An AppAgent credential with the ReadDataSchema and ReadAuthZConfigs API permissions (Credentials guide), sent as X-IK-ClientKey.
  • Data in the graph, so the data schema lists your node types.
  • ACTIVE KBAC policies for every subject type that will ask (AuthZEN guide). The agent can only express what a policy grants.
  • An RFC 7662 introspection endpoint that knows the callers' tokens, with a client the agent authenticates with: your identity provider, or the Token Service.
  • A Google Gemini API key for the extraction.

Configuration

Environment variables, read at startup. The service refuses to start when a required one is missing or blank.

Variable Default Meaning
INDYKITE_BASE_URLrequiredYour region's API base URL.
IK_APP_AGENT_KEYrequiredThe AppAgent credential.
GEMINI_API_KEYrequiredGemini API key.
INTROSPECT_URL, INTROSPECT_CLIENT_ID, INTROSPECT_CLIENT_SECRETrequiredThe introspection endpoint and the agent's client there.
AUDIT_DELIVERYrequiredfile or webhook; auditing cannot be turned off. See Audit records.
EXPECTED_TOKEN_AUDIENCEintent_agentThe aud a caller's token must carry. Published on the agent card.
ADVERTISED_URLhttp://intent:<INTENT_PORT>The URL on the agent card. Set it to the scheme, host and port callers really use, such as your ingress.
INTENT_PORT, HEALTH_PORT6003, 8001The A2A and health ports.
GEMINI_MODELgemini-3.5-flash-liteThe model used.
REQUEST_TIMEOUT_SECONDS10.0Time limit for one request.
SCHEMA_REFRESH_TTL_MINUTES, POLICY_REFRESH_TTL_MINUTES5.0How long the schema and the policy list are cached. A new policy reaches the agent after up to this time.
CACHE_BACKEND, REDIS_URLmemoryredis shares the cache between instances; REDIS_URL is then required.
mkdir -p audit && sudo chown 65532 audit                # the container runs as user 65532
docker run -d --name intent-agent -p 6003:6003 -p 8001:8001 --env-file .env \
  -v "$(pwd)/audit:/var/audit" \
  -e AUDIT_FILE_STORAGE_PATH=/var/audit \
  indykite/intent-agent:<version>
curl http://localhost:8001/health                          # liveness
curl http://localhost:6003/.well-known/agent-card.json     # public agent card

Pin a version: no latest tag is published, and the published tags are listed on Docker Hub. To read the code or build the image yourself, use the indykite/intent-agent repository on GitHub. The image runs as user 65532 with a read-only /app, so file audit needs a directory that user can write. Mount it from the host, as above, so the audit records outlive the container; a path inside the container, such as /tmp/audit, is lost when the container is removed and only suits a throwaway test. Stop the agent with docker stop intent-agent; the records stay in ./audit. The agent card is public and announces the Bearer requirement and the expected audience, so a client can discover what token to bring.

HTTP and JSON-RPC errors

Answer Cause
401 Authorization requiredNo Bearer token.
401 Token is not activeThe introspection endpoint does not know the token, or it expired.
401 Token is not valid for this agentThe token's aud does not include EXPECTED_TOKEN_AUDIENCE.
401 Token does not identify its callerThe introspection answer carries neither sub nor client_id.
502The introspection endpoint refused the agent's own client credentials, or answered something unreadable.
500The introspection endpoint could not be reached.
JSON-RPC -32602, subject_type is required / subject_id is requiredThe metadata is missing.

The 401 and 5xx bodies are plain text, with a WWW-Authenticate: Bearer challenge on the 401.

Audit records

One record per request, with timestamp, request_id, subject_id, subject_type, requesting_agent_id, context_id, prompt, evaluations, schema_version, policy_version, llm_provider, llm_model, latency_ms, validation_retries, policy_fetch_failed, outcome (success, validation_failed, unmatched or error) and message. Delivery works like the Agent Gateway's, with environment variables:

What each field means, the three states of policy_fetch_failed, why schema_version and policy_version are content hashes rather than version numbers, a full example and the csv and txt layouts are in the Audit Event Formats guide.

Delivery Variables
fileAUDIT_FILE_STORAGE_PATH, AUDIT_FILE_FORMAT (csv, json or txt), AUDIT_FILE_ROTATION_STRATEGY (time, size or size-and-time), all required; AUDIT_FILE_ROTATION_INTERVAL_SECONDS (default 86400), AUDIT_FILE_ROTATION_MAX_BYTES (default 100 MiB).
webhookAUDIT_HTTP_URL, AUDIT_HTTP_METHOD (POST or PUT), AUDIT_HTTP_AUTH_TYPE (mTLS, api-key or no-auth), all required; AUDIT_HTTP_API_KEY and AUDIT_HTTP_API_KEY_HEADER (default X-API-Key), or AUDIT_HTTP_MTLS_CERTIFICATE_FILE_PATH and AUDIT_HTTP_MTLS_PRIVATE_KEY_PATH; AUDIT_HTTP_TIMEOUT_SECONDS (default 5.0).
eitherAUDIT_ASYNC=true delivers through a queue of AUDIT_ASYNC_BUFFER_SIZE records (default 512), flushed on shutdown. A failed delivery is logged and never fails the request.

How does the Agent Gateway use it?

An Agent Gateway protecting an A2A agent asks the Intent Agent about every message before it forwards it when ibac.enabled is on. The gateway then plays the caller: it resolves the user with ContX IQ whoami, gets its own token for the Intent Agent's audience with a client credentials grant, keeps it until shortly before it expires, and sends the text parts of a message/send or message/stream message, joined one per line, with subject_type and subject_id. A message without text, and every other method, is not asked about. The call happens after the gateway's own authorization and before forwarding.

Key Meaning
ibac.enabledSwitches the call on; default false, and then the intent_agent section is not read. On, intent_agent.base_url is required, otherwise the gateway refuses to start with intent_agent.base_url is required when ibac.enabled is on in front of an A2A agent.
intent_agent.base_urlWhere the Intent Agent serves its agent card; an absolute http or https URL.
intent_agent.audienceAudience of the gateway's token for the Intent Agent; default intent_agent, must match EXPECTED_TOKEN_AUDIENCE.
intent_agent.timeoutHow long one prompt may take, the token grant included; default 45 seconds, must be positive.
audit.include_promptDefault false: whether the gateway's INTENT audit records carry the prompt, the reason of a failed task and the text the model answered with in place of an intent, all of which can quote the user.

What the gateway does with the answer:

  • A completed task with an intent: without a Token Service, the message is forwarded to the agent. With a Token Service behind the gateway, the intent is first compared with the skills of the agent the caller may use, by the x-coaz-mappings of each skill (IBAC engine guide): the evaluations a skill covers go into the delegation token the agent receives, in act.intent of the hop, and the message is forwarded; an intent of which no skill covers anything refuses the message with 403, and the agent does not get it. With the Token Service, an intent of which more evaluations fit than it accepts (10 by default), or an intent of more than 64, is not forwarded: the caller gets, in place of the agent, the error The request asks for too much at once: its intent has <n> evaluations, too many for one request. with the reason intent_too_large and the obligation Send the request in smaller parts. Without a Token Service, an intent with more than 64 evaluations is refused with 502.
  • A failed task: the message is not forwarded. The caller gets, with status 200 and as an answer rather than a refusal so that the conversation goes on, an agent message in the same contextId whose text is the task's error followed by its obligation, and whose metadata.intent_error holds the {prompt, error, reason, obligation} object. A message/stream request gets it as its one event. A failed task that carries no error object is reported with the text the model answered with in place of an intent, when the task's artifacts hold one; otherwise with the text of the task's status message; and otherwise as Unable to extract intent from prompt.
  • No usable answer: the message is refused. 502 with the intent agent cannot be asked when the Intent Agent cannot be reached, or with the intent agent answered with a message instead of a task, … an intent that cannot be read or … a task neither completed nor failed; 504 with the intent agent did not answer in time after intent_agent.timeout. A 401 from the Intent Agent is retried once with a renewed gateway token.

Every call is audited by the gateway as a record with action INTENT: decision INTENT_FOUND with reason intent with <n> evaluation(s), INTENT_FAILED with reason no intent: <error>, or ERROR with cannot get the intent of the prompt, plus durationMs. The Intent Agent writes its own record for the same call, in the format below.

Try it: the intent-agent-demo

The intent-agent-demo in the developer-hub repository runs the Intent Agent, the Token Service and a web console locally with Docker Compose, or on minikube with its Helm chart. Only the IndyKite platform and Gemini are remote. Both run the published indykite/intent-agent image, pinned in the demo's docker-compose.yaml and chart/values.yaml; to try your own build of the source, set INTENT_AGENT_IMAGE when you start Compose. Its graph and 24 KBAC policies come from the intent dataset of the instant-stack app, the CanBank users and customers used in this guide.

Console view What you see
PlaygroundPick a person, send a prompt, watch the steps light up, read each evaluation as a ticket, see the AuthZEN decision per ticket, and open the raw JSON-RPC request, task, tokens and audit record.
GuardrailsAmbiguous and out-of-scope prompts, prompt injection, encoded payloads, SQL in filters, and three token failures: wrong audience, a token the introspection endpoint never issued, no token.
VocabularyThe data schema and the ACTIVE policies per subject type: everything the agent is allowed to say.
AuditThe Intent Agent's and the Token Service's audit records, live.
ArchitectureThe diagram and the numbered steps.

In the demo the console is the caller: it exchanges the person's token at the Token Service for a delegation token with audience intent_agent, and the Intent Agent introspects that token at the Token Service. The demo's README walks through provisioning, configuration and the console, step by step.

Related