Openhands integrated with aact
Project description
Openhands x AAct
Overview
This project integrates the Openhands framework with AAct to create a runtime environment for executing actions and handling events. The openhands_node.py file defines the OpenHands class, which is a node that processes actions and communicates with a runtime environment.
Project Structure
-
aact_openhands/: Contains the core implementation of the Openhands node and related utilities.openhands_node.py: Main implementation of the OpenHands node.utils.py: Contains utility classes and functions, includingAgentActionandActionType.__init__.py: Marks the directory as a Python package.
-
app.py: Flask server for managing AACT dataflow processes. -
tests/: Contains test files for the project.test_server.py: Unit tests for the Flask server endpoints.test_live_server.py: Integration tests for AACT command execution.__init__.py: Marks the directory as a Python package.
-
examples/: Contains example configuration files.openhands_node.toml: Configuration file for running the OpenHands node.
-
pyproject.toml: Configuration file for managing dependencies with Poetry.
Installation
To set up the project, ensure you have Python 3.12 installed. Then, follow these steps:
-
Install Poetry: If you haven't already, install Poetry for dependency management.
curl -sSL https://install.python-poetry.org | python3 -
-
Install Dependencies: Navigate to the project directory and install the dependencies.
poetry install
Setting Up Environment Variables
To run the OpenHands node, you need to set up your environment variables. Follow these steps:
-
Obtain Modal API Keys:
- Sign Up / Log In: Go to the Modal website and sign up or log in to your account.
- Navigate to API Keys: Once logged in, navigate to the API keys section, usually found under account settings.
- Generate API Keys: Generate a new API key pair. You should receive a
MODAL_API_TOKEN_IDand aMODAL_API_TOKEN_SECRET. - Secure Your Keys: Store these keys securely. Do not share them publicly or commit them to version control.
-
Create a
.envFile: Copy theenv.examplefile to a new file named.envin the root of your project directory:cp env.example .env
-
Edit the
.envFile: Open the.envfile and replace the placeholder values with your actual API keys and URLs:MODAL_API_TOKEN_ID=your_actual_modal_api_token_id MODAL_API_TOKEN_SECRET=your_actual_modal_api_token_secret
Flask Server
The project includes a Flask server (app.py) that manages AACT dataflow processes. The server provides the following endpoints:
GET /health: Health check endpointPOST /run-dataflow: Start a new AACT dataflow processGET /status: Get the status of the current process
Running the Server
To start the Flask server:
poetry run python app.py
The server will start on http://localhost:5000.
Testing
The project includes both unit tests and integration tests:
Running Tests
To run all tests:
./run_tests.sh
This script will:
- Run unit tests for the Flask server
- Start the Flask server
- Run integration tests for AACT command execution
- Clean up all processes and temporary files
Test Structure
-
Unit Tests (
tests/test_server.py):- Tests Flask server endpoints
- Verifies server responses and process management
- Runs without actual AACT process execution
-
Integration Tests (
tests/test_live_server.py):- Tests actual AACT command execution
- Verifies process startup and management
- Includes proper resource cleanup
Usage
Running the OpenHands Node
To run the OpenHands node with the provided configuration, use the following command:
poetry run aact run-dataflow examples/openhands_node.toml
Upon successful execution, you should see output similar to the following:
16:41:26 - openhands:INFO: openhands_node.py:120 - --------------------
16:41:26 - openhands:INFO: openhands_node.py:121 - RUNTIME CONNECTED
16:41:26 - openhands:INFO: openhands_node.py:122 - --------------------
16:41:26 - openhands:INFO: openhands_node.py:127 - Runtime initialization took 157.77 seconds.
Troubleshooting
If you encounter a ModuleNotFoundError, ensure that:
- The directory structure is correct, and
openhands_node.pyis located in theopenhandsdirectory. - The
openhandsdirectory contains an__init__.pyfile. - The
pyproject.tomlfile includes theopenhandspackage in the[tool.poetry.packages]section.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any questions or issues, please contact Arpandeep Khatua at arpandeepk@gmail.com.
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
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 aact_openhands-0.0.4.tar.gz.
File metadata
- Download URL: aact_openhands-0.0.4.tar.gz
- Upload date:
- Size: 227.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
265aa6d840f808ed8ac148c02189253e4915a8f9dcdeade7f9e8e2d5f533fd03
|
|
| MD5 |
c8ad8f7fae13c9f018115dbf3975f0d4
|
|
| BLAKE2b-256 |
24db16d68fc7109277d2b4d9ba58b0caa3219067ffc04e92e6cf0fe46ee2d763
|
File details
Details for the file aact_openhands-0.0.4-py3-none-any.whl.
File metadata
- Download URL: aact_openhands-0.0.4-py3-none-any.whl
- Upload date:
- Size: 313.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.12.8 Linux/6.5.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9b1b87aa115411a0d86af80f9fd3b0bf4794b4b29018dcbf6f2a84785b96f5
|
|
| MD5 |
c979ed30e24940cfac452a043455c70b
|
|
| BLAKE2b-256 |
28a5dd3e2c1ff69a272c563604ce90cae4d03d4b0227a4c263e10714cfb37237
|