Installation

Turn ships as one CLI with official Wasm provider drivers bundled. Install it, select providers for infer and decide, then run.


1. Install the Turn 2 preview

Until the final Turn 2 tag is published, install the reviewed preview commit with Cargo:

terminal
cargo install --git https://github.com/ekizito96/Turn --rev 4934d479e4b96cde7fa531c54a4ec64400c1fe27 turn

This installs the exact runtime used by the website playground.

Verify the installation and selected providers:

terminal
turn --version
# turn 2.0.0
turn doctor

Latest tagged stable release

The one-line installer currently installs stable v1. It will move to Turn 2 after the live-provider smoke test and release tag:

terminal
curl -fsSL https://turn-lang.dev/install.sh | sh

Build from source

terminal
git clone https://github.com/ekizito96/Turn.git
cd Turn
git checkout 4934d479e4b96cde7fa531c54a4ec64400c1fe27
cargo install --path impl
turn doctor

2. Select providers

Turn keeps generation and bounded judgment separate:

terminal
# Open-ended synthesis through infer
export TURN_LLM_PROVIDER=openai
export OPENAI_API_KEY=sk-...

# Choice, Score, and Noul decisions through decide
export TURN_DECISION_PROVIDER=typesafe
export TYPESAFE_API_KEY=your-key

turn doctor

If unset, TURN_LLM_PROVIDER defaults to openai and TURN_DECISION_PROVIDER defaults to typesafe.

Official adapters are bundled. A project-local .turn_modules/<provider>_provider.wasm file overrides the bundled version.

Generative providers

ProviderTURN_LLM_PROVIDERRequired environment
OpenAIopenaiOPENAI_API_KEY
AnthropicanthropicANTHROPIC_API_KEY
Google GeminigeminiGEMINI_API_KEY
xAI GrokgrokXAI_API_KEY
Ollamaollamanone
Azure OpenAIazure_openaiendpoint, key, deployment
Azure Anthropicazure_anthropicendpoint, key
Azure OpenAI Responsesazure_openai_responsesendpoint, key, deployment

Decision providers

ProviderTURN_DECISION_PROVIDERRequired environment
TypeSafe JevtypesafeTYPESAFE_API_KEY
Deterministic development mockmocknone

NOTE

The mock validates control flow and response handling. It does not measure model quality, accuracy, or calibration.


3. Run a decision workflow

triage.tn
let decision = decide("The export button crashes in Safari", {
"department": {
  "type": "choice",
  "instructions": "Which team should handle this?",
  "criteria": {
    "billing": "Charges and refunds",
    "technical": "Bugs and integrations"
  }
}
});

return decision["answers"]["department"];

Run without an API key:

terminal
TURN_DECISION_PROVIDER=mock turn run triage.tn

Run the same program with Jev:

terminal
export TURN_DECISION_PROVIDER=typesafe
export TYPESAFE_API_KEY=your-key
turn run triage.tn

4. CLI reference

turn run <file.tn>          Run a Turn program
turn run <file.tn> --sandbox
                          Deny host I/O, imports, and identity grants
turn inspect <agent-id>     Inspect a saved suspended process
turn serve [--port 3000]    Start the HTTP API server
turn lsp                    Start the Language Server
turn doctor                 Check provider and credential readiness
turn --version              Print version

Next steps