Skip to content

feat(agents): integrate Entra identity registration and authorization - #43149

Draft
joshua-berri wants to merge 8 commits into
mainfrom
litellm_agent_entra_identity
Draft

joshua-berri wants to merge 8 commits into
mainfrom
litellm_agent_entra_identity

Conversation

@joshua-berri

@joshua-berri joshua-berri commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Entra agent identity and authorization needs an integrated gateway workflow

How it solves it:

  • Registers explicit Entra bindings in existing agent forms
  • Supports autonomous and verified delegated agent execution
  • Intersects model, agent, MCP server and tool permissions
  • Records agent identity and originating user separately

Base of the four-PR stack; followed by #43229, #43230 and #43459. Reconciles existing implementation and review fixes; no additional feature scope

Diff sizes are being refreshed after the reviewed repairs

User Flow

Before: the complete workflow below is unavailable at this PR's parent

  1. Open Agents and add or edit an agent
  2. Select Microsoft Entra ID, enter its application identity, and save
  3. Obtain an Entra token for the gateway and call an allowed model/tool
  4. Observe denied calls for missing grants or disabled identities
  5. Inspect identity status and request attribution

After: this PR provides the workflow through the existing gateway surfaces

  1. Open Agents and add or edit an agent
  2. Select Microsoft Entra ID, enter its application identity, and save
  3. Obtain an Entra token for the gateway and call an allowed model/tool
  4. Observe denied calls for missing grants or disabled identities
  5. Inspect identity status and request attribution

Relevant issues

Original complete implementation: #43149

Affected release

Linear ticket

Pre-Submission checklist

  • Existing implementation and review fixes are preserved
  • Meaningful tests remain with their owning behavior
  • Devin verification at the reconciled head is complete
  • Required CI and completed Codecov pass
  • Greptile, Veria and Bugbot reviews have no actionable findings
  • User has accepted the hosted UI workflow

Screenshots / Proof of Fix

The existing Entra application, agent-user, delegated user, MCP authorization and attribution flows were exercised on the combined stack in Devin. Latest repairs add actor-and-target rate accounting; two focused cases pass, including settlement to actual usage. Applying the same regression to the earlier implementation exposes the missing target charge and actor reconciliation

The current repair removes a loop-local Final declaration rejected by basedpyright without changing the policy expression. Two rate regressions pass and the specific type diagnostic is gone. The restored selector UI passes 611 tests with two expected failures, unchanged type diagnostics and fewer lint warnings than the baseline. The production build and final hosted CI remain pending

Previous-tip Greptile scored 5/5. Veria's agent budget and delegated-team concerns are implemented in dependent #43229 and #43459; this prerequisite alone is not the complete feature

Type

New Feature

Caveats

  • Part of the four-PR identity, budgets, SCIM and delegated-team stack; do not release the complete feature without fix(agents): preserve delegated team authorization context #43459
  • Current-tip verification and reviews remain pending; fresh Bugbot review is waived due to team quota
  • Optional selector cleanup is excluded and saved as an unpublished follow-up

Final Attestation

  • Current-tip CI, coverage and review gates are complete

@codspeed

codspeed Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_agent_entra_identity (080de40) with main (22b36cb)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (268e8bb) during the generation of this report, so 22b36cb was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai @cursor review Please review bbf7e15 for Entra identity isolation, SCIM lifecycle, permission intersections, budgets, and compatibility after CI repairs

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@cursor review

Please review bbf7e15 for identity isolation, SCIM revocation, delegated permissions, and compatibility following the CI repairs

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical risk] Adds identity and authorization system for managed agents with database schema changes.

No outstanding finding or new issue from the latest change prevents merging this PR on its own.

Summary

The PR adds Entra-managed agent identity and authorization across gateway requests, MCP access, persistence, attribution, and the dashboard. Since the previous review, the rate-limit policy expression received a type-only adjustment; no new actionable issue was identified.

Reviews (27) · Last reviewed commit: "fix(agents): pass rate policy without lo..."

Comment thread litellm/proxy/auth/handle_jwt.py Outdated
Comment thread litellm/proxy/agent_endpoints/auth/agent_permission_handler.py Outdated
Comment thread litellm/proxy/auth/user_api_key_auth.py Outdated
Comment thread litellm/proxy/management_endpoints/scim/agent_provisioning.py Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread litellm/proxy/auth/handle_jwt.py Outdated
@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Please review c5d3ad3: three confirmed findings repaired, regressions passing, and the cardinality finding withdrawn after checking Microsoft documentation

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@cursor review
Please verify c5d3ad3 closes the managed identity bypass and check the new authorization compatibility regressions

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread litellm/proxy/agent_endpoints/auth/managed_authorization.py
Comment thread litellm/proxy/auth/handle_jwt.py Outdated
@veria-ai

veria-ai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

