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

> ## Agent Instructions
> Install with `uv add whileai`; import as `import whileai as wai`.
> Run the offline path first (`simulator=False`, `wai.seeded_agent`, a callable judge); no key is needed for it.
> Report every pass rate with its interval and n, as `scored.pass_at` prints it.

# Integrations

> Every model API, trainer, GPU provider, data source and judge the SDK talks to, with the one line that connects each and the page that shows it running.

[![OpenAI](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/openai-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=07999b2b89e4517466c177805c747358)](#models-the-agent-runs-on)

[![Anthropic](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/anthropic-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=00b5323cbd3e792c2ddf0198f36c917a)](#models-the-agent-runs-on)

[![Fireworks](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/fireworks-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=1b4fbec06e02a07b47803c2ab538813e)](#training)

[![Amazon Bedrock](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/amazonwebservices-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=1f84d984b3ac3f3bb6113d7a49d5ef64)](#models-the-agent-runs-on)

[![vLLM](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/vllm-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=ece904abcba584ce82de770d38de7514)](#models-the-agent-runs-on)

[![Ollama](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/ollama-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=c980eda632136ec7aff28f5d2348310d)](#models-the-agent-runs-on)

[![Hugging Face and TRL](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/huggingface-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=1479b5b7d077186827c1f4ec6e3e0b1d)](#training)

[![Prime Intellect and verifiers](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/primeintellect-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=983c8b2aecfc91c718817c183e70c645)](#training)

[![Modal](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/modal-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=fd74deefdc523f26865b18471aae2fc2)](#training)

[![OpenTelemetry](https://mintcdn.com/crestoneai/XbE75Cy3pFOX-f2I/figures/logos/opentelemetry-light.svg?fit=max\&auto=format\&n=XbE75Cy3pFOX-f2I\&q=85\&s=5be9517373594fd06c5ea2484661bb9a)](#data-in-and-out)

The SDK sits between your agent and your trainer. Everything below is a
string or one call; keys stay in your environment and never reach While.

## Models the agent runs on

The agent, the situation writer and the simulated person take the same spec
or backend object. [Connect your agent](https://docs.while.ai/get-started/connect-your-agent.md) shows
each one in a run.

| Provider | How | Key |
| - | - | - |
| OpenAI | `wai.OpenAI("gpt-4.1-mini")` or `"openai:<model>"` | `OPENAI_API_KEY`; `OPENAI_BASE_URL` for a compatible server |
| Anthropic | `wai.Anthropic("claude-haiku-4-5")` or `"anthropic:<model>"` | `ANTHROPIC_API_KEY` |
| Fireworks | `wai.Fireworks("accounts/fireworks/models/qwen3-4b")` or `"fireworks:<model>"` | `FIREWORKS_API_KEY` |
| Amazon Bedrock | `wai.models.Bedrock(model_id, region=)` or `"bedrock:<model-id>[@<region>]"` | `AWS_BEARER_TOKEN_BEDROCK`, else AWS credentials |
| vLLM, SGLang, TGI, LM Studio, any OpenAI-compatible server | `wai.Endpoint(model, url="http://localhost:8000/v1")` or `"vllm:<model>@<url>"` | `VLLM_API_KEY` when the server wants one |
| Ollama | `wai.Ollama("llama3")` or `"ollama:<model>"` | none |
| The model While hosts | `wai.Hosted()`, the default when nothing is configured | `wai login` |
| Your own code | `my_agent(message) -> {"steps": [...], "final_text": "..."}` | yours |

## Judges

| Judge | How | Page |
| - | - | - |
| Any model above | `wai.Judge(rubric=..., model=wai.OpenAI("gpt-4.1"))` | [Evals](https://docs.while.ai/evals.md) |
| TypeSafe Jev | `"typesafe:<model>"` as the judge spec: one probability per verdict | [Overview](https://docs.while.ai/reference/overview.md) |
| A verifier | `wai.verify.MathEqual()`, `wai.verify.CodeExec(tests=...)`, or your function | [Verifiers](https://docs.while.ai/recipes/01-simulate/verifiers.md) |

## Training

Rows leave the SDK in the shape each trainer reads, with the tool-call
round trip checked for that shape.

| Trainer | How | Page |
| - | - | - |
| TRL (`SFTTrainer`, `DPOTrainer`, `GRPOTrainer`) | `select(mode="sft").export("train.jsonl", format="trl")`; `wai.HackMonitor` inside the loop | [SFT](https://docs.while.ai/recipes/04-train/sft.md), [DPO](https://docs.while.ai/recipes/04-train/dpo.md), [GRPO](https://docs.while.ai/recipes/04-train/grpo.md) |
| Fireworks managed training and serving | `export(..., format="fireworks")`, then `firectl sftj create` and a deployment | [Train on Fireworks](https://docs.while.ai/recipes/04-train/fireworks.md) |
| prime-rl and verifiers on Prime Intellect | `wai.prime_rl_config(...)` writes the run; `export_environment` writes the environment | [prime-rl](https://docs.while.ai/recipes/04-train/prime-rl.md), [Prime Intellect RL](https://docs.while.ai/recipes/03-select/prime-intellect-rl.md) |
| OpenEnv (TRL `GRPOTrainer`, torchforge, SkyRL, Unsloth) | `export_environment(..., runtime="openenv")` writes the `openenv.yaml` package; `uv run --project . server` serves it, `openenv push` puts it on a Space | [environment export](https://docs.while.ai/reference/five-calls.md), [`export_environment`](https://docs.while.ai/api/environment#export_environment) |
| Modal | the training recipes run there on your account, one A10G | [SFT](https://docs.while.ai/recipes/04-train/sft.md), [Text-to-SQL](https://docs.while.ai/recipes/04-train/text-to-sql.md) |
| While hosted GPUs | `wai.train(...)`, then `wai.serve(...)` gives back an OpenAI-compatible endpoint | [Hosted loop](https://docs.while.ai/recipes/04-train/hosted-loop.md) |

## Data in and out

| Source or destination | How | Page |
| - | - | - |
| OpenTelemetry traces | `wai.simulations.rows_from_otel(batch)`, then `simulate(..., traces=rows)` | [Connect your agent](https://docs.while.ai/get-started/connect-your-agent.md) |
| Your own traces as JSONL | `simulate(..., traces="traces.jsonl")` | [Connect your agent](https://docs.while.ai/get-started/connect-your-agent.md) |
| Hugging Face Hub | `export(..., push_to="me/my-set")` for datasets, `wai.hub.push("out/adapter", "me/my-lora")` for adapters | [Hugging Face](https://docs.while.ai/recipes/05-export/hugging-face.md) |
| The While platform | `push`, `train`, `serve`, and the experiments page that tracks every run | [Platform](https://docs.while.ai/platform.md) |

Something you use is not here? [Open an issue](https://github.com/whilehq/whileai-sdk/issues/new)
with the provider and the call you expected.


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