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

# Environment Setup

> Create a complete simulation environment from scratch.

## User Prompt

> "Set up a primary care clinic with a FHIR EHR and a payer portal for testing prior auth workflows."

## Tool Call Sequence

<Steps>
  <Step title="Create simulators">
    The agent creates two simulators: a FHIR EHR and a payer portal.

    **Call 1:** `simulators`

    ```json theme={null}
    {
      "action": "create",
      "type": "FHIR",
      "name": "Primary Care EHR",
      "config": {
        "authType": "bearer",
        "fhirVersion": "R4"
      }
    }
    ```

    **Response:**

    ```json theme={null}
    {
      "id": "sim_fhir_01",
      "type": "FHIR",
      "name": "Primary Care EHR",
      "config": {
        "authType": "bearer",
        "fhirVersion": "R4"
      },
      "createdAt": "2026-04-06T10:00:00Z"
    }
    ```

    **Call 2:** `simulators`

    ```json theme={null}
    {
      "action": "create",
      "type": "Payer",
      "name": "BlueCross Portal"
    }
    ```

    **Response:**

    ```json theme={null}
    {
      "id": "sim_payer_02",
      "type": "Payer",
      "name": "BlueCross Portal",
      "config": null,
      "createdAt": "2026-04-06T10:00:01Z"
    }
    ```

    **What the agent learns:** Both simulators are created and have IDs. The agent uses these IDs to link the simulators to an environment in the next step.
  </Step>

  <Step title="Create environment and link simulators">
    The agent creates the environment, then attaches both simulators.

    **Call 3:** `environments`

    ```json theme={null}
    {
      "action": "create",
      "name": "Primary Care Clinic",
      "description": "Simulated primary care setting with FHIR EHR and BlueCross payer portal for prior auth testing"
    }
    ```

    **Response:**

    ```json theme={null}
    {
      "id": "env_clinic_01",
      "name": "Primary Care Clinic",
      "description": "Simulated primary care setting with FHIR EHR and BlueCross payer portal for prior auth testing",
      "simulators": [],
      "createdAt": "2026-04-06T10:00:02Z"
    }
    ```

    **Call 4:** `environments`

    ```json theme={null}
    {
      "action": "addSimulator",
      "id": "env_clinic_01",
      "simulatorId": "sim_fhir_01"
    }
    ```

    **Response:**

    ```json theme={null}
    {
      "id": "env_clinic_01",
      "name": "Primary Care Clinic",
      "simulators": [
        { "id": "sim_fhir_01", "type": "FHIR", "name": "Primary Care EHR" }
      ]
    }
    ```

    **Call 5:** `environments`

    ```json theme={null}
    {
      "action": "addSimulator",
      "id": "env_clinic_01",
      "simulatorId": "sim_payer_02"
    }
    ```

    **Response:**

    ```json theme={null}
    {
      "id": "env_clinic_01",
      "name": "Primary Care Clinic",
      "simulators": [
        { "id": "sim_fhir_01", "type": "FHIR", "name": "Primary Care EHR" },
        { "id": "sim_payer_02", "type": "Payer", "name": "BlueCross Portal" }
      ]
    }
    ```

    **What the agent learns:** The environment now has both simulators attached. The `simulators` array in the response confirms the links.
  </Step>

  <Step title="Create playground to provision live endpoints">
    The agent creates a playground to spin up live instances of all simulators in the environment.

    **Call 6:** `playgrounds`

    ```json theme={null}
    {
      "action": "create",
      "environmentId": "env_clinic_01"
    }
    ```

    **Response:**

    ```json theme={null}
    {
      "id": "pg_01",
      "environmentId": "env_clinic_01",
      "status": "Active",
      "sandboxes": [
        {
          "id": "sbx_fhir_01",
          "simulatorId": "sim_fhir_01",
          "type": "FHIR",
          "status": "Active",
          "endpoint": "https://fhir.verial.dev/sbx_fhir_01/fhir/R4"
        },
        {
          "id": "sbx_payer_01",
          "simulatorId": "sim_payer_02",
          "type": "Payer",
          "status": "Active",
          "endpoint": "https://portal.verial.dev/sbx_payer_01"
        }
      ],
      "createdAt": "2026-04-06T10:00:05Z"
    }
    ```

    **What the agent learns:** The playground is active with live endpoints for both simulators. The FHIR EHR is available at a REST endpoint and the payer portal has its own URL. These endpoints are ready for the agent-under-test to connect to.
  </Step>
</Steps>

## Agent Response

> Your primary care clinic environment is ready. Here is what was provisioned:
>
> | Simulator        | Type  | Endpoint                                      |
> | ---------------- | ----- | --------------------------------------------- |
> | Primary Care EHR | FHIR  | `https://fhir.verial.dev/sbx_fhir_01/fhir/R4` |
> | BlueCross Portal | Payer | `https://portal.verial.dev/sbx_payer_01`      |
>
> The environment `env_clinic_01` is active with playground `pg_01`. You can now point your agent at these endpoints to test prior auth workflows.

## Summary

| Metric        | Value                                                                                                                                        |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Tool calls    | **6**                                                                                                                                        |
| Tools used    | `simulators`, `environments`, `playgrounds`                                                                                                  |
| Key technique | Create simulators first, then compose them into an environment. A single `playgrounds` create call provisions all linked simulators at once. |
