Signature
Overview
Creates a new synthetic world scoped to a project. The world intercepts tool calls and returns generated responses instead of calling real services. Returns aSyntheticWorld instance that can be used as a context manager. When the context exits, the world is automatically destroyed.
Parameters
The project to scope the world to. Must be a project you own.
Generation mode:
| Value | Description |
|---|---|
schema_only | Generate from tool schema alone (fastest) |
examples | Ground generation in real examples from your traces |
stateful | Remember prior calls within the session |
Seed for deterministic output. Same seed + same input = same response every time.
LLM model for response generation. When
None, the backend picks a default.Error simulation config. When set, a percentage of calls will raise simulated errors.Available codes:
timeout, internal_error, rate_limit, not_found, bad_request.Failures are deterministic when a seed is set.RL platform URL. Defaults to
RDK_PLATFORM_URL env var or http://localhost:7878.Bearer token for authentication. Defaults to
RDK_API_KEY env var.HTTP request timeout in seconds.
Returns
ASyntheticWorld instance.
Raises
ValueError— if no API key is provided or found in environmenthttpx.HTTPStatusError— if the backend rejects the request (auth failure, project not found)
Examples
Minimal
With all options
Environment Variables
| Variable | Effect |
|---|---|
RDK_API_KEY | Default API key |
RDK_PLATFORM_URL | Default platform URL |
See Also
- Synthetic Worlds Guide — Full usage guide
- ToolSpec — Manual schema construction

