Quickstart
This guide covers SDK installation, first-agent registration, and your first gated invoke call. Estimated time: 20 to 30 minutes.
Prerequisites
- A Scalekix account (sign up free)
- Python 3.9+ or Node.js 18+
- A Scalekix API key from dashboard account settings
Step 1: Add the SDK
Install the Scalekix SDK using PyPI or npm:
pip install scalekix
npm install @scalekix/sdk
Step 2: Set up your API key
The SDK loads your Scalekix API key from the SKX_API_KEY environment variable. Define it in your shell or .env file:
export SKX_API_KEY="skx_live_your_api_key_here"
Alternatively, provide the key to the client constructor directly if secrets are managed through a different mechanism:
import scalekix
client = scalekix.Client(api_key="skx_live_your_api_key_here")
Step 3: Add an agent
Call the register() method to create a credential for your agent. Specify the agent name, permitted scopes, and credential lifetime during registration. This runs once during deployment, rather than at runtime.
import scalekix
agent = scalekix.register(
name="my-first-agent",
scopes=["db:read", "api:call"],
ttl_hours=720,
tags={"env": "development"}
)
# Store the agent object. The SDK handles
# credential refresh automatically.
print(agent.id) # skx://agent/my-first-agent/...
print(agent.name) # "my-first-agent"
register() whenever a process starts. If the name matches an agent already registered in your account, the SDK returns that existing agent.
Step 4: Send a gated invoke call
Route direct API calls through agent.invoke(). The Scalekix gateway validates the credential, enforces the scope, and forwards the request. Each call also generates a structured audit event.
response = agent.invoke(
target="https://your-api.example.com/data",
method="GET",
headers={"Accept": "application/json"}
)
print(response.status_code)
print(response.json())
When an agent requests an action beyond its declared scopes, the gateway responds with 403 and records the denied request:
try:
response = agent.invoke(
target="https://your-api.example.com/data",
method="DELETE"
)
except scalekix.ScopeViolationError as e:
print(e)
# ScopeViolationError: agent 'my-first-agent'
# attempted scope 'api:delete', not in
# declared scopes ['db:read', 'api:call']
Step 5: Open the audit log
Each invoke() call creates a log event in your dashboard at Agents → [agent name] → Activity. Events are also available through the API:
curl -H "Authorization: Bearer $SKX_API_KEY" \
"https://api.scalekix.com/v1/audit?agent_name=my-first-agent&limit=10"
Next steps
- API Reference for complete endpoint details
- AI Agent Credentials guide for production implementation patterns
- Multi-Agent Orchestration guide for pipeline scenarios
- Platform Overview for architecture and module information