# Swale Docs > Swale runs workflows of containers: a YAML workflow says which tasks run, in what order, and on which compute type, and each task that runs a container image runs on compute allocated to it. These docs cover the platform UI, the `swale` CLI, the workflow and task definition syntax, and the HTTP API. **For AI agents** These notes are for an AI agent that reads the docs on a user's behalf. Reading the docs: - Every page but the generated API reference has a Markdown copy at its address with `.md` added (the docs home's is https://docs.swale.io/index.md), and [llms-full.txt](https://docs.swale.io/llms-full.txt) holds the copy of every page [llms.txt](https://docs.swale.io/llms.txt) lists, in one file. Each copy opens with a short note: the page's kind, what it covers, and the CLI reference sections for the commands it uses. - The generated API reference has no Markdown copies; the [OpenAPI document](https://docs.swale.io/openapi/backend.json) describes the HTTP API. Facts that are easy to get wrong, about the CLI: - Files reach a repository and leave it only through the CLI, with `swale push` and `swale pull`. The platform UI cannot upload or download repository files. - When `SWALE_ACCOUNT_NAME` and `SWALE_ACCOUNT_TOKEN` are set, every command uses that account and token instead of the ones the CLI stored. - Without a terminal, the CLI asks for nothing: a command that needs a value or a confirmation fails and says what it needs. - The [CLI reference](https://docs.swale.io/reference/cli-reference.md) lists every command with its options. Please look an option up there rather than guess it. Facts that are easy to get wrong, about workflow files: - Every value an expression reads is text: an input set to `false` holds the text `false`, so it is compared with `'false'`. - A task's `uses` without `@` takes the version published most recently when the workflow is uploaded, and a newer version reaches the workflow only when it is uploaded or imported again. - A task that declares `terminate_on` has no outputs and exports nothing, since what it writes to `$WORKFLOW_TASK_OUTPUT` and `$WORKFLOW_ENV` is discarded; the tasks that wait on it reach it at `${{tasks..ip-address}}`. Facts that are easy to get wrong, about task definition files: - A task definition version cannot be changed once it is published, and a version string can be published only once per task definition name, even after it is deleted. - The `name` in a task definition file's frontmatter is its title. The name in its address, `/@`, which a workflow's `uses` names, is the one `swale task-definition publish --name` gives. Please ask the user before: - starting a workflow run, which bills allocated compute; - publishing a task definition version, which can never be changed or published again; - pushing or pulling files; - deleting anything; - making a task definition public; - changing an organization's members or teams, or anything about billing. Credentials: - Please never ask the user to paste a personal access token into the chat. The user can set the account name and token in the environment as `SWALE_ACCOUNT_NAME` and `SWALE_ACCOUNT_TOKEN`, or run `swale login` in their own terminal, which asks for the token without showing it. - Some actions can be done only in the platform UI: registering and, once signed in, adding a payment method, managing personal access tokens, and changing the account's email or password. The lists below follow the docs' sidebar, and each link opens a page's Markdown copy. ## Start here - [Getting started](https://docs.swale.io/getting-started.md): Follow the steps from a new account to your first workflow run, each linked to the page that walks you through it. ## Tutorials - [Tutorials](https://docs.swale.io/tutorials.md): Guided lessons take a new account from registration to a finished workflow run, one step at a time. - [Set up your account](https://docs.swale.io/tutorials/set-up-your-account.md): Register, verify your email and add a payment method, so your account's billing status is Active and it can run work. - [Log in with the CLI](https://docs.swale.io/tutorials/log-in-with-the-cli.md): Create a personal access token in the platform UI and use it to log the CLI in to your account. - [Create your first project](https://docs.swale.io/tutorials/create-your-first-project.md): Create a project and a repository with the CLI, push a file to the repository, and pull it back to check the round trip. - [Create a task definition](https://docs.swale.io/tutorials/create-a-task-definition.md): Write a task definition file that runs a container and returns an output, and publish its first version in your account, ready for your first workflow. - [Run your first workflow](https://docs.swale.io/tutorials/run-your-first-workflow.md): Write a workflow that runs your task definition, upload it to your project, start a run, watch it complete, and read the task's log. - [Set up an organization](https://docs.swale.io/tutorials/set-up-an-organization.md): Create an organization, add a member, create a project and a team, and give the team's members access to the project. ## How-to guides - [How-to guides](https://docs.swale.io/how-to-guides.md): Short task guides cover one job at a time, from managing your account and projects to running workflows and reading your bill. - [Manage account settings](https://docs.swale.io/how-to-guides/manage-account-settings.md): Set your avatar, change your account name, email, password or workflow storage size, and delete your personal account. - [Manage multi-factor authentication](https://docs.swale.io/how-to-guides/manage-multi-factor-authentication.md): Turn on multi-factor authentication for your sign-in, keep a recovery code, sign in with a code, and turn it off or recover when you lose your app. - [Switch between accounts](https://docs.swale.io/how-to-guides/switch-between-accounts.md): Move between your personal account and the organizations you belong to, in the platform UI and in the CLI. - [Manage personal access tokens](https://docs.swale.io/how-to-guides/manage-personal-access-tokens.md): Create, regenerate, rename and delete the personal access tokens the CLI and the API authenticate with. - [Connect and manage GitHub integration](https://docs.swale.io/how-to-guides/connect-and-manage-github-integration.md): Connect your GitHub user, add GitHub accounts and organizations, change which repositories Swale can read, and disconnect one. - [Create and manage organizations](https://docs.swale.io/how-to-guides/create-and-manage-organizations.md): Create an organization, then set its avatar, rename it, change its workflow storage size, require MFA of its members, or delete it. - [Manage organization members](https://docs.swale.io/how-to-guides/manage-organization-members.md): Add people to an organization, change their roles, remove them, and leave an organization yourself. - [Manage teams](https://docs.swale.io/how-to-guides/manage-teams.md): Create, rename and delete an organization's teams, add and remove their members, and choose which projects each team gives access to. - [Create and manage projects](https://docs.swale.io/how-to-guides/create-and-manage-projects.md): Create, list, rename, delete and restore projects, and change the workflow storage size a project's runs get. - [Create and manage repositories](https://docs.swale.io/how-to-guides/create-and-manage-repositories.md): Create, list, delete and restore the repositories that keep a project's files. - [Push and pull files](https://docs.swale.io/how-to-guides/push-and-pull-files.md): Upload files from your machine to a repository tag with swale push, and download a tag's files with swale pull. - [Manage tags](https://docs.swale.io/how-to-guides/manage-tags.md): List a repository's tags, point a new tag at an existing snapshot, replace a tag, and delete one. - [Cache files between runs](https://docs.swale.io/how-to-guides/cache-files-between-runs.md): Use a repository tag as a cache for dependencies and build outputs that a workflow would otherwise rebuild on every run. - [Manage account secrets](https://docs.swale.io/how-to-guides/manage-account-secrets.md): Create, list, update and delete account secrets, and choose which of the account's projects may use each one. - [Manage project secrets](https://docs.swale.io/how-to-guides/manage-project-secrets.md): Create, list, update and delete a project's own secrets, and see which account secrets the project can use. - [Use secrets in workflows](https://docs.swale.io/how-to-guides/use-secrets-in-workflows.md): Pass a secret's value to a task through its arguments, check that the value is masked in the task's log, and override an account secret for one project. - [Create and manage workflows](https://docs.swale.io/how-to-guides/create-and-manage-workflows.md): Create a workflow from a YAML file, replace its definition with a new file, check what was saved, and delete a workflow. - [Import a workflow from GitHub](https://docs.swale.io/how-to-guides/import-workflow-from-github.md): Import a workflow definition from a file in a connected GitHub repository, and re-import it when the file changes. - [Start and manage workflow runs](https://docs.swale.io/how-to-guides/start-and-manage-workflow-runs.md): Start a run of a workflow with its inputs, follow its tasks as they run, cancel it, and delete it once it has ended. - [View and stream task logs](https://docs.swale.io/how-to-guides/view-and-stream-task-logs.md): Read a task's log in the platform UI, or fetch and follow it live with the CLI. - [Create and manage task definitions](https://docs.swale.io/how-to-guides/create-and-manage-task-definitions.md): Create a task definition, publish versions, list and inspect them, make one public or private, and delete a version or a whole task definition. - [Use a task image from a private registry](https://docs.swale.io/how-to-guides/use-a-task-image-from-a-private-registry.md): Keep a private registry's username and password in secrets, and give a workflow's task the credentials to pull its image. - [Use expressions in task arguments](https://docs.swale.io/how-to-guides/use-expressions-in-task-arguments.md): Pass run inputs, other tasks' outputs, functions and fallbacks into a task's arguments with expressions. - [Use conditional logic in workflows](https://docs.swale.io/how-to-guides/use-conditional-logic-in-workflows.md): Branch a workflow with an if task, on another task's output or on a run input, and check which branch a run took. - [Iterate over a list with for_each](https://docs.swale.io/how-to-guides/iterate-over-a-list-with-for-each.md): Run a block of tasks once for each item in a list, from another task's output or a run input, and inspect each iteration. - [View usage and billing](https://docs.swale.io/how-to-guides/view-usage-and-billing.md): Read your account's usage and what it has cost so far, open your billing settings, and restore an Active billing status. - [Use Swale with an AI coding assistant](https://docs.swale.io/how-to-guides/use-swale-with-an-ai-coding-assistant.md): Install the Swale skills so an AI coding assistant can run the CLI and write workflow and task definition files for you. ## Examples - [Examples](https://docs.swale.io/examples.md): Start from a complete workflow for a machine-learning job, with its steps, inputs and output, its workflow file and the commands that run it. - [Generate responses over a dataset](https://docs.swale.io/examples/generate-responses.md): Answers every prompt in a Hugging Face dataset with a chat model through vLLM batch inference and saves prompts and answers as Parquet. - [Label a text dataset with an LLM](https://docs.swale.io/examples/label-text.md): Labels every text in a dataset with one of a fixed set of labels, using a chat model through vLLM batch inference, and measures agreement with existing labels. - [Classify images with a vision-language model](https://docs.swale.io/examples/classify-images.md): Labels each image with one of a fixed set of labels, using a vision-language model through vLLM batch inference, and measures agreement with existing labels. - [Detect objects with a vision-language model](https://docs.swale.io/examples/detect-objects.md): Asks a vision-language model for the bounding boxes of chosen objects in every image, compares the counts with annotations, and draws boxes on samples. - [Caption a video](https://docs.swale.io/examples/caption-video.md): Extracts frames from a video at a fixed interval, captions each one with a vision-language model, and writes a summary of the whole video from the captions. - [OCR pages with a vision-language model](https://docs.swale.io/examples/ocr-pages.md): Renders each page of a PDF to an image and has a vision-language model transcribe every page to Markdown, then joins the pages into one document. - [Generate synthetic chain-of-thought data](https://docs.swale.io/examples/synthetic-reasoning-data.md): Has a reasoning model solve math questions step by step and a judge model check each answer, and keeps the correct solutions as a fine-tuning dataset. - [Score answers with an LLM as a judge](https://docs.swale.io/examples/llm-as-a-judge.md): Answers a set of prompts with one model, has a stronger judge model score every answer from 1 to 10, and summarizes the scores. - [Convert PDFs to a Markdown dataset](https://docs.swale.io/examples/pdfs-to-markdown.md): Converts a list of PDFs to Markdown with Docling, one task per document, and collects the results into one Parquet dataset. - [Extract text from scanned images with Tesseract](https://docs.swale.io/examples/scans-to-text.md): Reads the text of a list of scanned page images with Tesseract, one task per image, and collects the text and word confidences into one Parquet dataset. - [Transcribe audio](https://docs.swale.io/examples/transcribe-audio.md): Transcribes a list of audio or video files with whisper.cpp, one task per file, into text and subtitles, and collects the transcripts into one Parquet file. - [Build a speech dataset](https://docs.swale.io/examples/speech-dataset.md): Transcribes recordings with whisper.cpp, cuts them into one clip per transcribed segment, and packages clips and text as a Parquet speech-recognition dataset. - [Profile, filter and re-pack a dataset](https://docs.swale.io/examples/dataset-statistics.md): Profiles a Parquet dataset's columns, drops exact duplicates and rows outside a length range, and re-packs the rest into evenly sized Parquet files. - [Embed a dataset](https://docs.swale.io/examples/embed-dataset.md): Serves an embedding model with Text Embeddings Inference and embeds every row of a dataset into one Parquet file, with one client task per shard in parallel. - [Build a retrieval index](https://docs.swale.io/examples/retrieval-index.md): Splits PDFs into text chunks with Docling, embeds them with Text Embeddings Inference, stores them as a Parquet index, and answers a test query. - [Remove semantic duplicates from a dataset](https://docs.swale.io/examples/semantic-deduplication.md): Embeds every row of a dataset with vLLM batch inference, finds pairs of rows that mean nearly the same, and writes the dataset without the near-duplicates. - [Extract named entities with GLiNER](https://docs.swale.io/examples/entity-extraction.md): Extracts named entities of types you name from a collection of texts with GLiNER, with no training, in several parallel CPU tasks, and aggregates them with SQL. - [Curate web text with datatrove](https://docs.swale.io/examples/web-text-curation.md): Cleans a sample of web text the way pre-training datasets are built, with datatrove quality filters and MinHash deduplication, one task per stage, all on CPUs. - [Fine-tune, evaluate, quantize and publish](https://docs.swale.io/examples/fine-tune-evaluate-quantize.md): Fine-tunes a small chat model with TRL, evaluates it with lm-evaluation-harness, converts it to GGUF, quantizes it, and uploads it to the Hugging Face Hub. - [Compare two fine-tunes](https://docs.swale.io/examples/compare-fine-tunes.md): Fine-tunes the same model twice with different learning rates, side by side, evaluates both on the same benchmark, and compares their scores. - [Fine-tune a model then serve it with vLLM](https://docs.swale.io/examples/train-then-serve.md): Fine-tunes a small chat model with TRL, serves the result through vLLM's OpenAI-compatible server, and checks it answers. - [Align a model with DPO](https://docs.swale.io/examples/dpo-alignment.md): Aligns a chat model to preference pairs with TRL's DPO, then measures its win rate against the base model on held-out prompts with a judge model. - [Align a model with KTO](https://docs.swale.io/examples/kto-alignment.md): Aligns a chat model to answers labeled good or bad with TRL's KTO, then measures its win rate against the base model on held-out prompts with a judge model. - [Train a reward model](https://docs.swale.io/examples/reward-model.md): Trains a reward model on preference pairs with TRL, then measures how often it scores the preferred answer higher on held-out pairs. - [Train math reasoning with GRPO](https://docs.swale.io/examples/grpo-math.md): Trains a model on math word problems with TRL's GRPO, rewarding answers that match the reference, and compares its GSM8K score before and after. - [Train math reasoning with RLOO](https://docs.swale.io/examples/rloo-math.md): Trains a model on math word problems with TRL's RLOO, rewarding answers that match the reference, and compares its GSM8K score before and after. - [Distill a larger model into a smaller one](https://docs.swale.io/examples/distill-model.md): Distills a larger teacher into a smaller student of the same family on math prompts with TRL, and compares the student's GSM8K score before and after. - [Fine-tune a vision-language model](https://docs.swale.io/examples/fine-tune-vision-language-model.md): Fine-tunes a small vision-language model with TRL to answer a question about images, then compares its accuracy with the base model's on held-out images. - [Merge two fine-tunes](https://docs.swale.io/examples/merge-models.md): Merges two fine-tunes of one base model with mergekit's TIES method, scores the merge and both parents on the same benchmark, and uploads the merge. - [Quantize a model and pick the best preset](https://docs.swale.io/examples/quantize-and-pick.md): Converts a model to GGUF, quantizes it to several presets in parallel, measures their perplexity and speed, and uploads the smallest within a perplexity budget. - [Score a GGUF model on a CPU](https://docs.swale.io/examples/score-gguf.md): Serves a quantized GGUF model with llama.cpp on a CPU, has parallel client tasks answer GSM8K math questions through it, and reports accuracy and speed. - [Fine-tune an encoder for text classification](https://docs.swale.io/examples/text-classification.md): Fine-tunes an encoder model to classify text, with tokenizing on a CPU, training and prediction on a GPU, and accuracy and macro F1 computed in SQL. - [Fine-tune an encoder for text regression](https://docs.swale.io/examples/text-regression.md): Fine-tunes an encoder model to predict a number for each text, here an educational-value score, with training on a GPU and error measures in SQL. - [Fine-tune an encoder for token classification](https://docs.swale.io/examples/token-classification.md): Fine-tunes an encoder model to tag named entities word by word, with tag alignment on a CPU, training and tagging on a GPU, and entity-level F1 on a CPU. - [Fine-tune a model for extractive question answering](https://docs.swale.io/examples/extractive-question-answering.md): Fine-tunes a question-answering model on a GPU to find answers inside long documents, with windowing, answer picking, exact match and F1 on CPUs. - [Fine-tune a model to write news summaries](https://docs.swale.io/examples/summarization.md): Fine-tunes a sequence-to-sequence model to summarize news articles, with tokenizing on a CPU, training and generation on a GPU, and ROUGE computed on a CPU. - [Fine-tune a translation model](https://docs.swale.io/examples/translation.md): Fine-tunes a translation model on sentence pairs, with tokenizing on a CPU, training and generation on a GPU, and BLEU and chrF computed on a CPU. - [Fine-tune sentence embeddings for retrieval](https://docs.swale.io/examples/sentence-embeddings.md): Fine-tunes a sentence-embedding model on question and answer pairs, then compares its retrieval recall and MRR with the base model's on held-out pairs in SQL. - [Train a few-shot classifier with SetFit](https://docs.swale.io/examples/setfit-classifier.md): Trains a text classifier from a handful of examples per label with SetFit, then predicts the eval split on a GPU and computes accuracy and macro F1 in SQL. - [Fine-tune a vision transformer for image classification](https://docs.swale.io/examples/image-classification.md): Fine-tunes a vision transformer to classify images, with resizing on a CPU, training and prediction on a GPU, and accuracy and macro F1 in SQL. - [Fine-tune a vision transformer for image regression](https://docs.swale.io/examples/image-regression.md): Fine-tunes a vision transformer to predict a number for each image, here how many objects are annotated in it, with error measures computed in SQL. - [Fine-tune an object detection model](https://docs.swale.io/examples/object-detection.md): Fine-tunes an object detector on annotated images on a GPU, with annotation checks, COCO conversion, mean average precision and sample drawings on CPUs. - [Train a gradient-boosted model on tabular data](https://docs.swale.io/examples/tabular-gradient-boosting.md): Profiles a table and splits it with SQL, trains a gradient-boosted trees model with scikit-learn, and evaluates it on held-out rows, all on CPUs. ## Reference - [Reference](https://docs.swale.io/reference.md): Look up the exact syntax, commands, statuses, permissions, limits and billing rules of Swale, and its generated API reference. - [Install the CLI](https://docs.swale.io/reference/install-cli.md): Install the Swale CLI with the installer, Homebrew, a downloaded binary, GitHub Actions or a container, and verify what you downloaded. - [CLI reference](https://docs.swale.io/reference/cli-reference.md): Lists every Swale CLI command with its arguments and options, plus the repository target format, environment variables, prompts and exit codes. - [Workflow definition syntax](https://docs.swale.io/reference/workflow-definition-syntax.md): Defines the YAML format of a workflow definition, with its fields, inputs, blocks, task properties, dependencies, image credentials and upload checks. - [Task definition syntax](https://docs.swale.io/reference/task-definition-syntax.md): Defines the Markdown format of a task definition, its frontmatter fields, inputs, outputs, container, environment, runtime storage, versions and visibility. - [Expression language](https://docs.swale.io/reference/expression-language.md): Defines the ${{ }} expression syntax, the values an expression can read, and its operators, literals, property and index access, and truthiness. - [Expression functions](https://docs.swale.io/reference/expression-functions.md): Lists the functions an expression can call, such as format, contains, startsWith, toJSON and fromJSON, with their arguments and results. - [Control flow](https://docs.swale.io/reference/control-flow.md): Gives the syntax, rules and run-time behaviour of the if and for_each control tasks, and how they appear in a run's Workflow Graph. - [Run and task lifecycle](https://docs.swale.io/reference/run-and-task-lifecycle.md): Runs and tasks move through eight statuses; this lists what each means, how failure and canceling spread, and when compute and storage are measured. - [Permissions and restrictions](https://docs.swale.io/reference/permissions-and-restrictions.md): Lists the sign-in, role, email verification and billing requirements of each operation, and what the workflow run token can reach. - [Limits and quotas](https://docs.swale.io/reference/limits-and-quotas.md): Lists how many runs and tasks an account can have going at once, how long a task waits for room, and the size and name limits. - [Billing](https://docs.swale.io/reference/billing.md): Lists each billed dimension's unit and price, what each billing status blocks, when usage is invoiced, and what deleting content or an account does to billing. - [Platform UI layout](https://docs.swale.io/reference/platform-ui-layout.md): Describes how the platform UI is laid out, from the sidebar, its menus and the account switcher to the breadcrumb trail, home page and footer. ## Explanation - [Explanation](https://docs.swale.io/explanation.md): Background pages explain how Swale works, from accounts, projects and storage to secrets, billing, expressions and control flow. - [Core concepts](https://docs.swale.io/explanation/core-concepts.md): Swale is made of accounts, projects, repositories, workflows, runs, tasks, task definitions and compute types; this shows how they fit together. - [Organizations, members, and teams](https://docs.swale.io/explanation/organizations-members-teams.md): An organization is one account several people share; each member has a role, and teams give Contributors access to projects. - [Repositories and storage](https://docs.swale.io/explanation/repositories-and-storage.md): Repositories keep files as tags, and an account stores each piece of content once, so repeated pushes upload little and deleting a tag frees only what nothing else uses. - [Secrets](https://docs.swale.io/explanation/secrets.md): Project and account secrets reach a task only through its arguments, their values are write-only, and the logs mask them where they appear. - [Personal access tokens](https://docs.swale.io/explanation/personal-access-tokens.md): A personal access token lets the CLI and the API act as you without your password, except for a few actions that need you signed in. - [GitHub integration](https://docs.swale.io/explanation/github-integration.md): Swale reads workflow and task definition files from GitHub through your own GitHub connection, and keeps the list of connected owners in step. - [How billing works](https://docs.swale.io/explanation/how-billing-works.md): Swale bills four kinds of usage, invoices it as it adds up, and lets an account start new work only while its billing status is Active. - [How expressions work](https://docs.swale.io/explanation/how-expressions-work.md): Expressions are resolved when each task starts, and every value they read is text, which shapes comparisons and truthiness. - [How control flow works](https://docs.swale.io/explanation/how-control-flow-works.md): A workflow's tasks are grouped in blocks, and if and for_each tasks run a block inside themselves; this is how outputs and failures cross blocks. ## API - [OpenAPI specification](https://docs.swale.io/openapi/backend.json): The complete machine-readable contract for the HTTP API, rendered for humans at https://docs.swale.io/api/swale-api.