.autosana/ folder. When you push to your default branch, Autosana syncs those files and materializes them as flows and suites in your dashboard. This is GitOps for your tests: your repository is the source of truth, changes go through pull requests, and every definition is code-reviewed alongside the app it tests.
Code-managed definitions are read-only in the dashboard — you edit them by changing the YAML and pushing (or opening a PR to preview first). Running is unaffected: read-only covers the definition, not execution.
Beta. Code-managed flows are an early feature. The flow- and suite-YAML validation rules are shared by the sync and the
autosana CLI, so those parts validate identically on your machine. Checks that need your organization’s data — app names, hook references, and hook-file contents — run only server-side; see Validating locally.How it works
- You define flows, suites, and hooks as files under
.autosana/in your repo - On a push to your default branch, Autosana fetches
.autosana/, validates every file, and materializes the changes - On a pull request, Autosana previews the proposed flow definitions and posts a GitHub check
- The dashboard shows the resulting flows and suites as read-only — edit them by pushing to the repo
Enabling code-managed flows
Code-managed flows are powered by the GitHub Bot, so install the GitHub App first if you haven’t.- Go to Settings > Integrations
- Find the repository you want to manage in the connected-repositories list
- Toggle Code-Managed Testing on for that repo
- Autosana runs an initial full sync of
.autosana/immediately
.autosana/ re-syncs automatically, and a nightly resync catches any drift.
You need to be an admin of your Autosana organization to install the GitHub App and manage integration settings.
Migrating existing flows
Already have flows in the dashboard? Export them to files with theautosana CLI, commit them, and let the sync adopt them:
*.flow.yaml), suite (_suite.yaml), and the flows’ setup/teardown hooks (hooks/<slug>.<ext>), and adds setup_hooks/teardown_hooks to the flow files. cURL hooks have no file form, so they’re referenced by slug but stay dashboard-authored. Review the generated files, commit them under .autosana/, then enable Code-Managed Testing.
On the first sync, anything whose identity matches an active dashboard definition is adopted — its run history is preserved and it becomes code-managed (read-only), now driven by your files:
- a flow or suite is adopted when its
nameexactly matches one active dashboard flow/suite; - a hook is adopted when its slug (its filename) matches one active dashboard hook.
Repository layout
Everything Autosana manages lives under a single.autosana/ folder — at your repository root by default, or under a subdirectory you point Autosana at (see Monorepos). Flows are *.flow.yaml files, a suite is a folder containing a _suite.yaml manifest, and hooks are script files under a hooks/ directory.
| File type | Location | Purpose |
|---|---|---|
| Flow | <name>.flow.yaml (anywhere under .autosana/) | One test flow |
| Suite | <folder>/_suite.yaml (one per folder) | Groups the flows in that folder |
| Hook | <any>/hooks/<name>.<ext> (direct parent must be hooks/) | A setup/teardown script |
A file is only recognized if it ends in
.flow.yaml, is named exactly _suite.yaml, or sits directly inside a hooks/ folder with a supported extension. Other files under .autosana/ are ignored.Flow files
A flow file ends in.flow.yaml. The only required keys are name and instructions, where instructions is either a single multiline prompt or a YAML list of steps.
As a multiline prompt:
| Key | Required | Notes |
|---|---|---|
| name | Yes | Non-empty string. |
| instructions | Yes | A YAML list of non-empty step strings, or a single non-empty prompt string. A list is numbered into a single prompt. |
| key | No | Unique flow key. Defaults to the path minus .autosana/ and .flow.yaml (e.g. smoke/checkout). |
| description | No | Free-text description. |
| app | Sometimes | Name of a linked app. Optional when the repo is linked to 0 or 1 apps; required on every flow once the repo is linked to more than one app. An unknown name fails the sync. |
| caching | No | Boolean, defaults to true. Only has an effect when Run Caching is enabled for your org. |
| setup_hooks | No | Ordered list of hook slugs to run before the flow. |
| teardown_hooks | No | Ordered list of hook slugs to run after the flow. |
Referencing variables
Reference environment variables insideinstructions with the ${env:VAR_NAME} token. This is reference only — the values stay defined in the dashboard and are resolved just in time when the flow runs. There is no env: block in the YAML; the value never lives in your repo.
Referencing hooks
Attach hooks to a flow withsetup_hooks and teardown_hooks, each an ordered list of hook slugs:
setup_hooks and teardown_hooks — that’s legal. To reference a hook by name inside your instructions at run time, use ${hooks:Hook Name} (by display name); see Hooks.
Suites
A suite is a folder containing a_suite.yaml manifest. The suite’s key is its folder path (a smoke/ folder gives the suite key smoke). The only required key is name:
| Key | Required | Notes |
|---|---|---|
| name | Yes | Non-empty string. |
| flows | No | Ordered list of flow-key references. Omit it to include every flow directly in the suite’s own folder (subfolders are not included), in filename-alphabetical order. |
| setup_flow | No | A single flow-key reference to run first. |
| description | No | Free-text description. |
| instructions | No | Suite-level context shared across the suite’s flows (e.g. shared test-account info). |
| setup_hooks / teardown_hooks | No | Ordered lists of hook slugs. |
flows and setup_flow resolve sibling-first: a flow directly in the suite’s own folder wins, otherwise the reference is matched against every flow in the repo. Flows in a subfolder are not default members — list them explicitly (or give the subfolder its own _suite.yaml). Flow keys and suite keys must each be unique across the whole repo. An unknown reference, or the same flow listed twice, is a validation error.
The
_suite.yaml file must live inside a folder — it cannot sit at the .autosana/ root, because a suite is a folder. Membership is defined by the suite (its flows list or its folder), never declared inside the flow files themselves.Hooks as files
Hooks live as script files inside ahooks/ folder — either .autosana/hooks/ or <suite>/hooks/. The file extension determines the hook type, and the filename becomes the hook’s slug.
| Extension | Hook type |
|---|---|
.py | Python script |
.js | JavaScript script |
.ts | TypeScript script |
.sh | Bash script |
.json | Launch args (must be valid JSON) |
-. So Seed DB.sh becomes slug seed-db, and reset.env.json becomes reset-env. This slug is what you reference in setup_hooks / teardown_hooks. The display name is the humanized filename (reset-test-env.sh shows as “Reset Test Env”).
The file content is the hook script, stored verbatim. Empty or whitespace-only files are rejected. A
.json launch-args hook must parse as valid JSON, and a filename with no letters or digits (so it produces an empty slug) is rejected..py, .js, .ts, .sh) read environment variables natively — os.environ.get(...) in Python, process.env in JavaScript/TypeScript, $VAR in Bash. Launch-args (.json) hooks — and dashboard-authored cURL hooks — use the ${env:KEY} token instead, since they aren’t executed scripts. cURL hooks have no file form; reference an existing dashboard cURL hook by slug, or use a .sh hook that runs curl. See Hooks for the full hook model.
Monorepos
By default Autosana looks for.autosana/ at your repository root. If your definitions live in a subdirectory — common in a monorepo — point Autosana at that folder with the repo’s Root directory setting.
- Go to Settings > Integrations
- On the repo with Code-Managed Testing enabled, set Root directory to the folder that contains
.autosana/(for example,services/mobileforservices/mobile/.autosana/) - Leave it blank to use the repository root
.autosana/, so moving your definitions into a subdirectory doesn’t change any keys — a flow at services/mobile/.autosana/login.flow.yaml still has the key login. The GitHub links on each row point at the full path in your repo.
Saving a new Root directory doesn’t re-sync on its own, and an unrelated push won’t either. To re-sync from the new location, push a change under
<root-directory>/.autosana/ on your default branch, or toggle Code-Managed Testing off and on. The nightly resync also picks it up within a day.Validating locally
Validate your.autosana/ folder before you push using the autosana CLI. Install it (requires 0.8.0 or newer, which adds the flows commands):
.autosana directory in the current folder; pass a path to validate somewhere else (handy for a monorepo):
instructions shape, suite references, key uniqueness — and reports each error per file with the offending line. It exits non-zero on errors, so you can wire it into a pre-commit hook or CI step.
The CLI can’t see your organization’s data, so a few checks run only server-side and appear on the Autosana Flows check after you push:
app: name resolution, hook-slug references and conflicts, and hook-file contents (empty scripts, invalid launch-args JSON). A green local run doesn’t guarantee a green check if a flow references an unknown app or hook.Sync status & validation
Every sync posts a GitHub check named Autosana Flows on the head commit — on both pushes and pull requests. It concludes as a failure if there are any issues, otherwise success. The summary reports how many files synced (or lists the errors found), and parse errors are attached as inline annotations anchored to the offending line where one is known, with any “Did you mean” hint appended.Pull request workflow
Open a pull request that changes.autosana/ and Autosana previews your flow changes without touching mainline:
- Each changed or added
*.flow.yamlgets a PR-scoped flow version pinned to the PR, so the PR’s test runs use the proposed definitions - The Autosana Flows check runs on the PR. For mechanical typos on lines you changed, Autosana also posts inline GitHub suggestion comments you can apply in one click
- Suite manifest (
_suite.yaml) changes are preview-only on a PR — a warning notes that suite changes apply when the PR merges - Removed flow files are ignored during preview; the archival happens on merge
- Hook files are not previewed. A PR’s runs use the mainline hook scripts, and hook changes (plus their slug-conflict validation) apply on merge. A PR touching only hook files posts no check at all
Pull requests from forks are skipped — no flow versions are minted and no check is posted. Fork-authored YAML never touches your organization; it’s validated and applied by the mainline sync only after the PR merges.
Deleting and renaming
Removing a definition is a soft delete. When you delete a.flow.yaml, _suite.yaml, or hook file and push to your default branch, Autosana archives the corresponding flow, suite, or hook — it’s deactivated and hidden, but its run history is kept. If a file with the same key returns later, the exact same record is reactivated (history intact).
Deleting a hook file while any flow or suite still references its slug fails the whole sync with an “unknown hook” error. Remove the setup_hooks / teardown_hooks references in the same commit as the hook file.
Read-only in the dashboard
A flow, suite, or hook is code-managed when it originates from a connected repository. Code-managed rows are read-only in the dashboard:To change a code-managed flow, suite, or hook, edit the YAML (or script) in your repository and push — or open a PR to preview the change first. The dashboard links each code-managed row to its file on GitHub. Attempting to edit a code-managed definition in the dashboard is blocked; the repository stays the source of truth.
${env:KEY}.
Troubleshooting
My changes didn’t appear in the dashboard
Possible Causes:- The Code-Managed Testing toggle isn’t enabled for the repository
- The push wasn’t to the default branch, or didn’t touch any file under
.autosana/(or under<root-directory>/.autosana/) - Your
.autosana/folder isn’t at the repository root and no Root directory is set for the repo - Another file in
.autosana/has a validation error, so the whole apply step was skipped - After a force-push that rewinds the branch to older-dated commits, the sync may be skipped as stale — push a newer commit, or toggle Code-Managed Testing off and on to force a full resync
- Enable the toggle in Settings > Integrations
- Confirm you pushed to the default branch and edited a file under
.autosana/ - Open the Autosana Flows check on the commit and fix every reported error — apply only runs at zero issues
The Autosana Flows check failed
Possible Causes:- An unknown top-level key or a malformed
instructionsvalue - A suite reference that doesn’t match any flow key, or a duplicate flow/suite key
- A
setup_hooks/teardown_hooksslug that doesn’t match any hook, or two hook files whose slugs collide - An
app:name that doesn’t match a linked app — or an omittedapp:when the repo is linked to more than one app - A hook file that’s empty, or a
.jsonlaunch-args hook that isn’t valid JSON
- Read the inline annotations and any “Did you mean” suggestions on the check
- Run
autosana flows validatelocally to reproduce the flow/suite YAML errors before pushing (app and hook errors surface only on the check)
My PR check passed but nothing applied after merge
Possible Causes:- The PR check validates each changed flow file on its own; cross-file checks (duplicate keys, suite references, hook slugs/conflicts,
app:names) run at merge
- Open the Autosana Flows check on the merge commit and fix the reported cross-file errors
- Run
autosana flows validateon the whole.autosana/folder before merging
The dashboard won’t let me edit a flow
Possible Causes:- The flow is code-managed and therefore read-only in the dashboard
- Edit the linked
.autosana/YAML file in your repository and push, or open a PR to preview the change