What you will learn
- Follow an agent's model call through the gateway to the vendor
- Say which key the agent holds and which key only the gateway holds
- Explain what a guardrail is and where it is enforced
- Tell where the list of available guardrails comes from
Before you start
- What is Choreo Agent Manager? Not started In progress Done
- JWT, JWKS, issuer, audience and scope Not started In progress Done
An agent that calls a language model needs a vendor key. Sharing that key with all agents would be risky: one leak, one huge bill. Agent Manager puts a gateway between the agent and the vendor and gives the agent a different key.
Two setup pieces
An LLM providerAn organisation level connection to a model vendor such as OpenAI or Anthropic. It holds the vendor address and key, and is deployed to gateways.Analogy:The company's contract with a supplier, held by purchasing.See it in the glossary is the organisation’s connection to a model vendor. It holds the vendor’s address and key. An LLM proxyA project level entry point that points at one LLM provider and has its own API key. Agents call the proxy and never see the vendor key.Analogy:A purchase card issued to one project. It can be cancelled without touching the contract.See it in the glossary is a project level entry point that points at one provider and has a key of its own, the Proxy keyThe key an agent shows to an LLM proxy. It is opaque text, not a JWT, and works only for that proxy. The real vendor key stays at the gateway.Analogy:A fuel card issued to one project, as opposed to the company's master account with the supplier.See it in the glossary. When a provider is deployed to a gateway, the gateway learns about it over its WebSocket line to AMS.
The call, in three steps
The agent sends the request to the gateway
The agent calls the AI gatewayThe doorway for agent traffic to model vendors and tool servers. It runs each request through a chain of policies, such as keys, limits and guardrails, before passing it on.Analogy:Airside security and customs. ID check, bag scan, then the real boarding document.See it in the glossary runtime, which is registered on port
22893on-prem, and shows its proxy key. The address and a secret reference to the key reach the pod as environment variables. The header name and place come from the proxy’s security setting. A proxy set to no key asks for none.The policy engine runs the proxy's policies
The router hands each request to the Policy engineThe part of the gateway runtime that runs the policy chain for each request. The router hands each request to it, and its policies are compiled in.See it in the glossary. When the proxy needs a key, AMS puts the
api-key-authpolicy first in the proxy’s list when it builds the deployment, and the policies you configured follow it. Those are the GuardrailA gateway policy that checks or limits traffic, such as a content filter or rate limit. It is set at the gateway, so agents need no code changes.See it in the glossary, rate limits and cost tracking.The gateway adds the real key and calls the vendor
The gateway gets the vendor key ahead of time. When the provider is deployed, the gateway controller downloads the provider from AMS’s internal API, and AMS decrypts the key reference and returns the key. The gateway turns it into a set-headers policy for the provider route. At call time the real key is added to the outgoing call, so the agent does not hold it.
The same flow goes on after step 3 with the agent’s traces. This lesson stops at the model call. The trace path is steps 4 to 10 in the player.
What guardrails do
A guardrail is a gateway policy that checks or limits traffic of an LLM provider, an LLM proxy or an MCP proxy, for example a content filter or a rate limit. Three ideas are worth keeping.
- They are enforced at the gateway. Rules about what agents may send belong in one place, so they apply without changing any agent code.
- They are part of the configuration. A guardrail is saved in the provider or proxy configuration as a name, a version and a list of paths with settings. Adding one goes through the ordinary update call, then the configuration is deployed to the gateways.
- The menu comes from the gateways. Each gateway pushes the manifest of the policies it has installed to AMS. The console’s policy lists are answered from the latest push.
Rate limit policies are a good example. There are request based limits, token based limits and budget style limits. A cost policy works out what a call costs from a price table, so a budget can be enforced.
Your turn
Under Try it, play flow F9 and watch the first three steps. Where in step 3 does the key change? Then open the credentials map, click the row for the LLM proxy API key, and read who holds it, who checks it and where it travels. Finish with the matcher on who holds which key.
Recap
- The agent is given the proxy’s address and key, not the vendor’s key.
- The gateway’s policy engine runs the proxy’s policies, with
api-key-authfirst when a key is needed. - The gateway adds the real vendor key to the outgoing call.
- A guardrail is a gateway policy, so it applies without agent code changes. The list of available guardrails comes from the gateways’ manifests.
Wrap up
Recap
Tick each one when you could explain it to a colleague.
Finished?
Chapter complete. Every lesson in this chapter is done.
Progress cannot be saved in this browser, so it will be forgotten when you leave this page.
Quick check
Spotted something wrong or unclear in this lesson? Report an inaccuracy (opens GitHub in a new tab)