Cloud Mode
Connect your SDK to the AgentSudo dashboard for real-time monitoring.
Cloud Mode connects your Python SDK to the AgentSudo dashboard for real-time monitoring, analytics, and audit logs.
Quick Start
1. Get your API Key from the Dashboard
**2. Configure Cloud Mode:
import agentsudo
agentsudo.configure_cloud(api_key="as_your_api_key")
All permission checks will then appear in your dashboard.
Full Example
from agentsudo import Agent, sudo, configure_cloud
# Connect to dashboard
configure_cloud(api_key="as_your_api_key")
# Create an agent
support_bot = Agent(
name="SupportBot",
scopes=["read:customers", "read:orders"]
)
@sudo(scope="read:customers")
def get_customer(id: str):
return {"id": id, "name": "John Doe"}
@sudo(scope="write:refunds")
def process_refund(id: str):
return {"refunded": True}
# Run with session
with support_bot.start_session():
get_customer("123") # ✅ Allowed - green in dashboard
try:
process_refund("456") # ❌ Denied - red in dashboard
except PermissionError:
pass
Configuration
agentsudo.configure_cloud(
api_key="as_your_api_key", # Required
async_send=True # Optional (default: True)
)
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | - | Your project API key |
async_send | bool | True | Send events in background thread |
Using Environment Variables
export AGENTSUDO_API_KEY="as_your_api_key"
import os
import agentsudo
if api_key := os.environ.get("AGENTSUDO_API_KEY"):
agentsudo.configure_cloud(api_key=api_key)
Privacy
⚠️
Only permission metadata is sent. No function arguments, return values, or user data leaves your system.
Each event contains:
- Agent name
- Scope checked
- Allowed/denied result
- Function name
- Timestamp
Local-Only Mode
Without configure_cloud(), the SDK works fully offline:
from agentsudo import Agent, sudo
# No cloud = local only
agent = Agent(name="LocalBot", scopes=["read:data"])
with agent.start_session():
# Works offline, logs to console
pass
Why Use Cloud Mode?
- Team visibility — See all agent activity in one place
- Real-time monitoring — Watch permission checks as they happen
- Analytics — Track denial rates, active agents, and trends
- Audit compliance — Centralized logs for security reviews
💡
Cloud mode is optional. The SDK works fully offline with local JSON logging if you prefer.