agentadmit/agentadmit-sdk

AgentAdmit SDK for PHP — User-mediated AI agent authorization for Laravel

Maintainers

Package info

github.com/PhoenixCo-Founder/agentadmit-sdk-php

Homepage

Documentation

pkg:composer/agentadmit/agentadmit-sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-github-main 2026-06-04 17:57 UTC

This package is auto-updated.

Last update: 2026-06-04 17:58:35 UTC


README

User-mediated AI agent authorization. Plug-and-play for any Laravel app.

Get started: Sign up at agentadmit.com → Get your test keys → Install the SDK → Build. Test keys are available immediately after signup. Live keys become available when you subscribe an app.

Quick Start

composer require agentadmit/laravel
php artisan vendor:publish --tag=agentadmit

Add your credentials to .env:

AGENTADMIT_APP_ID=app_yourappid
AGENTADMIT_API_KEY=aa_test_yourkey

Add scope enforcement to any route:

// routes/api.php
Route::middleware('agentadmit:read:orders')->get('/orders', [OrderController::class, 'index']);

Your app now supports AI agent connections with:

  • Scoped access control (you define the scopes)
  • User-controlled connection duration
  • Token generation and exchange
  • Mandatory introspection (every agent request validated through AgentAdmit)
  • Revocation and audit logging
  • Discovery endpoint at /.well-known/agentadmit

How It Works

  1. User clicks "AgentAdmit" in your app
  2. Selects scopes and connection duration
  3. Gets a token to give to their AI agent
  4. Agent exchanges the token for scoped API access
  5. User revokes anytime

The token goes to the human, not the agent. No automated delivery = no prompt injection surface.

Important

Mandatory introspection. All token validation goes through api.agentadmit.com. There is no self-hosted mode. No local JWT validation. No bypass. This is required for security, audit logging, and scope enforcement.

Admin revocation. As the app operator, you can revoke any user's agent connection via DELETE /agentadmit/admin/connections/{connection_id} (requires admin role or manage:connections scope).

Embeddable admin panel. Drop the <AgentAdmitAdminPanel> React component into your admin section to view all agent connections, usage metrics, billing status, and revoke any connection without leaving your app. See the React SDK for details.

In-app AI scopes. If your app has built-in AI features (analysis, plan generation, photo recognition), do not expose those as agent scopes. The user's AI agent can read the raw data and do the analysis itself. Exposing in-app AI endpoints to agents creates double cost.

Rate Limiting

The AgentAdmit introspection endpoint enforces rate limits. The PHP SDK handles HTTP 429 responses automatically with exponential backoff and jitter — no changes needed in your middleware code.

Retry behavior

Parameter Default Description
Initial delay 1 second First retry wait
Backoff multiplier Doubles each retry
Cap 30 seconds Maximum wait per retry
Jitter 0–500 ms Random addition to each delay
Max retries 3 Configurable

The SDK also respects the Retry-After response header — if present, it overrides the computed backoff delay.

Configuring max retries

In config/agentadmit.php or .env:

// config/agentadmit.php
'max_retries' => 5, // default: 3
AGENTADMIT_MAX_RETRIES=5

Handling exhausted retries

When all retries are exhausted, IntrospectionClient::verify() throws RateLimitException:

use AgentAdmit\RateLimitException;

try {
    $result = $client->verify($token);
} catch (RateLimitException $e) {
    return response()->json(['error' => 'rate_limited'], 429)
        ->header('Retry-After', $e->getRetryAfter() ?? 60);
}

RateLimitException methods:

  • getRetryAfter() — seconds from Retry-After header (null if absent)
  • getLimit()X-RateLimit-Limit header value (null if absent)
  • getRemaining()X-RateLimit-Remaining header value (null if absent)
  • getReset()X-RateLimit-Reset Unix timestamp (null if absent)

Documentation

Full integration guide: https://agentadmit.com/docs/app-owner-guide

Data Collection & Privacy

The AgentAdmit PHP SDK runs server-side and does not interact with app stores or end-user devices directly.

What the SDK does

  • Validates AgentAdmit tokens presented by AI agents
  • Enforces scope-based access control on your API routes
  • Manages connection lifecycle (create, revoke, audit)

What the SDK does NOT do

  • Does not collect end-user data
  • Does not send telemetry or analytics
  • Does not phone home to AgentAdmit servers (all operations use your configured keys and storage)
  • Does not track users or devices

Privacy impact

Since this SDK runs on your server, it has no direct App Store or Play Store compliance surface. Your client-side integration (e.g., the AgentAdmit React SDK) handles privacy manifest and data safety requirements.

For complete compliance guidance, see our compliance guide.

License

All rights reserved. Patent pending.

Security Alerts

use AgentAdmit\AlertsClient;
$alerts = new AlertsClient(config('agentadmit'));

Six alert type constants on AlertsClient.

Configure

$alerts->configureAlerts('app_abc123', AlertsClient::ALERT_TYPE_VOLUME_SPIKE, [
    'enabled' => true, 'threshold_value' => 100, 'threshold_window_minutes' => 5,
    'kill_switch_enabled' => true,
]);

List Events

$events = $alerts->listAlerts(appId: 'app_abc123', alertType: AlertsClient::ALERT_TYPE_VOLUME_SPIKE);

Get Config

$config = $alerts->getAlertConfig(appId: 'app_abc123');

Notifying Your Users

AgentAdmit detects anomalies, fires alerts, and (with kill switch) auto-revokes connections. How you notify your own users is up to you. AgentAdmit provides the data — you deliver it through your own system (in-app notifications, email, push, etc.).

  • Poll alerts — Use the SDK methods above from your backend to check for new events, then notify users through your existing system.
  • Webhook delivery (coming soon) — Configure a webhook URL in your AgentAdmit dashboard. When an alert fires, AgentAdmit POSTs the payload to your server.
  • React SDK — Embed the <AlertsPanel> component so users can view their own alert history and tighten thresholds.