Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Python SDK

The Python SDK is an HTTP client that wraps the Akshi HTTP API. Use it for external tooling, dashboards, and orchestration scripts.

Installation

pip install akshi-sdk

Quick start

from akshi_sdk import AkshiClient

client = AkshiClient(base_url="http://127.0.0.1:3210", token="my-token")

if client.health().get("ok"):
    print("Runtime is healthy")

Client methods

MethodHTTPReturnsDescription
health()GET /api/v1/healthdictRuntime health check
status()GET /api/v1/statuslist[dict]All agent statuses
logs(since=0)GET /api/v1/logsdictLog entries, optionally filtered by sequence number
findings(since=0)GET /api/v1/findingsdictFindings, optionally filtered by sequence number
post_findings(records)POST /api/v1/findingsdictSubmit a batch of findings
broker_grants()GET /api/v1/broker/grantslist[dict]List active broker secret grants
revoke_broker_grant(grant_id)DELETE /api/v1/broker/grants/{id}dictRevoke a broker grant by ID
approvals()GET /api/v1/approvalsdictList pending and resolved approval requests
post_approval(payload)POST /api/v1/approvalsdictApprove or deny a pending approval request
a2a_tasks()GET /api/v1/a2a/tasksdictList A2A task statuses
reload()POST /api/v1/reloaddictHot-reload runtime configuration
events_sse(callback)GET /api/v1/agui/eventsSubscribe to SSE event stream (blocking)

FindingRecord

from dataclasses import dataclass

@dataclass(frozen=True)
class FindingRecord:
    source: str       # Agent name that produced the finding
    severity: str     # "critical" | "warning" | "info"
    file: str         # Origin file path
    summary: str      # Short description

Broker grants

# List all active grants
grants = client.broker_grants()
for grant in grants:
    print(f"{grant['agent']}: {grant['secret_name']}")

# Revoke a specific grant
client.revoke_broker_grant("grant-uuid-here")

Approvals

# List pending approvals
pending = client.approvals()

# Approve a request
client.post_approval({
    "request_id": "req-uuid",
    "decision": "approve"
})

A2A tasks

# List all A2A task statuses
tasks = client.a2a_tasks()
for task in tasks.get("tasks", []):
    print(f"{task['id']}: {task['status']}")

Hot reload

# Reload runtime.toml without restarting
result = client.reload()
print(result)

SSE event stream

def on_event(data: str):
    print(f"Event: {data}")

# Blocks until the connection closes
client.events_sse(on_event)

Error handling

All methods raise on non-2xx responses. The exception is a standard urllib.error.HTTPError.

from urllib.error import HTTPError

try:
    client.post_findings(records)
except HTTPError as e:
    print(f"{e.code}: {e.read().decode()}")