ON-PREM CHOREO CLOUD BOTH

What you will learn

  • Recite the order of the checks a call to the main API passes before the handler runs
  • Tell which check answers 401, which answers 403 and which answers 400
  • Explain why the organisation in the web address is ignored
  • Say what an extra permission does when you deploy to a production environment

Before you start

On this page

A call to Agent Manager’s main API looks like one request, but it walks through a row of checks first. If you know the order, you can read an error and say which check stopped you.

Flow

Every Agent Manager request, the middleware chain

F2 10 steps ON-PREM

Each call to the Agent Manager API passes the same ordered checks before any business code runs: safety net, correlation id, token validation, org from the token, scope check, then the handler.

This lesson covers the public API under /api/v1. The health, key-set, discovery and config routes, and the internal gateway server, skip this chain.

The chain, in order

  1. Safety nets

    The outermost layer catches a crash and turns it into a 500. Next comes CORS, the browser permission check. It answers a browser’s OPTIONS preflight with 204 before any token is looked at, which is why a preflight needs no token.

  2. Correlation id and logger

    The request gets a ticket number, the , and a logger tagged with it. All log lines of one request can be found together later.

  3. Signature check, then issuer and audience

    This is the token check of lesson L1.2.2. A missing header gives 401 missing header. A token that fails gives 401 invalid jwt. On success AMS stores the claims and the raw token for the next steps.

  4. The route is matched and an audit wrapper may start

    For changes and a short list of sensitive reads, a recorder writes an event when the request ends, including refused ones. Most plain reads are not audited.

  5. The organisation comes from the token

    Most routes carry {orgName} in their address, but AMS ignores it. On those routes it takes the organisation from the token claims ouId and ouHandle. If either is missing or empty the answer is 403.

  6. The scope gate

    Almost every route declares the permission it needs, for example amp:agent:create. AMS compares it with the scopes in the token. A miss answers 403 insufficient permissions. On an audited route it also writes an audit event that names the first missing scope.

  7. Path parameters, then the handler

    Blank parts of the address are refused with 400. Then the handler runs, calls a service, and the service reads or writes Agent Manager’s own database.

The chain is a chain: each step can stop the request, and a request that is stopped does not reach the steps after it. The organisation check runs before the scope gate.

Component

agent-manager-service (AMS)

Control side Control plane BOTH

The agent-manager-service (AMS) is the central Go service of Agent Manager. It offers the REST API and an MCP endpoint used by the console and the amctl command line, and it holds the business logic for agents, builds, deployments, gateways, LLM and MCP proxies, monitors and agent identities. It lives on the control plane.

Three answers to remember

StatusWhich check said it
401The token check: no header, bad signature, wrong issuer or wrong audience
403The organisation check or the scope gate
400The path parameter check

The organisation is not in the web address

Imagine a token for organisation A used on a web address that names organisation B. AMS does not read the name in the address at all. The request acts on organisation A, because that is what the token says. So the address segment is not a way to reach someone else’s data, and it is not a way to choose your organisation either.

One more floor for production

Actions that target a named environment, such as deploying, also call an environment tier check. It looks the environment up in OpenChoreo and requires amp:agent:env-non-production. When the environment is flagged as production it also requires amp:agent:env-production. Production is stacked on top of the floor, not a replacement for it.

Your turn

Under Try it, step through flow F2 and, at each step, say which status it would answer. Then open Break the token: choose a way to break the token, send the request, and note which check turns it away and with which status. Try the option that puts another organisation in the web address and see what happens. Finish with the matcher, which pairs each stage with its job.

Recap

  • The chain runs: safety nets, correlation id, token check, audit wrapper, organisation from the token, scope gate, path parameters, handler.
  • 401 comes from the token check, 403 from the organisation or scope check, 400 from path parameters.
  • The organisation comes from ouId and ouHandle. The name in the web address is ignored.
  • A browser preflight is answered with 204 before authentication.
  • A deploy to a production environment needs amp:agent:env-production in addition to amp:agent:env-non-production.

Try it

Follow one request

What to do: press Play, or use Next, to walk through the request step by step.

Loading the diagram...

Break the token

What to do: choose how to break the token, then send the request and watch which check turns it away.

Loading the simulator...

Match them up

What to do: pick an item on the left, then its partner on the right.

Loading the matching game...

Wrap up

Recap

Tick each one when you could explain it to a colleague.

Finished?

Quick check

Loading the quick check...

Spotted something wrong or unclear in this lesson? Report an inaccuracy (opens GitHub in a new tab)