Skip to main content

Atlas SDK for Python - Client library for Atlas Control Plane

Project description

Atlas SDK for Python

The official Python client library for the Atlas Control Plane API. This SDK enables AI agents to self-report their existence, configuration, and health to the Atlas Control Plane.

Installation

pip install ryora-atlas-sdk

Quickstart

Synchronous Client

from atlas_sdk import ControlPlaneClient, AgentConfiguration

# Create client (reads ATLAS_API_URL and ATLAS_API_KEY from environment)
client = ControlPlaneClient()

# Register your agent
client.register(
    name="my-agent",
    owner="team@company.com",
    configuration=AgentConfiguration(
        model_provider="anthropic",
        model_name="claude-sonnet-4-20250514",
        tools=["file_read", "file_write"],
    ),
)

# Heartbeats are sent automatically in the background
# Do your agent work here...

# Deregister when done
client.deregister()

Using Context Manager

The recommended way to use the client is with a context manager, which ensures proper cleanup:

from atlas_sdk import ControlPlaneClient, AgentConfiguration

with ControlPlaneClient() as client:
    client.register(
        name="my-agent",
        owner="team@company.com",
        configuration=AgentConfiguration(
            model_provider="anthropic",
            model_name="claude-sonnet-4-20250514",
            tools=["file_read"],
        ),
    )
    # Do work...
# Automatic deregistration on exit

Asynchronous Client

import asyncio
from atlas_sdk import AsyncControlPlaneClient, AgentConfiguration

async def main():
    async with AsyncControlPlaneClient() as client:
        await client.register(
            name="my-async-agent",
            owner="team@company.com",
            configuration=AgentConfiguration(
                model_provider="anthropic",
                model_name="claude-sonnet-4-20250514",
                tools=["web_search"],
            ),
        )
        # Do async work...

asyncio.run(main())

Configuration

Environment Variables

Variable Description Default
ATLAS_API_URL Control Plane API base URL (required)
ATLAS_API_KEY API key for authentication (required)
ATLAS_ENVIRONMENT Deployment environment (local, staging, production) Auto-detected
ATLAS_DISABLED Disable SDK entirely (true/1/yes) false
ATLAS_SKIP_CONTEXT_DETECTION Skip context auto-detection (true/1/yes) false

Client Options

client = ControlPlaneClient(
    base_url="https://api.atlas.example.com",  # Override ATLAS_API_URL
    api_key="your-api-key",                     # Override ATLAS_API_KEY
    timeout=30.0,                               # Request timeout in seconds
    fail_silently=True,                         # Log errors instead of raising (default: True)
    auto_detect_context=True,                   # Auto-detect deployment context (default: True)
    auto_heartbeat=True,                        # Enable background heartbeats (default: True)
    heartbeat_interval_seconds=300,             # Heartbeat interval (default: 5 minutes)
    max_retries=3,                              # Max retry attempts for transient errors
)

Deployment Context

The SDK automatically detects deployment context including:

  • hostname: Via socket.gethostname()
  • environment: Via ATLAS_ENVIRONMENT env var or hostname inference
  • has_internet_access: Via connectivity check
  • has_filesystem_access: Via container/sandbox detection

You can also provide explicit context:

from atlas_sdk import ControlPlaneClient, AgentConfiguration, DeploymentContext, ResourceLimits

client.register(
    name="my-agent",
    owner="team@company.com",
    configuration=AgentConfiguration(
        model_provider="anthropic",
        model_name="claude-sonnet-4-20250514",
        tools=["file_read"],
    ),
    deployment_context=DeploymentContext(
        hostname="prod-server-01",
        environment="production",
        has_internet_access=True,
        has_filesystem_access=False,
        resource_limits=ResourceLimits(
            max_memory_mb=4096,
            max_cpu_cores=2,
        ),
    ),
)

Manual Heartbeats

While heartbeats are sent automatically, you can send manual heartbeats with custom status and metrics:

from atlas_sdk import HeartbeatStatus

# Send a heartbeat with custom status
client.heartbeat(
    status=HeartbeatStatus.DEGRADED,
    metrics={
        "requests_processed": 1500,
        "error_rate": 0.02,
        "memory_usage_mb": 512,
    },
)

Updating Configuration

Update your agent's configuration after registration:

from atlas_sdk import AgentConfiguration

client.update_configuration(
    configuration=AgentConfiguration(
        model_provider="anthropic",
        model_name="claude-opus-4-20250514",  # Upgraded model
        tools=["file_read", "file_write", "shell"],
    ),
)

Error Handling

The SDK provides a comprehensive exception hierarchy:

from atlas_sdk import (
    AtlasError,              # Base exception for all SDK errors
    AtlasConnectionError,    # Network/connection errors (retryable)
    AuthenticationError,     # 401 - Invalid API key
    AuthorizationError,      # 403 - Insufficient permissions
    AtlasValidationError,    # 422 - Invalid request data
    RateLimitError,          # 429 - Rate limited (retryable)
    AgentNotFoundError,      # 404 - Agent not registered
    DuplicateAgentError,     # 409 - Agent ID conflict
)

try:
    client.register(...)
except AuthenticationError:
    print("Invalid API key")
except RateLimitError as e:
    print(f"Rate limited, retry after {e.retry_after} seconds")
except AtlasError as e:
    print(f"Atlas error: {e}")

Fail-Safe Mode

By default, the SDK operates in fail-safe mode (fail_silently=True), which means:

  • Errors are logged but don't crash your agent
  • Methods return None on failure
  • Your agent continues operating even if the Control Plane is unreachable

To receive exceptions instead:

client = ControlPlaneClient(fail_silently=False)

Retry Behavior

The SDK automatically retries transient errors with exponential backoff:

  • Connection errors
  • Rate limit errors (429)
  • Server errors (5xx)

Non-retryable errors (4xx except 429) fail immediately.

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run tests with coverage
pytest --cov=atlas_sdk --cov-report=term-missing

# Type checking
mypy src/

# Linting
ruff check src/ tests/
ruff format src/ tests/

License

Proprietary - Atlas Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ryora_atlas_sdk-1.2.0.tar.gz (50.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ryora_atlas_sdk-1.2.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file ryora_atlas_sdk-1.2.0.tar.gz.

File metadata

  • Download URL: ryora_atlas_sdk-1.2.0.tar.gz
  • Upload date:
  • Size: 50.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ryora_atlas_sdk-1.2.0.tar.gz
Algorithm Hash digest
SHA256 539e088dc285e09eba9b7de00fded987cd7bdbdf10353c4ac5b925385cf07c2a
MD5 a4092e855bc1f2bfe43b9e72a76c1e43
BLAKE2b-256 f03f9a534d8e926bc145abb1ac87e702959b94b81500c974c130050003c3b6de

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryora_atlas_sdk-1.2.0.tar.gz:

Publisher: python-sdk-release.yml on ryora-ai/atlas-monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ryora_atlas_sdk-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ryora_atlas_sdk-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4950fffc85439e96d93d03120d31e55831b2f1da2951cbf12652917a3d117bd
MD5 22e0db5ce048cae5b439e1162817bd3f
BLAKE2b-256 6664a81a9100eafdb212321786386455f64a661fa8a5e5b0ad67eed05d47af65

See more details on using hashes here.

Provenance

The following attestation bundles were made for ryora_atlas_sdk-1.2.0-py3-none-any.whl:

Publisher: python-sdk-release.yml on ryora-ai/atlas-monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page