# workflows
Workflow management operations.
## Synopsis
```
datalab workflows <COMMAND>
```
## Description
Create, execute, and manage document processing workflows. Workflows allow you to chain multiple processing steps together for complex document pipelines.
---
## Commands
| [`create`](#create) | Create a new workflow |
| [`list`](#list) | List all workflows |
| [`get`](#get) | Get workflow details |
| [`execute`](#execute) | Execute a workflow |
| [`execution`](#execution) | Get execution status |
| [`delete`](#delete) | Delete a workflow |
| [`step-types`](#step-types) | List available step types |
---
## create
Create a new workflow.
### Synopsis
```
datalab workflows create [OPTIONS] --name <NAME> --steps <FILE>
```
### Options
| `--name <NAME>` | Workflow name **(required)** |
| `--steps <FILE>` | JSON file containing workflow steps **(required)** |
| `--team-id <ID>` | Team ID for ownership |
| `--timeout <SECS>` | Request timeout in seconds (default: 60) |
### Example
```bash
# Create workflow from steps file
datalab workflows create --name "invoice-processor" --steps workflow.json
```
Where `workflow.json` contains:
```json
{
"steps": [
{
"type": "convert",
"config": {
"output_format": "markdown"
}
},
{
"type": "extract",
"config": {
"schema": {
"fields": [
{"name": "total", "type": "number"}
]
}
}
}
]
}
```
### Output
```json
{
"workflow_id": "wf_abc123",
"name": "invoice-processor",
"created_at": "2024-01-15T10:30:00Z"
}
```
---
## list
List all workflows.
### Synopsis
```
datalab workflows list [OPTIONS]
```
### Options
| `--timeout <SECS>` | Request timeout in seconds | `60` |
### Example
```bash
datalab workflows list
```
### Output
```json
{
"workflows": [
{
"workflow_id": "wf_abc123",
"name": "invoice-processor",
"created_at": "2024-01-15T10:30:00Z"
}
]
}
```
---
## get
Get workflow details.
### Synopsis
```
datalab workflows get [OPTIONS] <WORKFLOW_ID>
```
### Arguments
| `<WORKFLOW_ID>` | Workflow ID |
### Options
| `--timeout <SECS>` | Request timeout in seconds | `60` |
### Example
```bash
datalab workflows get wf_abc123
```
### Output
```json
{
"workflow_id": "wf_abc123",
"name": "invoice-processor",
"steps": [
{"type": "convert", "config": {...}},
{"type": "extract", "config": {...}}
],
"created_at": "2024-01-15T10:30:00Z"
}
```
---
## execute
Execute a workflow.
### Synopsis
```
datalab workflows execute [OPTIONS] <WORKFLOW_ID> --input <FILE>
```
### Arguments
| `<WORKFLOW_ID>` | Workflow ID |
### Options
| `--input <FILE>` | JSON file containing input configuration **(required)** |
| `--timeout <SECS>` | Request timeout in seconds (default: 300) |
### Example
```bash
datalab workflows execute wf_abc123 --input input.json
```
Where `input.json` contains:
```json
{
"file_url": "https://example.com/invoice.pdf"
}
```
Or with a local file reference:
```json
{
"file_id": "file_xyz789"
}
```
### Output
```json
{
"execution_id": "exec_def456",
"workflow_id": "wf_abc123",
"status": "running",
"started_at": "2024-01-15T10:35:00Z"
}
```
---
## execution
Get execution status.
### Synopsis
```
datalab workflows execution [OPTIONS] <EXECUTION_ID>
```
### Arguments
| `<EXECUTION_ID>` | Execution ID |
### Options
| `--timeout <SECS>` | Request timeout in seconds | `60` |
### Example
```bash
datalab workflows execution exec_def456
```
### Output
```json
{
"execution_id": "exec_def456",
"workflow_id": "wf_abc123",
"status": "completed",
"started_at": "2024-01-15T10:35:00Z",
"completed_at": "2024-01-15T10:35:30Z",
"results": {
"step_0": {...},
"step_1": {...}
}
}
```
### Status Values
| `pending` | Waiting to start |
| `running` | Currently executing |
| `completed` | Finished successfully |
| `failed` | Execution failed |
---
## delete
Delete a workflow.
### Synopsis
```
datalab workflows delete [OPTIONS] <WORKFLOW_ID>
```
### Arguments
| `<WORKFLOW_ID>` | Workflow ID |
### Options
| `--timeout <SECS>` | Request timeout in seconds | `60` |
### Example
```bash
datalab workflows delete wf_abc123
```
### Output
```json
{
"deleted": true,
"workflow_id": "wf_abc123"
}
```
---
## step-types
List available step types.
### Synopsis
```
datalab workflows step-types [OPTIONS]
```
### Options
| `--timeout <SECS>` | Request timeout in seconds | `60` |
### Example
```bash
datalab workflows step-types
```
### Output
```json
{
"step_types": [
{
"type": "convert",
"description": "Convert document to structured format",
"config_schema": {...}
},
{
"type": "extract",
"description": "Extract structured data",
"config_schema": {...}
}
]
}
```
---
## Workflow Example
```bash
# 1. Check available step types
datalab workflows step-types
# 2. Create workflow definition file
cat > workflow.json << 'EOF'
{
"steps": [
{
"type": "convert",
"config": {"output_format": "markdown"}
},
{
"type": "extract",
"config": {
"schema": {
"fields": [{"name": "total", "type": "number"}]
}
}
}
]
}
EOF
# 3. Create the workflow
datalab workflows create --name "invoice-pipeline" --steps workflow.json
# 4. Create input configuration
cat > input.json << 'EOF'
{
"file_url": "https://example.com/invoice.pdf"
}
EOF
# 5. Execute the workflow
datalab workflows execute wf_abc123 --input input.json
# 6. Check execution status
datalab workflows execution exec_def456
```
---
## Related Commands
- [`convert`](convert.md) - Single document conversion
- [`extract`](extract.md) - Single document extraction
- [`files`](files.md) - Upload files for workflow input
---
## See Also
- [Workflows Tutorial](../tutorials/workflows.md)