docs: specify the AGENTEX_AUTH_URL auth provider HTTP contract#300
Merged
Conversation
Document the HTTP contract a service pointed to by AGENTEX_AUTH_URL must satisfy: the /v1/authn authentication endpoint plus the /v1/authz/* endpoints (check, search, grant, revoke, register, deregister), including payload shapes, the opaque principal round-trip, and status-code semantics. Adds an implementation section covering authenticating against an OIDC provider (e.g. Entra ID) and an "allow everything" single-account authorization model, including why the search endpoint cannot be a no-op and the recommended wildcard sentinel approach.
declan-scale
approved these changes
Jun 10, 2026
danielmillerp
approved these changes
Jun 10, 2026
scalelaszlo
reviewed
Jun 11, 2026
| These routes bypass the provider entirely and are never sent to `/v1/authn`: | ||
|
|
||
| ``` | ||
| /agents/register /agents/forward /docs /api /openapi.json /redoc |
There was a problem hiding this comment.
nitpick, but can you add linebreaks between them?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Documents the HTTP contract that a service pointed to by
AGENTEX_AUTH_URLmust implement, so the auth provider becomes a clearly documented extension point. A self-hosted / open-source deployment can implement this contract directly without depending on any Scale-internal auth service.New doc:
agentex/docs/docs/development_guides/auth_provider_contract.md(added to the docs nav under Development Guides).Contract covered
POST /v1/authn— authenticate from forwarded request headers, return an opaque principal context.POST /v1/authz/*—check,search,grant,revoke,register,deregister, with request/response shapes and status-code semantics.The contract was derived from the existing integration on both sides: the consumer-side proxies/middleware in
agentex/src(which define what gets sent and how status codes are interpreted) and the reference provider's routers/schemas.Key points the doc makes explicit
/v1/authnresult and passes it back verbatim on every authz call. This is what lets a provider own its own identity shape (and makes OIDC/Entra ID pluggable with no Agentex change).200=success,401=unauthenticated,403=denied,5xx=service errors.checkreturns no meaningful body.register/deregistermust exist. Agentex calls them on every resource create/delete when a provider is configured, so omitting them turns creates into 500s. Their behavior can be a trivial200no-op.Implementation guidance
The doc includes two concrete sketches:
check/grant/revoke/register/deregistercollapse to200, butsearchcannot be a no-op because itsitemslist is consumed as an inclusion filter (WHERE id IN (...)); returning[]hides everything.Note for reviewers — one follow-up
The recommended "allow everything" approach for
searchis a wildcard sentinel (e.g.{"items": null}) that the Agentex authorization proxy maps to its existing "no filter" code path. That sentinel is not yet part of the shipped contract — supporting a truly stateless permissive provider would need a small proxy change. The doc calls this out explicitly as a recommended addition rather than describing it as current behavior.Type of change
Documentation only. No code or runtime behavior changes.
Greptile Summary
This PR adds a new reference doc (
agentex/docs/docs/development_guides/auth_provider_contract.md) that specifies the HTTP contract a service pointed to byAGENTEX_AUTH_URLmust implement, making the auth provider a documented extension point for self-hosted deployments. The contract was cross-checked against the actual consumer-side code inadapter_agentex_authn_proxy.py,adapter_agentex_authz_proxy.py, andmiddleware_utils.pyand is accurate in all request/response shapes, status-code semantics, allowlist routes, header-stripping, and the caching behavior.auth_provider_contract.md): coversPOST /v1/authnand all sixPOST /v1/authz/*endpoints with wire-format examples, status-code semantics, and important behavioral callouts (principal opacity, authn 5xx collapse,searchas an inclusion filter,register/deregisterbeing mandatory).mkdocs.yml: single nav entry added under Development Guides, placed between Webhooks and Enterprise Edition.Confidence Score: 4/5
Safe to merge after resolving the broken forward reference; all documented behavior has been verified against the actual implementation code.
The doc is accurate and well-researched, but line 273 explicitly directs readers to implementation guidance that is not present in the file — a provider author implementing the permissive use case (the most likely open-source scenario) will follow that reference and find nothing.
agentex/docs/docs/development_guides/auth_provider_contract.md — the dangling "(see below)" at line 273 needs either the missing implementation sketches added or the forward reference removed.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant Middleware as Agentex Middleware participant Provider as Auth Provider participant Handler as Agentex Handler Client->>Middleware: HTTP Request (with headers) Note over Middleware: Allowlisted route or x-agent-api-key? Skip provider Middleware->>Provider: POST /v1/authn (forwarded headers, empty body) alt 200 OK Provider-->>Middleware: principal context JSON Middleware->>Middleware: Cache principal keyed on headers Middleware->>Handler: Request + principal_context Handler->>Provider: POST /v1/authz/check or search or register etc alt 200 Provider-->>Handler: success body Handler-->>Client: Response else 403 Provider-->>Handler: denied Handler-->>Client: 403 Forbidden else 5xx or network error Provider-->>Handler: error Handler-->>Client: 5xx propagated end else any non-200 including 5xx Provider-->>Middleware: error Middleware-->>Client: 401 Unauthorized endPrompt To Fix All With AI
Reviews (4): Last reviewed commit: "Merge branch 'main' into docs/auth-provi..." | Re-trigger Greptile