> ## Documentation Index
> Fetch the complete documentation index at: https://docs.compozy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create & Publish

> Repository-based workflows are standalone projects that can be published and shared with other Compozy users. Workflows are defined using YAML configuration files that specify a series of tasks and their relationships.

### Repository Structure

Your workflow repository can be organized in any way you prefer. Here's a simple example:

```
my-workflow/
├── manifest.yaml      # Workflow metadata and configuration
├── README.md         # Documentation
├── src/              # Source directory (optional)
│   ├── workflow.yaml # Main workflow file
│   ├── tasks/        # Reusable task definitions
│   │   ├── data.yaml
│   │   └── notify.yaml
│   └── utils.yaml    # Additional workflow definitions
└── env.example      # Example environment variables
```

### Manifest File

The `manifest.yaml` defines your workflow's metadata, dependencies, and configuration:

```yaml theme={"dark"}
type: workflow
name: data-processor
version: 1.0.0
license: MIT
description: Workflow for processing and analyzing data streams
repository: https://github.com/your-org/data-processor
main: src/workflow.yaml  # Path to the main workflow file

tags:
  - data
  - processing
  - analytics

author:
  name: Your Name
  email: your.email@example.com
  organization: Your Organization

# Dependencies
dependencies:
  tasks:
    - compozy/tasks:data-transform@1.0.0
    - compozy/tasks:notification@1.0.0
  tools:
    - compozy/tools:api-client@1.0.0

# Default workflow configuration
config:
  max_concurrent: 3
  retry_policy:
    max_attempts: 3
    backoff: exponential
    initial_interval: 1s
```

### Workflow Definition

The main workflow file defines the actual workflow logic. This can be placed anywhere in your repository, just make sure to reference it in the `main` property of your manifest:

```yaml theme={"dark"}
name: data-processing-workflow
version: 1.0.0
description: Process and analyze data streams

# Environment variables
env:
  API_KEY: "{{ EXTERNAL_API_KEY }}"
  BATCH_SIZE: "{{ input.batch_size }}"

# Trigger configuration
trigger:
  type: webhook
  config:
    url: "/process-data"
    method: POST

# Task definitions
tasks:
  - id: fetch_data
    type: basic
    use: compozy/tools:api-client@1.0.0
    with:
      url: "{{ input.data_source }}"
      format: "{{ input.format }}"
    retry:
      attempts: 3
      backoff: exponential
      interval: 1s
    on_success:
      next: transform_data
    on_error:
      next: handle_error

  - id: transform_data
    type: basic
    use: compozy/tasks:data-transform@1.0.0
    with:
      data: "{{ tasks.fetch_data.output }}"
      batch_size: "{{ env.BATCH_SIZE }}"
    on_success:
      next: process_batches

  - id: process_batches
    type: parallel
    config:
      max_concurrent: "{{ config.max_concurrent }}"
      fail_fast: false
    execute:
      - use: compozy/tasks:batch-processor@1.0.0
        with:
          data: "{{ tasks.transform_data.output }}"
    on_complete:
      next: send_notification

  - id: send_notification
    type: basic
    use: compozy/tasks:notification@1.0.0
    with:
      message: "Data processing complete"
      data: "{{ tasks.process_batches.output }}"

  - id: handle_error
    type: basic
    use: compozy/tasks:error-handler@1.0.0
    with:
      error: "{{ error }}"
```

### Component Imports

As any other component, shared workflows can import and use various components from other files or packages:

<CodeGroup>
  ```yaml Import local file theme={"dark"}
  tasks:
    - id: process_data
      import: ./tasks/data.yaml
      with:
        data: "{{ trigger.data }}"
  ```

  ```yaml Using tasks theme={"dark"}
  tasks:
    - id: notify
      type: basic
      use: compozy/tasks:notification@1.0.0
  ```

  ```yaml Reference agent theme={"dark"}
  tasks:
    - id: analyze
      type: basic
      use: agent(data-analyzer)
      with:
        input: "{{ tasks.process_data.output }}"
  ```

  ```yaml Composing workflows theme={"dark"}
  tasks:
    - id: shared_flow
      import: ./utils.yaml
      with:
        context: "{{ trigger }}"
  ```
</CodeGroup>

You can reference:

* [Task Types](/core/tasks/types) - Basic, Parallel, Decision, etc.
* [Agents](/core/agents/overview) - AI-powered automation components
* [Tools](/core/tools/overview) - Utility functions and integrations
* [Shared Workflows](/core/workflows/composability) - Reusable workflow components

and all other components we have predefined on Compozy.

### Publishing

To publish your workflow to the Compozy registry:

<Steps>
  <Step title="Prepare Your Repository">
    * Initialize a GitHub repository
    * Set up CI/CD workflows
    * Include comprehensive documentation in README.md
  </Step>

  <Step title="Validate">
    Ensure your workflow configuration is valid:

    ```bash theme={"dark"}
    compozy workflow validate
    ```
  </Step>

  <Step title="Version and Release">
    * Use semantic versioning (MAJOR.MINOR.PATCH)
    * Create GitHub releases with detailed changelogs
    * Tag releases (e.g., `v1.0.0`)
  </Step>

  <Step title="Submit to Registry">
    Once your workflow is ready for distribution:

    ```bash theme={"dark"}
    # Login to Compozy CLI
    compozy login

    # Submit your workflow
    compozy publish
    ```

    After submission, our team will review your workflow to ensure it meets our quality and security standards. You'll receive notifications about the review process and when your workflow is approved and listed in the registry.
  </Step>
</Steps>

<Note>
  Make sure your workflow follows these best practices:

  * Use semantic versioning for your workflow versions
  * Include comprehensive documentation in README.md
  * Test your workflow thoroughly before publishing
  * Use environment variables for sensitive configuration
  * Implement proper error handling and retry policies
</Note>
