Agents & Provisioning

Switch between Python and TypeScript code examples using the language tabs.
The AgentsClient manages the full agent lifecycle. Access it via zaby.agents.

Create an agent

body
dict
required
Agent configuration object
body.name
string
required
Display name for the agent
body.slug
string
required
URL-friendly identifier. Must be unique per tenant.
body.description
string
Human-readable description of the agent’s purpose
agent = await zaby.agents.create({
    "name": "Customer Support Agent",
    "slug": "support-agent",
    "description": "Handles customer inquiries",
})
id
string
Unique agent identifier
status
string
Initial status — always “DRAFT”
name
string
Display name
slug
string
URL identifier
createdAt
string
ISO-8601 creation timestamp
{
  "id": "a1b2c3d4-...",
  "name": "Customer Support Agent",
  "slug": "support-agent",
  "status": "DRAFT",
  "createdAt": "2026-06-24T12:00:00Z"
}

Getting Started

Create, publish, and deploy your first agent in 5 minutes.

Runtime Client

Start runs and stream agent responses.

Manage agents

The current SDK does not include dedicated get, list, update, or delete methods on AgentsClient. These can be performed via direct API calls using the provisioning endpoints:
  • List: GET /api/v1/provisioning/agentic-os/agents (cursor-based pagination)
  • Get: GET /api/v1/provisioning/agentic-os/agents/{agentId}
  • Update: PATCH /api/v1/provisioning/agentic-os/agents/{agentId}
  • Delete: DELETE /api/v1/provisioning/agentic-os/agents/{agentId}

Publish and deploy

Agents start in DRAFT status. Publishing creates a version snapshot; deploying makes it live.
1

Publish

version = await zaby.agents.publish(agent_id)
version_id = version["id"]
id
string
Version identifier (used for deployment)
2

Deploy

agent_version_id
string
required
Version ID from the publish step
environment
string
required
One of “TEST” or “PRODUCTION”
deployment = await zaby.deployments.create(agent_id, {
    "agentVersionId": version_id,
    "environment": "TEST",
})
deployment_id = deployment["id"]
The deployment returns immediately with status PENDING. Cloudflare provisioning runs in the background. The deployment transitions to ACTIVE after roughly 12 minutes. Calling getProvisioning() before the deployment is ACTIVE returns 404.
3

Get provisioning details

provisioning = await zaby.deployments.get_provisioning(deployment_id)

External apps

External apps represent your application that embeds Zaby agents. They bridge deployments to runtime tokens.

Create

name
string
required
Display name
slug
string
required
Unique identifier
allowedOrigins
string[]
CORS origins for browser-based runtime
tokenTtlSeconds
number
Default TTL for generated tokens
app = await zaby.external_apps.create({
    "name": "My Web App",
    "slug": "my-web-app",
    "allowedOrigins": ["https://app.example.com"],
    "tokenTtlSeconds": 600,
})

Manage

apps = await zaby.external_apps.list({"status": "ACTIVE"})
app = await zaby.external_apps.get(app_id)
await zaby.external_apps.update(app_id, {"name": "Updated Name"})
deploymentId
string
required
Deployment to bind
allowBrowserRuntime
boolean
Enable browser-based runtime
allowServerRuntime
boolean
Enable server-side runtime (required for ZabyRuntime)
allowApprovals
boolean
Enable approval requests during runs
await zaby.external_apps.bind_deployment(app_id, {
    "deploymentId": deployment_id,
    "allowServerRuntime": True,
})

Runtime tokens

Create disposable JWT tokens for the ZabyRuntime client.
A quota policy must be created first and its ID passed as quotaPolicyId. Without it, the server returns a 500 error: “Cloudflare runtime sync snapshot is missing quotaPolicyId”.
input
dict
required
Single object with all parameters
input.externalAppId
string
required
External app ID
input.deploymentId
string
required
Deployment ID
input.quotaPolicyId
string
required
Quota policy ID (create via runtimeTokenPolicies.create)
input.externalUserId
string
required
End-user identifier
input.externalSessionId
string
Session identifier
input.channel
string
Runtime channel: "server", "web", "mobile" (default: "server")
input.ttlSeconds
number
Token lifespan in seconds (default: 600)
input.maxUses
number
Maximum uses before token expires
input.scopes
string[]
Permission scopes for the token
token = await zaby.runtime_tokens.create({
    "externalAppId": app_id,
    "deploymentId": deployment_id,
    "quotaPolicyId": policy_id,
    "externalUserId": "user-123",
    "externalSessionId": "session-456",
    "channel": "server",
    "ttlSeconds": 600,
    "maxUses": 20,
})
runtime_token = token["token"]

Record feedback

Record runtime feedback using the runtime token context:
run_id
string
required
Run identifier
await zaby.runtime_tokens.record_feedback(run_id, {
    "rating": 5,
    "comment": "Excellent response!",
})

Attach tools & knowledge

await zaby.agents.attach_mcp_tool(agent_id, {"toolId": installation_id})
await zaby.agents.attach_knowledge_base(agent_id, {"knowledgeBaseId": kb_id})
await zaby.agents.attach_skill(agent_id, {"skillId": skill_id})

Test & run

result = await zaby.agents.test_run(agent_id, {"input": "Hello"})
run = await zaby.agents.start_run(agent_id, {"input": "Hello"})
run_id = run["runId"]
progress = await zaby.agents.get_run_progress(run_id)
events = await zaby.agents.list_run_events(run_id, {"limit": 100})
tokens = await zaby.agents.playground_runtime_tokens(agent_id)

Approvals

run_id
string
required
Run identifier
approval_id
string
required
Approval request identifier
approvals = await zaby.approvals.list()
await zaby.approvals.approve(run_id, approval_id)
await zaby.approvals.reject(run_id, approval_id)

Usage analytics

usage = await zaby.usage.get_agent_usage({
    "agentId": agent_id,
    "from": "2026-01-01",
    "to": "2026-06-01",
})

MCP Client

Manage MCP servers, tools, and installations.

Knowledge Bases

Create and manage knowledge bases with documents.

Memory Client

Store and retrieve agent memory items.

Intelligence Client

Signals, rollups, and improvement tracking.