AI prompts
base on A distributed workflow engine <h1 align="center">
<img src="docs/logo.svg" alt="tork" width="300px">
<br>
</h1>
<p align="center">
<a href="https://opensource.org/licenses/MIT">
<img src="https://img.shields.io/badge/license-MIT-_red.svg">
</a>
<a href="https://goreportcard.com/report/github.com/runabol/tork">
<img src="https://goreportcard.com/badge/github.com/runabol/tork">
</a>
<a href="https://github.com/runabol/tork/releases">
<img src="https://img.shields.io/github/release/runabol/tork">
</a>
<img src="https://github.com/runabol/tork/workflows/ci/badge.svg">
</p>
<p align="center">
<a href="#features">Features</a> •
<a href="https://www.tork.run/installation">Installation</a> •
<a href="https://www.tork.run">Documentation</a> •
<a href="#quick-start">Quick Start</a> •
<a href="https://www.tork.run/rest">REST API</a> •
<a href="https://www.tork.run/web-ui">Web UI</a>
</p>
Tork is a highly-scalable, general-purpose workflow engine.
## Features:
<h1 align="center">
<img src="docs/cli_v3.jpg" alt="tork" width="700px">
<br>
</h1>
- [REST API](https://www.tork.run/rest)
- [Highly extensible](https://www.tork.run/extend)
- Horizontally scalable
- Task isolation - tasks are executed within a container to provide isolation, idempotency, and in order to enforce resource [limits](https://www.tork.run/tasks#limits)
- Automatic recovery of tasks in the event of a worker crash
- Supports both stand-alone and [distributed](https://www.tork.run/installation#running-in-a-distributed-mode) setup
- Retry failed tasks
- [Middleware](https://www.tork.run/customize#middleware)
- [Pre/Post tasks](https://www.tork.run/tasks#pre-post-tasks)
- No single point of failure
- Task timeout
- [Full-text search](https://www.tork.run/rest#list-jobs)
- [Expression Language](https://www.tork.run/tasks#expressions)
- [Conditional Tasks](https://www.tork.run/tasks#expressions)
- [Parallel Tasks](https://www.tork.run/tasks#parallel-task)
- [For-Each Task](https://www.tork.run/tasks#each-task)
- [Subjob Task](https://www.tork.run/tasks#sub-job-task)
- [Task Priority](https://www.tork.run/tasks#priority)
- [Sandbox Mode](https://www.tork.run/runtime#sandbox-mode-experimental)
- [Secrets](https://www.tork.run/tasks#secrets)
- [Scheduled Jobs](https://tork.run/jobs#scheduled-jobs)
- [Web UI](https://www.tork.run/web-ui)
## Documentation
See [tork.run](https://tork.run) for the full documentation.
## Quick Start
1. Ensure you have [Docker](https://docs.docker.com/get-docker/) with API Version >= 1.42 (use `docker version | grep API` to check).
2. Download the binary for your system from the [releases](https://github.com/runabol/tork/releases/latest) page.
### Hello World
Start in `standalone` mode:
```
./tork run standalone
```
Submit a job in another terminal:
```yaml
# hello.yaml
---
name: hello job
tasks:
- name: say hello
image: ubuntu:mantic #docker image
run: |
echo -n hello world
- name: say goodbye
image: ubuntu:mantic
run: |
echo -n bye world
```
```bash
JOB_ID=$(curl \
-s \
-X POST \
--data-binary @hello.yaml \
-H "Content-type: text/yaml" \
http://localhost:8000/jobs | jq -r .id)
```
Query for the status of the job:
```bash
curl -s http://localhost:8000/jobs/$JOB_ID | jq .
{
"id": "ed0dba93d262492b8cf26e6c1c4f1c98",
"state": "COMPLETED",
...
"execution": [
{
...
"state": "COMPLETED",
}
],
}
```
### A slightly more interesting example
The following job:
1. Downloads a remote video file using a `pre` task to a shared `/tmp` volume.
2. Converts the first 5 seconds of the downloaded video using `ffmpeg`.
3. Uploads the converted video to a destination using a `post` task.
```yaml
# convert.yaml
---
name: convert a video
inputs:
source: https://upload.wikimedia.org/wikipedia/commons/1/18/Big_Buck_Bunny_Trailer_1080p.ogv
tasks:
- name: convert the first 5 seconds of a video
image: jrottenberg/ffmpeg:3.4-alpine
run: |
ffmpeg -i /tmp/input.ogv -t 5 /tmp/output.mp4
mounts:
- type: volume
target: /tmp
pre:
- name: download the remote file
image: alpine:3.18.3
env:
SOURCE_URL: "{{ inputs.source }}"
run: |
wget \
$SOURCE_URL \
-O /tmp/input.ogv
post:
- name: upload the converted file
image: alpine:3.18.3
run: |
wget \
--post-file=/tmp/output.mp4 \
https://devnull-as-a-service.com/dev/null
```
Submit the job in another terminal:
```
JOB_ID=$(curl \
-s \
-X POST \
--data-binary @convert.yaml \
-H "Content-type: text/yaml" \
http://localhost:8000/jobs | jq -r .id)
```
### More examples
Check out the [examples](examples/) folder.
## REST API
See the [REST API](https://www.tork.run/rest) documentation.
### Swagger Docs
Make sure you have CORS configured in your [config file](https://www.tork.run/config):
```toml
[middleware.web.cors]
enabled = true
```
Start Tork in `standalone` or `coordinator` mode.
```shell
go run cmd/main.go run standalone
```
Serve the Swagger Docs
```shell
docker compose up -d swagger
```
Visit [http://localhost:9000](http://localhost:9000)
## Web UI
[Tork Web](https://www.tork.run/web-ui) is a web based tool for interacting with Tork.
![Web UI](docs/webui.png "Web UI")
## License
Copyright (c) 2023-present Arik Cohen. Tork is free and open-source software licensed under the MIT License.
", Assign "at most 3 tags" to the expected json: {"id":"1706","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"