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

# Chat connections and Env

First [connect your Pipecat agent](/docs/integrations/pipecat/connect) and add the SDK line to your bot.

## Add a chat connection

A chat simulation tests your bot's reasoning and tools without speech. Egma starts your bot with the same start request, and the persona sends each turn as text through RTVI. It reads your bot's replies from RTVI's text messages.

Chat needs no code beyond the SDK line. In a chat simulation, the SDK turns your bot's speech output off, so the greeting and every answer stay text only. Chat does need RTVI, which `PipelineWorker` turns on by default. Do not pass `enable_rtvi=False`, and if you pass your own `rtvi_observer_params`, keep `bot_llm_enabled` on: Egma reads the bot's answers from those messages. A bot with RTVI turned off still passes voice simulations, but its chat simulations fail.

Add a chat connection beside your voice connection:

```bash theme={"system"}
egma agent connection add \
  --agent "$EGMA_AGENT_ID" \
  --access pipecat-cloud \
  --modality chat \
  --pipecat-agent-name "$PIPECAT_AGENT_NAME" \
  --name "Pipecat chat"
```

For a self-hosted starter, use `--access pipecat-self-hosted` with `--pipecat-start-url`, as in [Use a self-hosted starter](/docs/integrations/pipecat/self-hosted#connect-egma-to-the-starter). `egma agent dev` creates a chat connection for this machine for you.

Use this connection's ID when you start a chat run. The same suite can run against either connection.

## Pass data to a test

If your bot reads startup data from `runner_args.body`, put that data in the test's `## Env` section:

````markdown theme={"system"}
## Env

```json
{
  "pipecat_body_params": {
    "tenant": "oak-street",
    "caller": { "plan": "gold" }
  }
}
```
````

Egma adds this object to the `body` of the start request. Your bot reads it as it does in production:

```python theme={"system"}
tenant = runner_args.body.get("tenant")
```

* Use any JSON values, with the exact keys your bot reads.
* The object can be at most 512 KiB once serialized. Keep a larger value in your own store and pass its ID.
* The key `egma` is reserved. Egma adds its own `egma` key to every start request, and refuses a test that holds one in `pipecat_body_params`.
* A test without this field sends a body that holds only Egma's key.

Do not use the `egma` key to decide whether a conversation is a simulation: any client can send one. `simulation` asks Egma to accept the bot's report before it acts on the key, and `monitor` stays silent only after that accepted report.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.