Omium SDK for Python - Fault-tolerant agent operating system
Project description
Omium Python SDK
Python SDK for integrating Omium checkpoint and recovery capabilities into your agent workflows.
Installation
From PyPI (recommended)
python -m pip install --upgrade pip
python -m pip install omium
The package is signed and published via PyPI’s Trusted Publisher workflow so that no API
tokens are stored in the repository. Enable pip’s hash-checking mode or use pipx if you
need additional supply-chain guarantees.
From source (development)
cd omium-platform/sdk/python
python -m pip install -e ".[dev]"
Quick Start
1. Setup Client
from omium import OmiumClient
client = OmiumClient(checkpoint_manager_url="localhost:7001")
await client.connect()
client.set_execution_context(execution_id="exec_123", agent_id="agent_1")
2. Using @checkpoint Decorator
from omium import checkpoint
@checkpoint("validate_data", preconditions=["data is not None"])
async def validate_data(data: dict) -> dict:
assert data is not None
assert "value" in data
return {"validated": True, "data": data}
# Use the function
result = await validate_data({"value": 42})
3. Using Checkpoint Context Manager
from omium import Checkpoint
async with Checkpoint("important_state", client=client) as cp:
# Critical code here
result = await do_critical_thing()
cp.update_state(step="complete")
# Checkpoint saved automatically on exit
4. Manual Checkpoint Creation
checkpoint_id = await client.create_checkpoint(
checkpoint_name="manual_checkpoint",
state={"data": "important"},
preconditions=["data exists"],
postconditions=["data is valid"],
)
5. Rollback to Checkpoint
rollback_result = await client.rollback_to_checkpoint(
checkpoint_id="cp_123",
trigger_reason="manual rollback",
)
Features
- @checkpoint Decorator - Automatic checkpoint creation before/after function execution
- Checkpoint Context Manager - Manual checkpoint control with context manager
- Async gRPC Client - High-performance async communication with checkpoint-manager
- State Serialization - Automatic serialization of function arguments and results
- Pre/Post Conditions - Validation support for checkpoint creation
- Rollback Support - Rollback execution to any checkpoint
Examples
See examples/basic_checkpoint.py for complete examples.
Testing
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run with coverage
pytest tests/ --cov=omium --cov-report=html
API Reference
OmiumClient
Main client for checkpoint operations.
Methods
connect()- Connect to checkpoint-manager serviceclose()- Close connectionset_execution_context(execution_id, agent_id)- Set execution contextcreate_checkpoint(...)- Create a checkpointget_checkpoint(checkpoint_id)- Get checkpoint detailslist_checkpoints(execution_id)- List checkpoints for executionrollback_to_checkpoint(checkpoint_id)- Rollback to checkpointverify_checkpoint(checkpoint_id)- Verify checkpoint integrity
@checkpoint Decorator
@checkpoint(
name: str,
preconditions: Optional[List[str]] = None,
postconditions: Optional[List[str]] = None,
client: Optional[OmiumClient] = None,
execution_id: Optional[str] = None,
agent_id: Optional[str] = None,
)
Checkpoint Context Manager
Checkpoint(
name: str,
client: Optional[OmiumClient] = None,
execution_id: Optional[str] = None,
agent_id: Optional[str] = None,
preconditions: Optional[List[str]] = None,
postconditions: Optional[List[str]] = None,
)
Requirements
- Python >= 3.11
- grpcio >= 1.60.0
- protobuf >= 4.25.0
Development
Generating Proto Code
# From sdk/python directory
python -m grpc_tools.protoc \
--python_out=omium/proto \
--grpc_python_out=omium/proto \
--proto_path=../../shared/proto \
../../shared/proto/checkpoint/checkpoint.proto
Or use the script:
.\scripts\generate-proto.ps1 # Windows
./scripts/generate-proto.sh # Linux/Mac
License
Proprietary - Omium Platform
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file omium-0.2.3.tar.gz.
File metadata
- Download URL: omium-0.2.3.tar.gz
- Upload date:
- Size: 75.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54c722ea41669d27636a55d66e9ce62bfb419513b6e28bff9b824c6ea86d9405
|
|
| MD5 |
fac519d1484e389fbf624e84e37e3533
|
|
| BLAKE2b-256 |
92684c1b3fd214b52e50e3839a66afb95cf60b054bd16fbb1a2fb2099228fef1
|
Provenance
The following attestation bundles were made for omium-0.2.3.tar.gz:
Publisher:
sdk-publish.yml on Omium-ai/Omium-platform
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omium-0.2.3.tar.gz -
Subject digest:
54c722ea41669d27636a55d66e9ce62bfb419513b6e28bff9b824c6ea86d9405 - Sigstore transparency entry: 777786105
- Sigstore integration time:
-
Permalink:
Omium-ai/Omium-platform@2b3f258bfaa95cfd9b30db5467ed1c3b87f79128 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Omium-ai
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@2b3f258bfaa95cfd9b30db5467ed1c3b87f79128 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file omium-0.2.3-py3-none-any.whl.
File metadata
- Download URL: omium-0.2.3-py3-none-any.whl
- Upload date:
- Size: 90.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec382a672328a0c9406793cdcf05f541184146289769ca23c81dcbf3924b2fca
|
|
| MD5 |
e0fc8e63b6d56e69fe6ea037b814dae1
|
|
| BLAKE2b-256 |
e7bfb98c177d3b065140a97e1ca61f6dcd1919fc64aa99298b1c6666e65968d7
|
Provenance
The following attestation bundles were made for omium-0.2.3-py3-none-any.whl:
Publisher:
sdk-publish.yml on Omium-ai/Omium-platform
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
omium-0.2.3-py3-none-any.whl -
Subject digest:
ec382a672328a0c9406793cdcf05f541184146289769ca23c81dcbf3924b2fca - Sigstore transparency entry: 777786107
- Sigstore integration time:
-
Permalink:
Omium-ai/Omium-platform@2b3f258bfaa95cfd9b30db5467ed1c3b87f79128 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Omium-ai
-
Access:
internal
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@2b3f258bfaa95cfd9b30db5467ed1c3b87f79128 -
Trigger Event:
workflow_dispatch
-
Statement type: