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

# generate • AI Agents Framework

> generate: Generate a workflow YAML file.

# generate

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**WorkflowAutoGenerator**](../classes/WorkflowAutoGenerator) class in the [**auto**](../modules/auto) module.

Generate a workflow YAML file.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def generate(pattern: str, merge: bool) -> str
```

## Parameters

<ParamField query="pattern" type="str" required={false} default="'sequential'">
  Workflow pattern - "sequential", "routing", "parallel", "loop", "orchestrator-workers", "evaluator-optimizer"
</ParamField>

<ParamField query="merge" type="bool" required={false} default="False">
  If True, merge with existing workflow file instead of overwriting
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  Path to the generated workflow file
</ResponseField>

## Uses

* `json.loads`
* `response.model_dump_json`
* `exists`
* `merge_with_existing_workflow`

## Used By

* [`main`](../functions/main)
* [`TrainModel.inference`](../functions/TrainModel-inference)
* [`TrainVisionModel.vision_inference`](../functions/TrainVisionModel-vision_inference)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai/praisonai/auto.py#L1129">
  `praisonai/auto.py` at line 1129
</Card>
