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

# Advanced patterns

> Sessions for stateful pipelines, secrets vault for encrypted credentials, and prompt patterns for parallel work.

Two features turn UniversalBench from a remote sandbox into a real execution platform: persistent sessions and the encrypted secrets vault. Both come at no extra cost on every plan.

## Persistent sessions

By default every call is independent. Pass a `session_id` and Python variables, imports, and cached connections persist across calls within the same session.

```json theme={null}
{
  "session_id": "my_pipeline_001",
  "code": "import pandas as pd; df = pd.read_csv('/tmp/data.csv'); print(len(df))"
}
```

The next call with the same `session_id` can reference `df` directly without reimporting pandas or re reading the file:

```json theme={null}
{
  "session_id": "my_pipeline_001",
  "code": "print(df.groupby('status').size())"
}
```

Sessions are stored server side and tied to your account. They expire after a period of inactivity. For long running pipelines, ping a small call every few minutes to keep the session warm.

## Encrypted secrets vault

Store API keys, tokens, and credentials once. Your AI injects them at runtime by name without ever seeing the value.

```json theme={null}
{
  "secrets_vault": {
    "action": "save",
    "secret_name": "STRIPE_KEY",
    "secret_value": "sk_live_xxx"
  }
}
```

After that, your AI can reference the secret by name in subsequent calls:

```json theme={null}
{
  "secrets_vault": {
    "action": "get",
    "secret_name": "STRIPE_KEY"
  }
}
```

| Action   | Purpose                                                                                               |
| :------- | :---------------------------------------------------------------------------------------------------- |
| `save`   | Encrypt and store a new secret, or update an existing one                                             |
| `list`   | List names of stored secrets (values are never returned)                                              |
| `get`    | Retrieve a stored secret value (returned to the workbench, never to the AI's context window directly) |
| `delete` | Remove a secret permanently                                                                           |

Encryption is AES 256 GCM at rest. The master key never appears in any response or log. Secrets are scoped to your account: another customer cannot read your secrets even with their own valid URL.

## Combining tools in one call

The `execute` tool accepts multiple input fields in a single call. The workbench evaluates them in a sensible order. For example, search the web and then run analysis on the result without two round trips:

```json theme={null}
{
  "web_search": "latest Fed interest rate decision May 2026",
  "code": "import json; result = json.loads(open('/tmp/last_search.json').read()); print(result[0]['title'])"
}
```

Most AI clients will discover this pattern naturally if you describe what you want in plain English. You do not usually need to hand craft these requests.

## Prompt patterns for parallel work

While there is no batch capability in the public tool, your AI can still parallelize by issuing multiple `execute` calls. Tell it to do so:

> Use UniversalBench to run these three checks at the same time, in parallel: total signups yesterday, total signups last week, and total signups this month.

Most modern AI clients (Claude, Cursor Composer, Windsurf Cascade) will issue the three tool calls concurrently rather than sequentially when given an explicit parallel instruction.

## Working with files

The workbench has a temporary filesystem at `/tmp` that persists for the duration of a session.

* Write a file via Python: `open('/tmp/data.json', 'w').write(...)`
* Read a file via the `file_read` input: `{"file_read": "/tmp/data.json"}`
* Files outside `/tmp` and files larger than a few hundred MB are not supported.

For permanent storage, use the secrets vault for credentials or store data in your own database via `code` and your DB client of choice.
