Agent DocsDeveloper documentation
Admin Guide

Execution Management

Stop agents, set limits, monitor running executions

Execution Management

How to stop agents, set execution limits, and monitor running executions.

Stopping Agents

From the Portal (users)

Click the red stop button (square icon) in the chat input while an agent is streaming. This:

  1. Closes the SSE stream immediately (no more tokens streamed)
  2. Sends a cancel request to the server (POST /api/chat/conversations/:id/cancel)
  3. The server sends a cancelWorkflow signal to Temporal
  4. The workflow checks the cancelled flag at the next iteration boundary and stops
  5. A RUN_CANCELLED event is published so any connected clients see the cancellation
  6. The next message from the user starts a fresh conversation

From the Admin Console (admins)

Navigate to Operations → Executions in the Admin Console. This page shows all currently running executions with:

  • Agent name, user, tenant, duration, token usage, status
  • Force Stop button per row — cancels that specific execution
  • Stop All button in the header — emergency-halts all running executions (with confirmation dialog)
  • Auto-refreshes every 5 seconds

The "Stop All" button accepts optional filters: by agent ID or tenant ID. All cancellations are recorded in the audit log with the admin's identity and reason.

Automatic (platform)

The platform automatically cancels executions in three scenarios:

Execution watchdog — A background job checks every 30 seconds for workflows that exceed their maxExecutionTimeMinutes (configurable per agent, default: 30 minutes). Timed-out workflows are cancelled with reason execution_timeout.

Cost circuit breaker — When an agent's daily cost cap is exceeded, all running workflows for that agent are cancelled. The cap is set in Admin Console → Agent → Admin Controls → Cost Controls.

Behavioral baseline anomaly — When the ML-based anomaly detector identifies a 3σ+ deviation in an agent's behavior (unusual tool usage, data access spikes, API rate anomalies), the agent is automatically suspended and its running workflows are cancelled.

Setting Execution Limits

Per-Agent Limits

Set in Admin Console → Agent Registry → click agent → Admin Controls tab:

SettingDescriptionDefault
Max Execution TimeMaximum minutes per execution before auto-cancel30 min
Max Tokens Per ExecutionMaximum total tokens (input + output) per executionUnlimited
Max Cost Per ExecutionMaximum cost ($) per executionUnlimited
Daily Cost CapMaximum daily spend for this agentUnlimited
Max Requests/MinuteRate limit on incoming requests60
Max Concurrent ExecutionsParallel execution limit10

These limits can be changed by an admin at any time, even after the agent is deployed. Changes take effect immediately — no agent restart required.

Per-User Limits

Set in Admin Console → Security & Users → click user → Rate Limits section:

SettingDescriptionDefault
Max Messages/MinuteMessage rate limit across all agents30
Max Daily CostDaily cost budget for this user$10.00
Max Daily TokensDaily token budget500,000
Max Concurrent ConversationsParallel active conversations5

Enforcement

Limits are enforced at multiple levels:

  • Message rate — checked before execution starts; returns HTTP 429 if exceeded
  • Cost budget — checked before each LLM call; blocks execution if budget exceeded
  • Concurrent — checked before workflow start; returns error if at capacity
  • Execution time — enforced by the watchdog (async, not blocking)
  • Token limit — checked after each LLM call; stops execution if exceeded

All limit violations are logged in the audit trail.

API Endpoints

Cancel a conversation

POST /api/chat/conversations/:conversationId/cancel

Cancels the active workflow for a conversation. Returns the workflow ID.

Admin: List running executions

GET /api/admin/executions/running?agentId=&tenantId=&minDurationMinutes=

Admin: Force-cancel an execution

POST /api/admin/executions/:workflowId/cancel
Body: { "reason": "Admin-provided reason" }

Admin: Emergency stop all

POST /api/admin/executions/cancel-all
Body: { "agentId": "optional", "tenantId": "optional", "reason": "Emergency" }

Returns { "cancelled": 12, "failed": 0 }.

Set per-user limits

PUT /api/admin/users/:userId/limits
Body: { "maxMessagesPerMinute": 10, "maxDailyCost": 5.0 }

Set per-agent admin controls

PUT /api/admin/agents/:agentId/admin-controls
Body: {
  "executionLimits": { "maxExecutionTimeMinutes": 15 },
  "costControls": { "dailyCostCap": 50.0 },
  "rateLimits": { "maxConcurrentExecutions": 3 }
}

Audit Trail

Every cancellation generates an audit event with:

  • Event type: execution.cancelled
  • Actor: user ID, admin ID, or system (for auto-cancellation)
  • Target: workflow ID
  • Reason: user_stop, admin_force_stop, admin_stop_all, cost_limit_exceeded, execution_timeout, behavioral_anomaly, hitl_timeout

Audit events are viewable in the Admin Console → Decision Audit page.