> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/guides/ci-optimization/playwright-orchestration/playwright-orchestration-v1.md).

# Orchestration (v1)

{% hint style="warning" %}
This page documents orchestration flow for deprecated `v1` version of Currents. See [Migration Guide](/guides/ci-optimization/playwright-orchestration/playwright-orchestration-migration-guide.md).
{% endhint %}

Orchestration helps decrease the duration of Playwright tests in CI pipelines. Read our detailed guide on [Playwright Parallelization](/guides/ci-optimization/playwright-parallelization.md) that compares native sharding with orchestration.

## How does it work

`@currents/playwright` contains a command-line executable `pwc-p` — a lightweight wrapper that implements Orchestration and runs Playwright behind the scenes.

* it scans the testing suite
* it establishes an orchestration session with Currents servers
* **it** runs Playwright, executing spec files in the optimal order
* the results are recorded to Currents for troubleshooting and analysis

## Setup

Install `@currents/playwright`:

```bash
npm i @currents/playwright
```

Replace `playwright` with `pwc-p`:

```bash
npx pwc-p --key <record-key> --project-id <project-id> --ci-build-id <ci-build-id>
```

`pwc-p` accepts additional Playwright arguments and flags (see [@currents/playwright](/resources/reporters/currents-playwright.md)), for example:

{% code overflow="wrap" %}

```bash
# Add additional playwright arguments and flags:
pwc-p --key <record-key> --project-id <id> --ci-build-id <build-id> -- --workers 2 --timeout 10000
```

{% endcode %}

{% hint style="success" %}
Read more about [CI Build ID](/guides/parallelization-guide/ci-build-id.md) and [Reporting Strategy](/guides/parallelization-guide/reporting-strategy.md).
{% endhint %}

{% hint style="info" %}
There's no need to define shards. Remove the `--shard` flag — Currents uses all available machines automatically.
{% endhint %}

A successfully created orchestration prints an output similar to this:

{% code overflow="wrap" %}

```bash
$ npx pwc-p --key **redacted** --project-id **redacted** --ci-build-id `date +%s` -c ./or8n/playwright.config.ts

🚀 Starting orchestration session...
📦 Currents reporter: 1.1.2 recording CI build 1712134904 for project JJzd65, orchestration id 260264cfa16950ab4dc98d5c54333136
🎭 Playwright: 1.42.1 5 tests in 1 project [chromium]

🌐 Executing orchestrated task: [chromium] spec-or8n-e.spec.ts
🌐 Run URL: https://app.currents.dev/run/9b93659915fe653f
# ...start executing the tests in an optimal order.
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.currents.dev/guides/ci-optimization/playwright-orchestration/playwright-orchestration-v1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
