Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions marketplaces/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@
"openhands"
]
},
{
"name": "automation",
"source": "./automation",
"description": "Create and manage OpenHands automations - scheduled tasks that run SDK scripts in sandboxes. Use when creating cron-scheduled automations, uploading tarballs, or managing automation runs.",
"category": "integration",
"keywords": [
"automation",
"cron",
"scheduled-task",
"sandbox",
"openhands"
]
},
{
"name": "azure-devops",
"source": "./azure-devops",
Expand Down Expand Up @@ -471,6 +484,19 @@
"verification",
"sample"
]
},
{
"name": "automation-creation",
"source": "./plugins/automation-creation",
"description": "Interactive slash command for creating OpenHands automations. Provides /automation:create for guided cron-scheduled automation setup.",
"category": "integration",
"keywords": [
"automation",
"cron",
"scheduling",
"openhands",
"slash-command"
]
}
]
}
13 changes: 13 additions & 0 deletions plugins/automation-creation/.claude-plugin/plugin.json
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"]
}
38 changes: 38 additions & 0 deletions plugins/automation-creation/README.md
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/)
70 changes: 70 additions & 0 deletions plugins/automation-creation/commands/create.md
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.
70 changes: 70 additions & 0 deletions skills/automation/README.md
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
Loading
Loading