https://github.com/beam-cloud/fastloop
A Python package for deploying stateful loops.
https://github.com/beam-cloud/fastloop
Last synced: 8 months ago
JSON representation
A Python package for deploying stateful loops.
- Host: GitHub
- URL: https://github.com/beam-cloud/fastloop
- Owner: beam-cloud
- Created: 2025-07-08T12:31:20.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-10-03T16:59:43.000Z (9 months ago)
- Last Synced: 2025-10-03T18:47:23.045Z (9 months ago)
- Language: Python
- Homepage: https://beam.cloud
- Size: 930 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastLoop
A Python package for building and deploying stateful loops. We use this at [beam.cloud](https://www.beam.cloud) to deploy agents.
## Installation
```bash
pip install fastloop
```
## Usage
### Basic Example
```python
from fastloop import FastLoop, LoopContext, LoopEvent
app = FastLoop(name="my-app")
@app.event("user_message")
class UserMessage(LoopEvent):
user_id: str
message: str
@app.loop(name="chat", start_event=UserMessage)
async def chat_loop(context: LoopContext):
user_msg = await context.wait_for(UserMessage, timeout=5.0)
print(f"User {user_msg.user_id} sent a message: {user_msg.message}")
# Your loop logic here
# If you want to stop the loop
context.stop()
# If you want to pause the loop
context.pause()
# By default, we just run it again
if __name__ == "__main__":
app.run(port=8000)
```
## Development
This project uses `uv` for dependency management.
```bash
# Install dependencies
uv sync
# Run tests
uv run pytest
# Build package
uv build
```