Agent configuration (soma.toml)
Agent configuration (soma.toml), in the reference of the Soma programming language (soma 3.2.4). A block marked ✓ is a whole program that soma check accepts; the others are excerpts.
[agent]
provider = "ollama" # ollama (free, local)
model = "gemma3:12b"
# Or OpenAI:
# provider = "openai"
# model = "gpt-4o-mini"
# key = "sk-..." # or use SOMA_LLM_KEY env var
# Or Anthropic:
# provider = "anthropic"
# model = "claude-opus-4-6"
# key = "sk-ant-..." # or use SOMA_LLM_KEY env var
# Or custom endpoint:
# url = "https://your-api.com/v1/chat/completions"
# model = "your-model"
# key = "your-key"Ollama needs no key. OpenAI/Anthropic keys can go in soma.toml or SOMA_LLM_KEY env var. Env vars always override soma.toml.
// Postconditions: ensure (checked at point of execution)
on withdraw(balance: Int, amount: Int) {
let result = balance - amount
ensure result >= 0 // fails with error if false
return result
}
// try catches: division by zero, type errors (NOT a stack overflow: runaway recursion fails the handler), invalid
// transitions, require/invariant/ensure failures, fail(). An undefined
// function is a `soma check` error; an undefined variable inside a `try`
// is a check warning and raises kind undefined_variable (catchable).