> For the complete documentation index, see [llms.txt](https://protocol-labs.gitbook.io/testground/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://protocol-labs.gitbook.io/testground/table-of-contents/concepts-and-architecture/client-server-communication.md).

# Client-Server communication

*This is an advanced section for those curious about the communication between client and server. This section is not needed to use Testground, but to understand the protocol between client and server.*

## Build

`POST /build`

Build sends a mime/multipart \`build\` request to the daemon. A build request comprises the following parts:

* Part 1 (Content-Type: application/json): composition json (see below)
* Part 2 (Content-Type: application/zip): test plan source
* Part 3 (optional, Content-Type: application/zip): linked sdk

The request is the same kind multipart mime message archive your email administrator knows and loves so well. With this archive in hand, the plan is POST'ed the testground daemon.

## Run

`POST /run`

A Run request consists of a composition json (see below)

## Composition JSON

```javascript
{
  "composition": {
    "metadata": {
      "name": string,
      "author": string,
    },
    "global": {
      "plan": string,
      "case": string,
      "total_instances": int,
      "builder": string,
      "build_config": object,
      "runner": string,
      "run_config": string,
    },
    "groups": [
      "id": string,
      "resources": {
        "memory": string,
        "cpu": string,
      },
      "instances": {
        "count": int,
        "percentage": float,
      },
      "build":
      "run":
    ],
  },
}
```

## Collect outputs

`POST /outputs`

```javascript
{
  "runner": string,
  "run_id": string,
}
```

## Terminate Jobs

`POST /terminate`

```javascript
{
  "runner": string,
}
```

## Healthcheck

`POST /healthcheck`

```javascript
{
  "runner": string,
  "fix": bool,
}
```


---

# 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://protocol-labs.gitbook.io/testground/table-of-contents/concepts-and-architecture/client-server-communication.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.
