-
Notifications
You must be signed in to change notification settings - Fork 21
Add automation-creation plugin #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
malhotra5
wants to merge
6
commits into
main
Choose a base branch
from
add-automation-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+711
−0
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c3f622e
Add automation-creation plugin
openhands-agent 02c045b
Add automation skill and update plugin with upload instructions
openhands-agent c1a3e29
Update automation skill/plugin with correct API endpoints
openhands-agent 0631ec8
Add automation skill to default marketplace
openhands-agent c1c1743
Add SDK documentation and requirements to automation skill/plugin
openhands-agent ba82a55
Deduplicate automation-creation plugin, reference skill for API docs
openhands-agent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "name": "automation-creation", | ||
| "version": "1.0.0", | ||
| "description": "Create and manage OpenHands automations - scheduled tasks that run in sandboxes", | ||
| "author": { | ||
| "name": "OpenHands", | ||
| "email": "contact@all-hands.dev" | ||
| }, | ||
| "homepage": "https://github.com/OpenHands/extensions", | ||
| "repository": "https://github.com/OpenHands/extensions", | ||
| "license": "MIT", | ||
| "keywords": ["automation", "scheduling", "cron", "sandbox", "openhands"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Automation Creation Plugin | ||
|
|
||
| Interactive slash command for creating OpenHands automations via guided prompts. | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ``` | ||
| /automation:create | ||
| ``` | ||
|
|
||
| The agent guides you through: | ||
| 1. Uploading your code as a tarball (if needed) | ||
| 2. Setting a name, cron schedule, and entrypoint | ||
| 3. Creating the automation via the OpenHands Cloud API | ||
|
|
||
| ## Plugin vs Skill | ||
|
|
||
| This **plugin** provides the `/automation:create` slash command for interactive automation setup. | ||
|
|
||
| For comprehensive API documentation (all endpoints, SDK examples, validation rules), see the **[automation skill](../../skills/automation/SKILL.md)**. | ||
|
|
||
| ## Plugin Structure | ||
|
|
||
| ``` | ||
| automation-creation/ | ||
| ├── .claude-plugin/ | ||
| │ └── plugin.json # Plugin manifest | ||
| ├── commands/ | ||
| │ └── create.md # Slash command definition | ||
| └── README.md # This file | ||
| ``` | ||
|
|
||
| ## Related Resources | ||
|
|
||
| - **[Automation Skill](../../skills/automation/SKILL.md)** - Full API reference and SDK examples | ||
| - [OpenHands SDK Documentation](https://docs.openhands.dev/sdk) | ||
| - [OpenHands Cloud](https://app.all-hands.dev) | ||
| - [Cron Expression Reference](https://crontab.guru/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| allowed-tools: Bash(curl:*), Bash(tar:*), Bash(cat:*), Bash(echo:*), Bash(jq:*) | ||
| description: Create a new OpenHands automation with cron scheduling | ||
| --- | ||
|
|
||
| # Create OpenHands Automation | ||
|
|
||
| Guide the user through creating a new automation interactively. | ||
|
|
||
| **API Base URL:** `https://app.all-hands.dev/api/automation/v1` | ||
|
|
||
| **Full API Reference:** See [skills/automation/SKILL.md](../../../skills/automation/SKILL.md) for complete documentation on endpoints, validation rules, SDK examples, and cron syntax. | ||
|
|
||
| ## Workflow | ||
|
|
||
| ### Step 1: Ask About Code Location | ||
|
|
||
| Ask the user if they: | ||
| 1. **Have local code** - Needs to be uploaded as a tarball first | ||
| 2. **Have an existing URL** - Already hosted (S3, GCS, HTTPS, or previous upload) | ||
|
|
||
| ### Step 2: Upload Code (if needed) | ||
|
|
||
| If uploading local code: | ||
| ```bash | ||
| # Create tarball | ||
| tar -czf automation.tar.gz -C /path/to/code . | ||
|
|
||
| # Upload (max 1MB) | ||
| curl -X POST "https://app.all-hands.dev/api/automation/v1/uploads?name=UPLOAD_NAME" \ | ||
| -H "Authorization: Bearer ${OPENHANDS_API_KEY}" \ | ||
| -H "Content-Type: application/gzip" \ | ||
| --data-binary @automation.tar.gz | ||
| ``` | ||
|
|
||
| Extract `tarball_path` from response (e.g., `oh-internal://uploads/{uuid}`). | ||
|
|
||
| ### Step 3: Collect Required Fields | ||
|
|
||
| 1. **Name**: Descriptive name (1-500 characters) | ||
| 2. **Cron Schedule**: e.g., `0 9 * * 1` (Mondays at 9 AM UTC) | ||
| 3. **Tarball Path**: `oh-internal://`, `s3://`, `gs://`, or `https://` | ||
| 4. **Entrypoint**: e.g., `python main.py` or `uv run script.py` | ||
| 5. **Timezone** (optional): IANA timezone (default: UTC) | ||
| 6. **Setup Script** (optional): Relative path, e.g., `setup.sh` | ||
| 7. **Timeout** (optional): 1-600 seconds (default: 600) | ||
|
|
||
| ### Step 4: Create the Automation | ||
|
|
||
| ```bash | ||
| curl -X POST "https://app.all-hands.dev/api/automation/v1" \ | ||
| -H "Authorization: Bearer ${OPENHANDS_API_KEY}" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "name": "USER_PROVIDED_NAME", | ||
| "trigger": { | ||
| "type": "cron", | ||
| "schedule": "USER_PROVIDED_SCHEDULE", | ||
| "timezone": "USER_PROVIDED_TIMEZONE_OR_UTC" | ||
| }, | ||
| "tarball_path": "USER_PROVIDED_TARBALL_PATH", | ||
| "entrypoint": "USER_PROVIDED_ENTRYPOINT" | ||
| }' | ||
| ``` | ||
|
|
||
| ### Step 5: Present Result | ||
|
|
||
| **On success (HTTP 201):** Show automation ID, name, schedule, and status. | ||
|
|
||
| **On error:** Show the error message from the API response. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Automation Skill | ||
|
|
||
| Create and manage OpenHands automations - scheduled tasks that run SDK scripts in sandboxes on a cron schedule. | ||
|
|
||
| ## Triggers | ||
|
|
||
| This skill is activated by keywords: | ||
| - `automation` / `automations` | ||
| - `scheduled task` | ||
| - `cron job` / `cron schedule` | ||
|
|
||
| ## Features | ||
|
|
||
| - **Tarball Upload**: Upload your code (up to 1MB) for use in automations | ||
| - **Automation Creation**: Create cron-scheduled automations | ||
| - **Automation Management**: List, update, enable/disable, and delete automations | ||
| - **Manual Dispatch**: Trigger automation runs on-demand | ||
|
|
||
| ## API Base URL | ||
|
|
||
| All automation endpoints are at: `https://app.all-hands.dev/api/automation/v1` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1. Upload Your Code | ||
|
|
||
| ```bash | ||
| # Create tarball | ||
| tar -czf automation.tar.gz -C /path/to/code . | ||
|
|
||
| # Upload (max 1MB) | ||
| curl -X POST "https://app.all-hands.dev/api/automation/v1/uploads?name=my-code" \ | ||
| -H "Authorization: Bearer ${OPENHANDS_API_KEY}" \ | ||
| -H "Content-Type: application/gzip" \ | ||
| --data-binary @automation.tar.gz | ||
| ``` | ||
|
|
||
| ### 2. Create Automation | ||
|
|
||
| ```bash | ||
| curl -X POST "https://app.all-hands.dev/api/automation/v1" \ | ||
| -H "Authorization: Bearer ${OPENHANDS_API_KEY}" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "name": "My Automation", | ||
| "trigger": {"type": "cron", "schedule": "0 9 * * 1"}, | ||
| "tarball_path": "oh-internal://uploads/{upload_id}", | ||
| "entrypoint": "python main.py" | ||
| }' | ||
| ``` | ||
|
|
||
| ## API Endpoints | ||
|
|
||
| | Endpoint | Method | Description | | ||
| |----------|--------|-------------| | ||
| | `/api/automation/v1/uploads` | POST | Upload a tarball | | ||
| | `/api/automation/v1/uploads` | GET | List uploads | | ||
| | `/api/automation/v1/uploads/{id}` | GET | Get upload details | | ||
| | `/api/automation/v1/uploads/{id}` | DELETE | Delete upload | | ||
| | `/api/automation/v1` | POST | Create automation | | ||
| | `/api/automation/v1` | GET | List automations | | ||
| | `/api/automation/v1/{id}` | GET | Get automation | | ||
| | `/api/automation/v1/{id}` | PATCH | Update automation | | ||
| | `/api/automation/v1/{id}` | DELETE | Delete automation | | ||
| | `/api/automation/v1/{id}/dispatch` | POST | Trigger run | | ||
| | `/api/automation/v1/{id}/runs` | GET | List runs | | ||
|
|
||
| ## See Also | ||
|
|
||
| - [SKILL.md](SKILL.md) - Full API reference and examples |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.