SDK Quickstart
Secure your first AI agent with 3 lines of Python code. No configuration needed.
See AIM in Action in 60 Seconds!
The SDK includes an interactive demo agent. Run it and watch your dashboard update in real-time!
# After downloading the SDK:
unzip ~/Downloads/aim-sdk-python.zip
cd aim-sdk-python
pip install -e .
# Run the interactive demo!
python demo_agent.pyPrerequisites
- • AIM running at
http://localhost:3000(see Installation) - • Python 3.8+
Download the SDK
The SDK comes pre-configured with your credentials. No API keys to manage.
- 1. Login to AIM at
http://localhost:3000 - 2. Go to Settings → SDK Download
- 3. Click Download Python SDK
- 4. Extract to your projects folder:
unzip ~/Downloads/aim-sdk-python.zip
cd aim-sdk-python
pip install -e .Where to extract? Anywhere you keep your projects! Common locations: ~/projects, ~/dev, or ~/Desktop for quick testing.
Register Your Agent (1 Line)
Create a new Python file in the extracted SDK folder. The SDK auto-detects your agent type from imports!
from aim_sdk import secure
import langchain # SDK detects this!
# This single line:
# ✅ Auto-detects agent type from imports (langchain, crewai, anthropic, openai, etc.)
# ✅ Registers your agent with AIM
# ✅ Generates Ed25519 cryptographic keys
# ✅ Stores credentials securely
agent = secure("my-first-agent") # Auto-detected as "langchain"
# Or specify explicitly:
# from aim_sdk import secure, AgentType
# agent = secure("my-agent", agent_type=AgentType.CREWAI)
# Declare capabilities using decorators:
@agent.perform_action(capability="weather:fetch")
def fetch_weather(city):
return f"Weather in {city}: Sunny"Run it:
python my_agent.pylangchain, crewai → frameworkanthropic, openai → LLM providerFrameworks take priority. If you import both langchain and anthropic, agent type is langchain.
What just happened? Your agent is now registered in AIM with a unique cryptographic identity. Check the Agents page to see it!
Secure Your Actions
Add decorators to track and verify every action your agent takes. Risk levels are automatically detected!
from aim_sdk import secure
agent = secure("my-first-agent")
# Risk levels are AUTO-DETECTED from capability patterns!
@agent.perform_action(capability="weather:fetch") # Auto: low (read-only namespace)
def fetch_weather(city):
"""Every call is verified, logged, and monitored"""
return f"Weather in {city}: Sunny, 72°F"
@agent.perform_action(capability="email:send") # Auto: high (email namespace + send action)
def send_email(to, subject, body):
"""High-risk actions are flagged and closely monitored"""
print(f"Sending email to {to}: {subject}")
return True
@agent.perform_action(capability="db:delete") # Auto: high (delete action)
def delete_record(table, id):
"""Delete actions are automatically high-risk"""
print(f"Deleting {id} from {table}")
return True
# Override when you know better
@agent.perform_action(capability="api:internal", risk_level="critical")
def internal_admin_call():
"""Override auto-detection for internal APIs that need critical monitoring"""
return admin_api.call()
# JIT access for sensitive ops (waits for admin approval)
@agent.perform_action(capability="db:drop", jit_access=True) # Auto: critical
def drop_database(db_name):
"""This will PAUSE until an admin approves!"""
print(f"Dropping database: {db_name}")
return True
# Use your functions normally
result = fetch_weather("San Francisco")
print(result)
# This will send and be logged
send_email("user@example.com", "Hello", "Test message")weather:*, :read → lowdb:write, :update → medium:delete, email:* → highpayment:*, :admin → criticalSee the Action Decorators Guide for full pattern documentation.
View Activity in Dashboard
Open AIM at http://localhost:3000 and check:
- Agents → See your registered agent with trust score
- Activity → View all tracked actions with timestamps
- Audit Logs → Complete audit trail for compliance
Complete Working Example
Copy this entire file to get started immediately. Notice how risk levels are auto-detected:
"""
AIM SDK Quick Start Example
Run this file after downloading the SDK from your AIM dashboard.
Risk levels are AUTO-DETECTED from capability patterns!
"""
from aim_sdk import secure
# Initialize your secure agent
agent = secure("weather-bot")
# Risk levels are automatically detected - no need to specify!
@agent.perform_action(capability="weather:fetch") # Auto: low (weather namespace)
def get_weather(city: str) -> dict:
"""Fetch weather data - auto-detected as low risk"""
return {
"city": city,
"temperature": 72,
"condition": "Sunny"
}
@agent.perform_action(capability="db:read", resource="user_preferences") # Auto: low
def get_user_preferences(user_id: str) -> dict:
"""Read user data - auto-detected as low risk (read action)"""
return {
"user_id": user_id,
"preferred_unit": "fahrenheit",
"notifications": True
}
@agent.perform_action(capability="notification:send") # Auto: high
def send_weather_alert(user_id: str, message: str) -> bool:
"""Send notifications - auto-detected as high risk (notification + send)"""
print(f"📧 Sending to {user_id}: {message}")
return True
@agent.perform_action(capability="payment:charge") # Auto: critical
def charge_premium_subscription(user_id: str, amount: float) -> bool:
"""Financial operations - auto-detected as critical risk"""
print(f"💳 Charging {user_id}: ${amount}")
return True
# Override when you know better than auto-detection
@agent.perform_action(capability="api:internal", risk_level="critical")
def internal_admin_operation() -> dict:
"""Override: internal API that needs critical monitoring"""
return {"status": "ok"}
# Main execution
if __name__ == "__main__":
print("🚀 Weather Bot starting...")
# All risk levels are auto-detected!
weather = get_weather("San Francisco") # low
print(f"Weather: {weather}")
prefs = get_user_preferences("user_123") # low
print(f"User preferences: {prefs}")
send_weather_alert("user_123", f"It's {weather['temperature']}°F!") # high
print("✅ All actions completed and logged to AIM!")