Core Clients

Switch between Python and TypeScript code examples using the language tabs.
The Zaby instance provides several utility clients for health checks, runtime token management, approvals, and usage tracking.

Health

Check if the server is reachable. No authentication required.
health = await zaby.health.check()
Response:
{
  "status": "ok",
  "timestamp": "2026-06-24T12:00:00Z",
  "uptime": 1234.56
}

Runtime Token Families

Token families group related runtime tokens for bulk management.

List

families = await zaby.runtime_token_families.list()
Response:
{
  "items": [
    {"id": "fam_1", "status": "ACTIVE", "name": "Production Tokens", ...}
  ]
}

Revoke

Revoke an entire token family — invalidating all tokens within it:
await zaby.runtime_token_families.revoke(family_id)
Revoking a token family invalidates ALL tokens in that family immediately. Existing runtime sessions will be interrupted.

Runtime Token Policies

Policies control runtime token quotas — concurrent runs, TTL, max uses per token, and auto-rotation. Required for runtime tokens: A quota policy must exist and its id passed as quotaPolicyId when creating runtime tokens.

List

policies = await zaby.runtime_token_policies.list()

Create

policy = await zaby.runtime_token_policies.create({
    "name": "Default Policy",
    "externalAppId": app_id,
    "deploymentId": deployment_id,
    "maxConcurrentRuns": 10,
    "tokenTtlSeconds": 3600,
    "maxUsesPerToken": 50,
    "autoRotateEnabled": True,
    "rotateBeforeExpirySeconds": 120,
})
FieldTypeRequiredDescription
namestryesPolicy name
externalAppIdstryesExternal app this policy applies to
deploymentIdstryesDeployment this policy applies to
maxConcurrentRunsintnoMax concurrent runs allowed
tokenTtlSecondsintnoDefault TTL for tokens using this policy
maxUsesPerTokenintnoMax uses before a token expires
autoRotateEnabledboolnoEnable automatic token rotation
rotateBeforeExpirySecondsintnoSeconds before expiry to rotate
statusstrnoDefaults to "ACTIVE" if omitted

Get

policy = await zaby.runtime_token_policies.get(policy_id)

Update

await zaby.runtime_token_policies.update(policy_id, {
    "maxTokens": 10_000,
})

Runtime Token Grants

Revoke

await zaby.runtime_token_grants.revoke(grant_id, {
    "reason": "User deactivated",
})
FieldTypeRequiredDescription
reasonstryesReason for revoking the grant

Runtime Token Usage

Query token consumption stats:
usage = await zaby.runtime_token_usage.get({
    "agentId": "a1b2c3d4-...",
    "externalAppId": "app_123",
})
FieldTypeRequiredDescription
agentIdstryesFilter by agent
externalAppIdstryesFilter by external app

Approvals

Review and respond to agent-generated approval requests.
# List all pending approvals
approvals = await zaby.approvals.list()

# Approve a request
await zaby.approvals.approve(run_id, approval_id)

# Reject a request
await zaby.approvals.reject(run_id, approval_id)

Usage & Billing

Query agent-level usage metrics for billing and analytics:
usage = await zaby.usage.get_agent_usage({
    "agentId": "a1b2c3d4-...",
    "from": "2026-01-01",
    "to": "2026-06-01",
})
FieldTypeRequiredDescription
agentIdstryesAgent to query
fromstrnoStart date (ISO-8601)
tostrnoEnd date (ISO-8601)