Skip to content

Commit 35ba948

Browse files
committed
fixed README
1 parent c5de4ea commit 35ba948

1 file changed

Lines changed: 138 additions & 14 deletions

File tree

python-sdk/README.md

Lines changed: 138 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
# ExosphereHost Python SDK
2-
This is the official Python SDK for ExosphereHost and for interacting with ExosphereHost.
32

4-
## Node Creation
5-
You can simply connect to exosphere state manager and start creating your nodes, as shown in sample below:
3+
[![PyPI version](https://badge.fury.io/py/exospherehost.svg)](https://badge.fury.io/py/exospherehost)
4+
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
7+
The official Python SDK for [ExosphereHost](https://exosphere.host) - an open-source infrastructure layer for background AI workflows and agents. This SDK enables you to create distributed, stateful applications using a node-based architecture.
8+
9+
## Overview
10+
11+
ExosphereHost provides a robust, affordable, and effortless infrastructure for building scalable AI workflows and agents. The Python SDK allows you to:
12+
13+
- Create distributed workflows using a simple node-based architecture
14+
- Build stateful applications that can scale across multiple compute resources
15+
- Execute complex AI workflows with automatic state management
16+
- Integrate with the ExosphereHost platform for optimized performance
17+
18+
## Installation
19+
20+
```bash
21+
pip install exospherehost
22+
```
23+
24+
## Quick Start
25+
26+
### Basic Node Creation
27+
28+
Create a simple node that processes data:
629

730
```python
831
from exospherehost import Runtime, BaseNode
@@ -11,23 +34,124 @@ from pydantic import BaseModel
1134
class SampleNode(BaseNode):
1235
class Inputs(BaseModel):
1336
name: str
37+
data: dict
1438

1539
class Outputs(BaseModel):
1640
message: str
41+
processed_data: dict
42+
43+
async def execute(self) -> Outputs:
44+
print(f"Processing data for: {self.inputs.name}")
45+
# Your processing logic here
46+
processed_data = {"status": "completed", "input": self.inputs.data}
47+
return self.Outputs(
48+
message="success",
49+
processed_data=processed_data
50+
)
51+
52+
# Initialize the runtime
53+
Runtime(
54+
namespace="MyProject",
55+
name="DataProcessor",
56+
nodes=[SampleNode]
57+
).start()
58+
```
59+
60+
## Environment Configuration
61+
62+
The SDK requires the following environment variables for authentication with ExosphereHost:
63+
64+
```bash
65+
export EXOSPHERE_STATE_MANAGER_URI="your-state-manager-uri"
66+
export EXOSPHERE_API_KEY="your-api-key"
67+
```
68+
69+
## Key Features
70+
71+
- **Distributed Execution**: Run nodes across multiple compute resources
72+
- **State Management**: Automatic state persistence and recovery
73+
- **Type Safety**: Full Pydantic integration for input/output validation
74+
- **Async Support**: Native async/await support for high-performance operations
75+
- **Error Handling**: Built-in retry mechanisms and error recovery
76+
- **Scalability**: Designed for high-volume batch processing and workflows
77+
78+
## Architecture
79+
80+
The SDK is built around two core concepts:
81+
82+
### Runtime
83+
The `Runtime` class manages the execution environment and coordinates with the ExosphereHost state manager. It handles:
84+
- Node lifecycle management
85+
- State coordination
86+
- Error handling and recovery
87+
- Resource allocation
88+
89+
### Nodes
90+
Nodes are the building blocks of your workflows. Each node:
91+
- Defines input/output schemas using Pydantic models
92+
- Implements an `execute` method for processing logic
93+
- Can be connected to other nodes to form workflows
94+
- Automatically handles state persistence
1795

18-
async def execute(self, inputs: Inputs) -> Outputs:
19-
print(inputs)
20-
return self.Outputs(message="success")
96+
## Advanced Usage
2197

22-
# EXOSPHERE_STATE_MANAGER_URI and EXOSPHERE_API_KEY are required to be set in the environment variables for authentication with exospherehost
23-
runtime = Runtime(
24-
namespace="SampleNamespace",
25-
name="SampleNode"
26-
)
98+
### Custom Node Configuration
2799

28-
runtime.connect([SampleNode()])
29-
runtime.start()
100+
```python
101+
class ConfigurableNode(BaseNode):
102+
class Inputs(BaseModel):
103+
text: str
104+
max_length: int = 100
105+
106+
class Outputs(BaseModel):
107+
result: str
108+
length: int
109+
110+
async def execute(self) -> Outputs:
111+
result = self.inputs.text[:self.inputs.max_length]
112+
return self.Outputs(result=result, length=len(result))
30113
```
31114

115+
### Error Handling
116+
117+
```python
118+
class RobustNode(BaseNode):
119+
class Inputs(BaseModel):
120+
data: str
121+
122+
class Outputs(BaseModel):
123+
success: bool
124+
result: str
125+
126+
async def execute(self) -> Outputs:
127+
raise Exception("This is a test error")
128+
```
129+
Error handling is automatically handled by the runtime and the state manager.
130+
131+
## Integration with ExosphereHost Platform
132+
133+
The Python SDK integrates seamlessly with the ExosphereHost platform, providing:
134+
135+
- **Cost Optimization**: Leverage ExosphereHost's optimized infrastructure for significant cost savings
136+
- **Reliability**: Built-in fault tolerance and automatic recovery
137+
- **Scalability**: Automatic scaling based on workload demands
138+
- **Monitoring**: Integrated logging and monitoring capabilities
139+
140+
## Documentation
141+
142+
For more detailed information, visit our [documentation](https://docs.exosphere.host).
143+
144+
## Contributing
145+
146+
We welcome contributions! Please see our [contributing guidelines](https://github.com/exospherehost/exospherehost/blob/main/CONTRIBUTING.md) for details.
147+
32148
## Support
33-
For first-party support and questions, do not hesitate to reach out to us at <nivedit@exosphere.host>.
149+
150+
For support and questions:
151+
- **Email**: [nivedit@exosphere.host](mailto:nivedit@exosphere.host)
152+
- **Documentation**: [https://docs.exosphere.host](https://docs.exosphere.host)
153+
- **GitHub Issues**: [https://github.com/exospherehost/exospherehost/issues](https://github.com/exospherehost/exospherehost/issues)
154+
155+
## License
156+
157+
This SDK is licensed under the MIT License and the main project is licensend under Elastic License 2.0.

0 commit comments

Comments
 (0)