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

# Building Workflows

> A practical process for designing maintainable workflows.

Start from the data boundary, then add runtime dependencies and agents.

## 1. Define input

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
input {
    project_id: number
    task_id: number
}
```

## 2. Define secrets

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
secrets {
    api_key: string
}
```

Keep secrets small and explicit. Pass provider keys and MCP tokens through the executor request.

## 3. Add provider and model

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
provider llm from openai {
    endpoint: "https://api.openai.com/v1"
    api_key: secrets.api_key
}

model fast from llm {
    id: "gpt-4.1-mini"
}
```

## 4. Add schemas

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
schema task_summary {
    summary: string
    next_action: string
}
```

## 5. Add agents

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
agent summarize_task {
    model: model.fast
    instruction: "Summarize task {{ input.task_id }} in project {{ input.project_id }}."
    output: schema.task_summary
}
```

## 6. Add final output

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
output {
    task_id: input.task_id
    summary: agent.summarize_task.summary
    next_action: agent.summarize_task.next_action
}
```

## Review checklist

* Inputs and secrets match the executor payload.
* Provider and model declarations use the new `provider ... from ...` and `model ... from ...` syntax.
* Agent outputs are object-shaped or schema references.
* Tool runtime values use `bindings {}`.
* `uses` includes every tool, prompt, and resource an agent needs.
* Dependencies are clear from references.
