Metadata-Version: 2.5
Name: condensationai
Version: 0.2.0
Summary: Condensation SDK for sandboxes and the shared Codegraff wallet
Project-URL: Documentation, https://workspaces.condensation.ai/docs/sdk
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# condensationai

Python SDK for Condensation sandboxes and the shared Codegraff wallet.
Requires Python 3.10+; no runtime dependencies.

```sh
pip install condensationai
```

Create a sandbox key at https://workspaces.condensation.ai/account after signing
in with Codegraff. Set `CONDENSATION_API_KEY` in your environment.

```python
from condensationai import Condensation

client = Condensation()
print(client.wallet()["purchasedMicroUsd"] / 1_000_000)
sandbox = client.create(language="python", auto_stop_minutes=5)
try:
    print(client.run(sandbox["id"], 'python -c "print(1 + 1)"')["result"])
finally:
    client.delete(sandbox["id"])
```

This first release routes sandbox operations through Codegraff's existing gateway
at its resource rates, not Condensation's fleet pricing. It spends shared
purchased credits. Condensation monthly bonuses do not fund this path. Stopped
sandboxes may incur storage charges; delete resources when finished. Key budgets
are gateway admission checks and may be exceeded by concurrent or running work.

Methods: `wallet`, `list`, `get`, `create`, `run`, `execution`, `cancel_execution`,
`upload_base64`, `download_base64`, `meter`, `stop`, `start`, `delete`. Use
`run(..., background=True)` for an asynchronous command and poll `execution`.
The SDK itself is synchronous. Current gateway file downloads are text-oriented;
arbitrary binary round trips are not guaranteed.

`Condensation(api_key=..., base_url=..., timeout=120)` accepts explicit options.
The default origin is `https://api.condensation.ai`. Keys are server-side secrets;
do not commit them. No request is retried automatically or follows redirects.
For uncertain mutations, inspect resource state before retrying.
`CondensationError.status` contains the HTTP status (zero for transport errors),
and `.details` contains the API error body.

## Own-fleet preview (0.2.0)

Use `client.fleet` for Condensation's own Cube infrastructure. The original
`client.create` API still uses the existing gateway provider and its pricing.

Own-fleet machines have 2 vCPU and 2000 MiB memory. Rates are $0.03/vCPU-hour
plus $0.01/GiB-hour, with ephemeral storage included. Leases are 60–1800 seconds.
Creation requires a UUID request ID, reserves purchased account credits, and is
never automatically retried. Preserve the same request ID after an uncertain
response. Confirm a terminal state after deletion to verify cleanup and settlement.

The fleet supports pricing, list, get, create, command execution, base64 file
upload/download (1 MB), and permanent deletion. Python and shell are available.
See https://workspaces.condensation.ai/docs/fleet for examples and MCP setup.

The Python distribution includes the `condensation-mcp` stdio command. Configure
`CONDENSATION_API_KEY` with an account-scoped key from the account page.
