Python SDK and CLI for the Celesto AI platform - Deploy and manage AI agents with built-in delegated access to user resources.
Celesto is a managed AI platform that enables you to:
- Deploy AI agents to production with automatic scaling and monitoring
- Manage delegated access to end-user resources (Google Drive, etc.) through GateKeeper
- Build faster with infrastructure handled for you
- Agent Deployment: Deploy your AI agents as containerized applications with zero infrastructure management
- GateKeeper: Secure delegated access management with OAuth and fine-grained permissions for user resources
- CLI & SDK: Flexible interfaces for both interactive usage and programmatic integration
- Project Organization: Organize your agents and access rules by projects
- Automatic Scaling: Your agents scale automatically based on demand
pip install celestoRequirements: Python 3.10 or higher
Sign up at celesto.ai and get your API key from Settings → Security.
export CELESTO_API_KEY="your-api-key-here"
export CELESTO_PROJECT_NAME="your-project-name" # Optional: set default projectfrom celesto.sdk import CelestoSDK
from pathlib import Path
with CelestoSDK() as client:
result = client.deployment.deploy(
folder=Path("./my-agent"),
name="my-agent",
description="My AI assistant",
project_name="My Project"
)
print(f"Deployed! Status: {result['status']}")The SDK supports two authentication methods:
export CELESTO_API_KEY="your-api-key"from celesto.sdk import CelestoSDK
client = CelestoSDK() # Automatically uses CELESTO_API_KEYfrom celesto.sdk import CelestoSDK
client = CelestoSDK(api_key="your-api-key")Use the context manager to ensure proper resource cleanup:
with CelestoSDK() as client:
deployments = client.deployment.list()
# Resources automatically cleaned upProjects are organizational units that group your deployments and access connections. You can specify a project by:
- Setting
CELESTO_PROJECT_NAMEenvironment variable - Passing
project_nameparameter to methods - If not specified, the SDK uses your first available project
Deployments are your AI agents running on Celesto's managed infrastructure. Each deployment:
- Runs in an isolated container
- Scales automatically based on load
- Can have custom environment variables
- Belongs to a specific project
GateKeeper manages delegated access to end-user resources (like Google Drive). It handles:
- OAuth authorization flows
- Connection management per user (subject)
- Fine-grained access rules (folder/file permissions)
- Secure credential storage
from pathlib import Path
result = client.deployment.deploy(
folder=Path("./my-agent"),
name="weather-bot",
description="A bot that provides weather information",
envs={
"OPENAI_API_KEY": "sk-...",
"DEBUG": "false"
},
project_name="My Project"
)
print(f"Deployment ID: {result['id']}")
print(f"Status: {result['status']}") # "READY" or "BUILDING"Parameters:
folder(Path): Directory containing your agent codename(str): Unique deployment namedescription(str, optional): Human-readable descriptionenvs(dict, optional): Environment variables for your agentproject_name(str, optional): Project to deploy to (defaults toCELESTO_PROJECT_NAMEor first project)
deployments = client.deployment.list()
for dep in deployments:
print(f"{dep['name']}: {dep['status']}")# Initiate delegated access for a user
result = client.gatekeeper.connect(
subject="user:john@example.com",
project_name="my-project",
provider="google_drive"
)
if oauth_url := result.get("oauth_url"):
print(f"User must authorize at: {oauth_url}")
# Send this URL to the user
elif result["status"] == "authorized":
print("User already connected!")
print(f"Connection ID: {result['connection_id']}")Parameters:
subject(str): Unique user identifier (e.g., "user:email@example.com")project_name(str): Your project nameprovider(str): OAuth provider (default: "google_drive")redirect_uri(str, optional): Custom OAuth callback URL
files = client.gatekeeper.list_drive_files(
project_name="my-project",
subject="user:john@example.com",
page_size=50,
include_folders=True
)
for file in files["files"]:
print(f"{file['name']} ({file['mimeType']})")
# Handle pagination
if next_token := files.get("next_page_token"):
more_files = client.gatekeeper.list_drive_files(
project_name="my-project",
subject="user:john@example.com",
page_token=next_token
)Parameters:
project_name(str): Your project namesubject(str): User identifierpage_size(int): Results per page (1-1000, default: 20)page_token(str, optional): Token for paginationfolder_id(str, optional): List specific folderquery(str, optional): Google Drive search queryinclude_folders(bool): Include folders in results (default: True)order_by(str, optional): Sort order
Restrict which files/folders a user can access:
# Allow access only to specific folders (recursive)
result = client.gatekeeper.update_access_rules(
subject="user:john@example.com",
project_name="my-project",
allowed_folders=["1A2B3C4D5E6F", "7G8H9I0J1K2L"], # Google Drive folder IDs
allowed_files=[] # Optional: specific file IDs
)
print(f"Access rules updated. Version: {result['version']}")Parameters:
subject(str): User identifierproject_name(str): Your project nameallowed_folders(list, optional): Folder IDs with recursive accessallowed_files(list, optional): Individual file IDsprovider(str, optional): Provider filter
result = client.gatekeeper.list_connections(
project_name="my-project",
status_filter="authorized" # or "pending", "failed"
)
for conn in result["connections"]:
print(f"{conn['subject']}: {conn['status']}")result = client.gatekeeper.revoke_connection(
subject="user:john@example.com",
project_name="my-project"
)
print(f"Revoked connection: {result['id']}")Remove all restrictions (grant full access):
# Get connection ID first
connections = client.gatekeeper.list_connections(project_name="my-project")
connection_id = connections["connections"][0]["id"]
# Clear rules
result = client.gatekeeper.clear_access_rules(connection_id)
print(f"Access unrestricted: {result['unrestricted']}") # TrueThe Celesto CLI provides command-line access to all SDK features.
# Deploy an agent
celesto deploy --project "My Project"
# List deployments
celesto ls# Get agent card
celesto a2a get-card --agent http://localhost:8000
# Additional A2A commands
celesto a2a --help# Show help
celesto --help
# Show version
celesto --versionThe SDK provides specific exception types for different error scenarios:
from celesto.sdk import CelestoSDK
from celesto.sdk.exceptions import (
CelestoAuthenticationError,
CelestoNotFoundError,
CelestoValidationError,
CelestoRateLimitError,
CelestoServerError,
CelestoNetworkError,
)
try:
with CelestoSDK() as client:
result = client.deployment.deploy(
folder=Path("./my-agent"),
name="my-agent",
project_name="My Project"
)
except CelestoAuthenticationError as e:
print(f"Authentication failed: {e}")
print("Check your API key at https://celesto.ai → Settings → Security")
except CelestoValidationError as e:
print(f"Invalid input: {e}")
except CelestoNotFoundError as e:
print(f"Resource not found: {e}")
except CelestoRateLimitError as e:
print(f"Rate limit exceeded. Retry after {e.retry_after} seconds")
except CelestoServerError as e:
print(f"Server error: {e}")
except CelestoNetworkError as e:
print(f"Network error: {e}")- CelestoAuthenticationError: Invalid API key or unauthorized (401/403)
- CelestoNotFoundError: Resource not found (404)
- CelestoValidationError: Invalid request parameters (400/422)
- CelestoRateLimitError: Rate limit exceeded (429) - includes
retry_afterattribute - CelestoServerError: Server-side errors (5xx)
- CelestoNetworkError: Network/connection failures
# For testing or custom deployments
client = CelestoSDK(
api_key="your-key",
base_url="https://custom-api.example.com/v1"
)Or via environment variable:
export CELESTO_BASE_URL="https://custom-api.example.com/v1"Always close the client when done, or use a context manager:
# Manual cleanup
client = CelestoSDK()
try:
deployments = client.deployment.list()
finally:
client.close()
# Context manager (recommended)
with CelestoSDK() as client:
deployments = client.deployment.list()
# Automatically closedfrom celesto.sdk import CelestoSDK
from pathlib import Path
import os
# Set environment
os.environ["CELESTO_API_KEY"] = "your-api-key"
with CelestoSDK() as client:
# Deploy agent
deployment = client.deployment.deploy(
folder=Path("./my-agent"),
name="production-bot-v2",
description="Production chatbot version 2",
envs={
"OPENAI_API_KEY": os.environ["OPENAI_API_KEY"],
"ENVIRONMENT": "production"
},
project_name="Production"
)
print(f"Deployed: {deployment['id']}")
print(f"Status: {deployment['status']}")
# List all deployments
all_deployments = client.deployment.list()
print(f"\nTotal deployments: {len(all_deployments)}")from celesto.sdk import CelestoSDK
with CelestoSDK() as client:
project = "my-saas-app"
user = "user:alice@example.com"
# Step 1: Initiate connection
conn = client.gatekeeper.connect(
subject=user,
project_name=project
)
if oauth_url := conn.get("oauth_url"):
print(f"Send user to: {oauth_url}")
# Wait for user to authorize...
# Step 2: Configure access rules (limit to specific folders)
rules = client.gatekeeper.update_access_rules(
subject=user,
project_name=project,
allowed_folders=["shared_folder_id_123"]
)
print(f"Access rules set: {rules}")
# Step 3: List accessible files
files = client.gatekeeper.list_drive_files(
project_name=project,
subject=user,
page_size=100
)
print(f"\nAccessible files: {len(files['files'])}")
for file in files["files"]:
print(f" - {file['name']}")
# Step 4: Revoke when done
# client.gatekeeper.revoke_connection(
# subject=user,
# project_name=project
# )- API Documentation: https://docs.celesto.ai/celesto-sdk
- Platform Guide: https://celesto.ai/docs
- Repository: https://github.com/CelestoAI/sdk
- Issues & Bugs: GitHub Issues
- Questions: Create a discussion on GitHub
- Email: support@celesto.ai
We welcome contributions! Please see our contributing guidelines in the repository.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Created and maintained by the Celesto AI team.
For more information about the Celesto platform, visit celesto.ai.