Skip to content

Agent Endpoints

AI agents are managed as identities with the type AI_AGENT. They include additional configuration for budget controls, token monitoring, prompt injection detection, and MCP server governance. This page covers agent-specific capabilities and the JIT request endpoints.

Agent Configuration

AI agents are created and managed through the Identity API with the type set to AI_AGENT and an agentConfig object that specifies agent-specific settings.

Agent Config Fields

FieldTypeDescription
modelstringAI model identifier (e.g., gpt-4, claude-3-opus, gemini-pro)
providerstringModel provider (e.g., openai, anthropic, google)
budgetLimitnumberMaximum spend in USD per budget period
budgetPeriodstringBudget period: daily, weekly, monthly
maxTokensPerRequestnumberMaximum tokens allowed per individual request
promptInjectionDetectionbooleanEnable prompt injection detection (default: true)
mcpServersstring[]Allowed MCP server identifiers for tool access
allowedToolsstring[]Allowed tool names (if MCP servers are configured)
blockedToolsstring[]Explicitly blocked tool names

Create an AI Agent

Terminal window
curl -X POST https://app.veraid.io/api/v1/identities \
-H "Authorization: Bearer kd_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"name": "customer-support-agent",
"type": "AI_AGENT",
"description": "Customer support AI agent for ticket triage and response drafting",
"tags": ["ai-agent", "customer-support", "production"],
"agentConfig": {
"model": "gpt-4",
"provider": "openai",
"budgetLimit": 500.00,
"budgetPeriod": "monthly",
"maxTokensPerRequest": 4096,
"promptInjectionDetection": true,
"mcpServers": ["crm-server", "knowledge-base"],
"allowedTools": [
"crm.getTicket",
"crm.updateTicket",
"kb.search",
"kb.getArticle"
],
"blockedTools": [
"crm.deleteCustomer",
"crm.exportData"
]
}
}'

AI Monitoring

VeraID tracks token usage and cost for every AI agent request, providing real-time visibility into agent spending and behavior.

Usage Tracking per Request

Each API call made by an AI agent records:

MetricDescription
promptTokensNumber of tokens in the prompt/input
completionTokensNumber of tokens in the completion/output
totalTokensTotal tokens consumed
costEstimated cost in USD based on model pricing
modelModel used for the request
latencyResponse time in milliseconds
toolCallsTools invoked during the request

Budget Monitoring

Query the current budget status for an AI agent:

Terminal window
curl -X GET https://app.veraid.io/api/v1/identities/id_agent123/budget \
-H "Authorization: Bearer kd_live_abc123..."

Response:

{
"identityId": "id_agent123",
"identityName": "customer-support-agent",
"budgetLimit": 500.00,
"budgetPeriod": "monthly",
"currentPeriod": {
"start": "2026-03-01T00:00:00Z",
"end": "2026-03-31T23:59:59Z"
},
"usage": {
"totalCost": 247.83,
"totalTokens": 12456789,
"requestCount": 8432,
"averageCostPerRequest": 0.029,
"projectedMonthlySpend": 412.72
},
"percentUsed": 49.6,
"status": "OK",
"thresholds": {
"warning": 80,
"critical": 95
}
}

Budget status values:

StatusDescription
OKUsage is below the warning threshold
WARNINGUsage exceeds the warning threshold (default: 80%)
CRITICALUsage exceeds the critical threshold (default: 95%)
EXCEEDEDBudget limit reached; requests are blocked

Usage History

Query historical usage data for an AI agent:

Terminal window
curl -X GET "https://app.veraid.io/api/v1/identities/id_agent123/usage?period=7d&granularity=1h" \
-H "Authorization: Bearer kd_live_abc123..."

Response:

