Metadata-Version: 2.4
Name: hexel
Version: 0.3.2
Summary: Hexel Studio SDK — deploy and run AI agents
Project-URL: Homepage, https://hexelstudio.com
Project-URL: Documentation, https://docs.hexelstudio.com
Project-URL: Repository, https://github.com/hexelstudio/python-sdk
Project-URL: Changelog, https://docs.hexelstudio.com/changelog
Author-email: Hexel Studio <support@hexelstudio.com>
License: MIT
License-File: LICENSE
Keywords: agents,ai,code-execution,compute,hexel,sandbox
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: websockets>=12.0
Provides-Extra: app
Requires-Dist: starlette>=0.37; extra == 'app'
Requires-Dist: uvicorn>=0.29; extra == 'app'
Provides-Extra: dev
Requires-Dist: jinja2; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.20; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.20; extra == 'otel'
Description-Content-Type: text/markdown

# Hexel Python SDK

The official Python SDK for [Hexel Studio](https://hexelstudio.com) — build, deploy, and run AI agents.

## Install

```bash
pip install hexel
```

## Quick Start

```python
from hexel import Hexel

client = Hexel(api_key="your_api_key")

# Create a sandbox and execute code
sandbox = client.compute.sandbox.create(tier="standard")
print(sandbox)  # {"vm_id": "...", "state": "allocated", ...}

# Register an agent
agent = client.compute.agent.register(
    name="my-agent",
    image="ghcr.io/org/agent:v1",
    capabilities=["chat", "streaming"],
)

# Deploy an agent
instance = client.compute.instance.deploy(agent["id"], env={"MODEL": "gpt-4"})
print(instance["endpoint"])  # https://zeal-isle-a620.compute.hexelstudio.com
```

## Authentication

Two authentication methods are supported:

```python
# API Key (recommended for development)
client = Hexel(api_key="studio_live_xxxx")

# OAuth Client Credentials (recommended for production)
client = Hexel(client_id="your_client_id", client_secret="your_client_secret")
```

Both methods exchange credentials for a short-lived STS token automatically. Tokens are cached and refreshed transparently.

## Sandboxes

Sandboxes are isolated execution environments allocated instantly.

```python
# Create
sandbox = client.compute.sandbox.create(tier="standard")

# Execute code (HTTP)
result = client.compute.sandbox.execute(sandbox["vm_id"], code="print(1+1)", language="python")

# List
sandboxes = client.compute.sandbox.list()

# Renew TTL
client.compute.sandbox.renew(sandbox["vm_id"], ttl_seconds=3600)

# Release
client.compute.sandbox.release(sandbox["vm_id"], recycle=True)

# Delete
client.compute.sandbox.delete(sandbox["vm_id"])
```

## Agents

Agents are Docker images registered in the Hexel registry.

```python
# Register
agent = client.compute.agent.register(
    name="fraud-detector",
    image="ghcr.io/org/fraud-agent:v1",
    capabilities=["fraud-detection"],
)

# List
agents = client.compute.agent.list()

# Get
agent = client.compute.agent.get("agent-id")

# Search
results = client.compute.agent.search(q="fraud")

# Delete
client.compute.agent.delete("agent-id")
```

## Instances

Instances are running deployments of agents with permanent endpoints.

```python
# Deploy
instance = client.compute.instance.deploy("agent-id", env={"MODEL": "gpt-4"})

# List
instances = client.compute.instance.list()

# Get
instance = client.compute.instance.get("deployment-id")

# Stop
client.compute.instance.stop("deployment-id")

# Redeploy
client.compute.instance.redeploy("deployment-id")

# Delete
client.compute.instance.delete("deployment-id")
```

## Configuration

```python
client = Hexel(
    api_key="...",
)
```

## Requirements

- Python 3.10+
- `httpx` for HTTP
- `websockets` for WebSocket connections

## License

MIT
