This tutorial is grounded in the ibac-demo reference application. A fictional bank, CanBank, gives its staff and customers a console and a set of AI agents: an orchestrator, a retriever, a weather agent and an analyst. Every agent sits behind its own IndyKite Agent Gateway (IAG), and the agents reach the IndyKite MCP server through one more gateway. One prompt therefore crosses three gateways in a row, and each of them decides on its own whether this person may come this way.
What makes that possible is the delegation chain: a token that says "this person, through this agent, then this one, then this one". In this tutorial the chain is written by the IndyKite Token Service (ITS), a small service you run next to the gateways. People and agents are still authenticated by an external identity provider (IdP) of your choice; the demo ships wired to Auth0, and any OAuth 2.0 provider that issues JWT access tokens fits.
How this tutorial differs from the other two gateway tutorials
The three tutorials use the same gateway. They differ in who mints the delegation token and in what they focus on. Pick the one that matches your setup:
| MCP server with external token exchange | This tutorial | |
| Who mints the delegation token | Your IdP, with its OAuth 2.0 token exchange (RFC 8693). | The IndyKite Token Service, which you run yourself. |
| What your IdP must offer | Token introspection, the client credentials grant and token exchange. | Token introspection and the client credentials grant. No token exchange. |
| What the protected agent or server receives | One token: the gateway replaces Authorization with the delegation token. |
Two tokens: the person's own token in Authorization and the delegation token in X-IK-Token. |
| Token Introspect configurations in the project | For one issuer: the IdP. | For two issuers: the IdP (the person's token) and the Token Service (the delegation token). |
| The intent of a prompt in the token | Not available. | Available: with IBAC on, the Token Service writes it into act.intent. |
| Focus | One gateway in MCP proxy mode in front of a third-party MCP server. | A chain of gateways, A2A then MCP, and the chain as a rule in policies. |
The third tutorial, Intent-based access control with Agent Gateway, also uses the Token Service. It concentrates on what a gateway does with the meaning of a prompt, with stand-in agents. This one concentrates on the route of a prompt, with real agents, and only switches intent checks on at the end.
What you will have at the end
- A clear picture of the two ways a gateway gets a delegation token, and when to choose which.
- An understanding of one prompt crossing three gateways: the person's token, the three delegation tokens and the three admission decisions.
- An external IdP prepared with three audiences, a login client and one machine-to-machine client per gateway.
- A provisioned IndyKite project: people, agents, workflows, policies and the two Token Introspect configurations.
- A running stack: a console, four agents, five gateways and the Token Service.
- Prompts sent as different people, with every decision of every hop on screen.
- A knowledge query and a policy of your own that answer only when the request came through the full chain.
Prerequisites
- An IndyKite organization and a Service Account token, to provision a project with the instant-stack app and its
ibacdataset (chapter 4). - An external OAuth 2.0 IdP you can configure: users, a login client for the console, one machine-to-machine client per gateway, and JWT access tokens with an audience (chapter 3).
- A Google Gemini API key for the agents' model, or an Ollama instance reachable from Docker.
- Docker and Docker Compose v2, and
make. The gateways and the Token Service run theindykite/agent-gatewayandindykite/token-serviceimages with one platform release tag from hub.docker.com/u/indykite.
Who this tutorial is for
- Developers building agents that call other agents and who need every hop to know on whose behalf it works.
- Platform and security engineers whose identity provider has no token exchange, or who want the delegation tokens issued by a service they control.
- AI agents consuming this doc as a runbook - every chapter uses explicit service names, ports, file paths and commands.
Demo topology at a glance
Everything runs locally with Docker Compose; only the IndyKite platform, your IdP and the model are remote.
| Service | Role | Port |
console |
Web UI: login at the IdP, the CanBank app, a prompt box and the audit terminal that shows every decision. | 3300 |
orchestrator-iag → orchestrator |
The entry gateway and the agent that talks to the user and delegates to the other agents. | 9881 |
retriever-iag → retriever |
Answers graph and authorization questions as a client of the IndyKite MCP server. | 9882 |
weather-iag → weather |
Weather from a public API, or from the graph for the bank's headquarters. | 9884 |
analyst-iag → analyst |
Like the retriever, with several MCP servers behind it (chapter 8). | 9885 |
mcp-iag |
A gateway in MCP mode in front of the IndyKite MCP server. Every agent's MCP call goes through it. | 9886 |
token-service |
The IndyKite Token Service: mints the delegation token of every hop. | 9102 |
auth0-bridge |
A small adapter between the gateways and the demo's IdP (chapter 3). Not needed with a provider that offers token introspection itself. | internal only |
Four optional groups of services are switched on with Compose profiles and are presented in chapter 8: the Intent Agent (intent), a Google Drive MCP server (drive), a graph-filtered ERP (erp) and a CRM agent (crm).
Related reading
- Agent Gateway guide: every step, setting and status code of the gateway.
- Token Service guide: the configuration file, the exchange and the token it signs.
- Intent-Based Access Control guide: what chapter 8 switches on.