{
"identityId": "id_agent123",
"period": "7d",
"granularity": "1h",
"dataPoints": [
{
"timestamp": "2026-03-19T09:00:00Z",
"cost": 12.45,
"tokens": 623400,
"requests": 412
},
{
"timestamp": "2026-03-19T10:00:00Z",
"cost": 15.22,
"tokens": 761000,
"requests": 503
}
],
"summary": {
"totalCost": 247.83,
"totalTokens": 12456789,
"totalRequests": 8432,
"peakHourlyCost": 28.91,
"peakHourlyRequests": 892
}
}

JIT Request Endpoints

Just-in-time (JIT) access requests allow agents and other identities to request temporary elevated permissions with human approval.

List JIT Requests

GET /api/v1/jit-requests

Query Parameters

ParameterTypeDescription
statusstringFilter by status: PENDING, APPROVED, DENIED, EXPIRED
identityIdstringFilter by requesting identity
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20)

Example Request

Terminal window
curl -X GET "https://app.veraid.io/api/v1/jit-requests?status=PENDING" \
-H "Authorization: Bearer kd_live_abc123..."

Example Response

{
"data": [
{
"id": "jit_abc123",
"identityId": "id_agent456",
"identityName": "customer-support-agent",
"status": "PENDING",
"requestedScopes": ["crm.writeTicket", "crm.escalate"],
"duration": "2h",
"justification": "Customer escalation requires write access to update ticket priority and assign to tier-2 support",
"requestedAt": "2026-03-19T10:15:00Z",
"expiresAt": null,
"approver": null,
"approvedAt": null,
"metadata": {
"ticketId": "TICKET-4521",
"customerId": "cust_xyz"
}
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 3,
"totalPages": 1,
"hasMore": false
}
}

Create JIT Request

POST /api/v1/jit-requests

Request Body

FieldTypeRequiredDescription
identityIdstringYesIdentity requesting elevated access
scopesstring[]YesScopes being requested
durationstringYesRequested duration (e.g., 30m, 2h, 1d)
justificationstringYesReason for the access request
metadataobjectNoAdditional context (ticket ID, incident reference, etc.)

Example Request

Terminal window
curl -X POST https://app.veraid.io/api/v1/jit-requests \
-H "Authorization: Bearer kd_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"identityId": "id_agent456",
"scopes": ["crm.writeTicket", "crm.escalate"],
"duration": "2h",
"justification": "Customer escalation requires write access to update ticket priority and assign to tier-2 support",
"metadata": {
"ticketId": "TICKET-4521",
"customerId": "cust_xyz"
}
}'

Example Response

{
"id": "jit_def789",
"identityId": "id_agent456",
"identityName": "customer-support-agent",
"status": "PENDING",
"requestedScopes": ["crm.writeTicket", "crm.escalate"],
"duration": "2h",
"justification": "Customer escalation requires write access to update ticket priority and assign to tier-2 support",
"requestedAt": "2026-03-19T10:30:00Z",
"notificationsSent": ["slack:#access-approvals", "email:security-team@company.com"],
"metadata": {
"ticketId": "TICKET-4521",
"customerId": "cust_xyz"
}
}

Get JIT Request

GET /api/v1/jit-requests/{id}

Example Request

Terminal window
curl -X GET https://app.veraid.io/api/v1/jit-requests/jit_def789 \
-H "Authorization: Bearer kd_live_abc123..."

Example Response

{
"id": "jit_def789",
"identityId": "id_agent456",
"identityName": "customer-support-agent",
"status": "APPROVED",
"requestedScopes": ["crm.writeTicket", "crm.escalate"],
"duration": "2h",
"justification": "Customer escalation requires write access to update ticket priority and assign to tier-2 support",
"requestedAt": "2026-03-19T10:30:00Z",
"approver": {
"id": "usr_admin001",
"name": "Bob Smith",
"email": "bob@company.com"
},
"approvedAt": "2026-03-19T10:32:00Z",
"credential": {
"id": "cred_jit_abc",
"expiresAt": "2026-03-19T12:32:00Z"
},
"expiresAt": "2026-03-19T12:32:00Z",
"metadata": {
"ticketId": "TICKET-4521",
"customerId": "cust_xyz"
}
}