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()
const 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()
const families = await zaby.runtimeTokenFamilies.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)
await zaby.runtimeTokenFamilies.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()
const policies = await zaby.runtimeTokenPolicies.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,
})
const policy = await zaby.runtimeTokenPolicies.create({
name: "Default Policy",
externalAppId: app_id,
deploymentId: deployment_id,
maxConcurrentRuns: 10,
tokenTtlSeconds: 3600,
maxUsesPerToken: 50,
autoRotateEnabled: true,
rotateBeforeExpirySeconds: 120,
});
| Field | Type | Required | Description |
|---|
name | str | yes | Policy name |
externalAppId | str | yes | External app this policy applies to |
deploymentId | str | yes | Deployment this policy applies to |
maxConcurrentRuns | int | no | Max concurrent runs allowed |
tokenTtlSeconds | int | no | Default TTL for tokens using this policy |
maxUsesPerToken | int | no | Max uses before a token expires |
autoRotateEnabled | bool | no | Enable automatic token rotation |
rotateBeforeExpirySeconds | int | no | Seconds before expiry to rotate |
status | str | no | Defaults to "ACTIVE" if omitted |
Get
policy = await zaby.runtime_token_policies.get(policy_id)
const policy = await zaby.runtimeTokenPolicies.get(policy_id);
Update
await zaby.runtime_token_policies.update(policy_id, {
"maxTokens": 10_000,
})
await zaby.runtimeTokenPolicies.update(policy_id, {
maxTokens: 10_000,
});
Runtime Token Grants
Revoke
await zaby.runtime_token_grants.revoke(grant_id, {
"reason": "User deactivated",
})
await zaby.runtimeTokenGrants.revoke(grant_id, {
reason: "User deactivated",
});
| Field | Type | Required | Description |
|---|
reason | str | yes | Reason for revoking the grant |
Runtime Token Usage
Query token consumption stats:
usage = await zaby.runtime_token_usage.get({
"agentId": "a1b2c3d4-...",
"externalAppId": "app_123",
})
const usage = await zaby.runtimeTokenUsage.get({
agentId: "a1b2c3d4-...",
externalAppId: "app_123",
});
| Field | Type | Required | Description |
|---|
agentId | str | yes | Filter by agent |
externalAppId | str | yes | Filter 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)
// List all pending approvals
const 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",
})
const usage = await zaby.usage.getAgentUsage({
agentId: "a1b2c3d4-...",
from: "2026-01-01",
to: "2026-06-01",
});
| Field | Type | Required | Description |
|---|
agentId | str | yes | Agent to query |
from | str | no | Start date (ISO-8601) |
to | str | no | End date (ISO-8601) |