This pull request integrates Microsoft Entra identity registration and authorization for agents, including delegated team permissions and JWT-based agent authentication.

Six issues have been addressed, but two authorization and budget-enforcement gaps remain. A multi-team user may bypass the granting team’s model and budget restrictions, while holders of keyless agent credentials can generate paid inference without a spend ceiling. These issues should be resolved before production use of autonomous agent identities.

Open issues (2)

Fixed/addressed: 6 · PR risk: 7/10

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Please review f254d22, including current main, repaired database-free JWT authentication, and fail-closed invocation for binding-only config targets

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@cursor review
Please verify f254d22 closes the binding-only invocation bypass and preserves database-free authentication for ordinary and unmanaged-agent JWTs

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review 00429f6: managed identities now use explicit inference, MCP, A2A and discovery routes; provider-resource endpoints are denied

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@veria-ai Please verify 00429f6 closes provider-resource access for managed Entra tokens and persisted agent keys; regression tests cover both paths

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@cursor review
Please review 00429f6, including explicit managed-agent route authorization and regression tests covering provider-resource denial and legitimate inference access

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread litellm/proxy/agent_endpoints/auth/managed_authorization.py
Comment thread litellm/proxy/auth/auth_checks.py
@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review 28e187f: configured model defaults now undergo managed-agent authorization and budget reservation. Previously withdrawn findings remain documented limitations.

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@veria-ai Please verify 28e187f closes the configured-default model bypass. Four live requests reproduced it; 35 additional authorization and reservation regressions pass.

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@cursor review
Please review 28e187f: managed inference resolves configured model defaults before grants and budget reservation, preserving non-managed request handling.

human: Final = await MCPRequestHandler.reload_admitted_user(user_id, requires_fresh_policy=True)
sources: Final = await MCPRequestHandler.admitted_subject_sources(human)
human_access: Final = await asyncio.gather(*(_strict_agent_access(source) for source in sources))
return frozenset().union(*(_granted_ids(access) for access in human_access))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: Preserve the team that grants delegated access

This union discards which team authorized the agent. A multi-team user with an unrestricted direct model list can use a grant from a model-restricted team to invoke any model allowed by the agent, because JWT authorization does not attach a team for multi-team users and therefore skips that team's model and budget enforcement. Return source-aware grants and carry a qualifying team into the request authorization context.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented and live-verified in dependent #43459; budgets ship in #43229. Please assess this prerequisite with its documented stack dependencies, not standalone rollout.

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Please review current tip 1b0162b. The stack now has four PRs; delegated-team authorization is isolated in #43459. Focused remote verification runs alongside CI. Please check prior findings and current diff

Comment thread litellm/proxy/agent_endpoints/auth/managed_authorization.py
@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Please review the current tip. The optional team-selector cleanup is absent from all four merge-base diffs; those six UI files match the original main merge-base, so incomplete group discovery is pre-existing and deferred. Identity now retains authoritative target rate policy; budgets bind explicit A2A billing to the path; PR4 preserves grant-team authority and consumes JWT verification once. Focused tests/live checks run in parallel with CI

Comment thread litellm/proxy/hooks/parallel_request_limiter_v3.py Outdated
@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Please review the current tip and confirm resolution of the focused findings. Actor/target token settlement now reuses recorded reservation scopes; delegated tests use module-boundary isolation. No unrelated features or selector cleanup were added. Fresh verification runs in parallel with CI

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Current tip 485bc29 applies the exact Ruff formatting correction only; behavioral patches are unchanged. Focused delegated tests168pass, rate settlement2pass, and actual Entra before/after confirm grant-team model, route and budget denial. Please confirm current-tip review outcomes; remaining live controls and CI are pending

if isinstance(evidence, AgentIdentityFailure):
raise_identity_failure(evidence)
if managed.mode == "autonomous":
return JWTAuthBuilderResult(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: Keyless agents bypass spend limits

This principal has no key, user, team, organization, or end-user budget, and agents expose spend tracking but no maximum budget. Consequently, _get_budget_counters() returns no counters and reserve_budget_for_request() exits before enforcing the new fail-closed setting, allowing anyone holding this agent credential to generate paid inference without a spend ceiling. Require a budget-bearing principal for autonomous identities or add an agent maximum-budget counter to reservation and enforcement.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agent spend enforcement is implemented in dependent #43229; granting-team enforcement is in #43459. These four stacked PRs ship together, not independently.

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@greptileai @veria-ai Please review 080de40: type-only rate fix verified. Agent budgets and delegated authorization remain in dependent #43229 and #43459.

@joshua-berri

Copy link
Copy Markdown
Contributor Author

@veria-ai Please refresh review: both remaining findings have verified fixes in dependent #43229 and #43459; this prerequisite is not standalone rollout.

This branch was successfully deployed

1 active deployment
e2e-changed — 080de402 Deployed Sep 27, 2026 by joshua-berri via oauth #1588
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants