Skip to main content

A workflow engine for AI agents

Project description

Stella Workflow

PyPI version Python Versions License Tests

A powerful, flexible workflow engine for AI agents and asynchronous task processing.

Features

  • Agent-Based Architecture: Define independent agents that communicate through messages
  • Asynchronous Processing: Built on Python's asyncio for efficient concurrent execution
  • State Management: Track and persist agent state across executions
  • Memory Storage: Store and retrieve data between agent invocations
  • Conditional Execution: Control agent execution based on dynamic conditions
  • Loop Processing: Process collections of items with built-in loop functionality
  • Redis Integration: Use Redis as a reliable message broker and storage backend
  • Extensible Design: Easily add new brokers, agents, and functionality

Installation

pip install stella-workflow

Quick Start

import asyncio
from stella_workflow.workflow import stella_agent
from stella_workflow.brokers import RedisBroker

# Create a broker
broker = RedisBroker({
    "host": "localhost",
    "port": 6379
})

# Define agents
@stella_agent(name="data_producer", broker=broker, topic="example_workflow")
async def data_producer():
    return {"message": "Hello from producer!"}

@stella_agent(name="data_consumer", broker=broker, topic="example_workflow", depends_on=["data_producer"])
async def data_consumer(message):
    producer_data = message["dependency_messages"]["data_producer"]["data"]
    print(f"Received: {producer_data['message']}")
    return {"status": "processed"}

async def main():
    # Connect to broker
    await broker.connect()
    
    try:
        # Start the workflow
        await stella_agent.start_workflow()
        
        # Wait for processing to complete
        await asyncio.sleep(2)
    finally:
        # Clean up
        await stella_agent.stop_workflow()
        await broker.close()

if __name__ == "__main__":
    asyncio.run(main())

Examples

The package includes several examples demonstrating different use cases:

  • Document Processor: Process different document types through a workflow
  • Bulk Email Processor: Send personalized emails to a list of users
  • State Memory Pipeline: Collect, process, and analyze data with state tracking
  • Message Flow: Create complex message flows between multiple agents
  • Multiple Producers: Handle messages from multiple producer agents

Check the examples/ directory for complete implementations.

Documentation

For detailed documentation, see:

Additional documentation is coming soon!

Development

Setup

# Clone the repository
git clone https://github.com/yourusername/stella-workflow.git
cd stella-workflow

# Install dependencies
pip install poetry
poetry install

Testing

# Run all tests
poetry run pytest

# Run specific tests
poetry run pytest tests/test_workflow.py

Linting

# Run linting
poetry run ruff check .

# Run formatting
poetry run ruff format .

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stella_workflow-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stella_workflow-0.1.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file stella_workflow-0.1.0.tar.gz.

File metadata

  • Download URL: stella_workflow-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stella_workflow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e395cea1a42aa853bb4dc27840e3be5794be55c0049c5b4e9b27542d17ec88ae
MD5 d313493a67590f87d29942c4054bdfb7
BLAKE2b-256 a6781cc74555342aaff9bdc27a006175d21e124c6eedb85ce4e08b859cca2bbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_workflow-0.1.0.tar.gz:

Publisher: python-publish.yml on stellaheystella/stella-workflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stella_workflow-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for stella_workflow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0086a3c449f1abdd15d7ea62307ff22177712d9c8de92b3c11a232446ba0085e
MD5 cc1b90c65e432f9ecbb5de8045f83518
BLAKE2b-256 813914f7374b90bc0fad34974ad4544014d80315192896bd08e521d1c719e0cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_workflow-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on stellaheystella/stella-workflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page