Skip to main content
Motus reads configuration from environment variables at runtime. For project-level settings, you can also create a motus.toml file in your project root.

API keys

Set your provider API keys as environment variables before running an agent. You only need the key for the provider you are using. OpenAIChatClient also reads OPENAI_BASE_URL if you want to point it at a custom endpoint, such as a local model server:
OpenRouterChatClient reads OPENROUTER_BASE_URL to override the default endpoint (https://openrouter.ai/api/v1).

Runtime variables

These variables control Motus’s logging and tracing behavior.

Tracing

When tracing is enabled, Motus records task execution, tool calls, and model interactions:
  • disabled — no trace data is collected.
  • basic — task-level events only (start, end, errors).
  • detailed — includes model request/response payloads and tool arguments.
Set MOTUS_TRACING=1 to enable collection and file export. To also open the live trace viewer in your browser, use MOTUS_TRACING_ONLINE=1 instead. If you want file export without the viewer, set MOTUS_TRACING_EXPORT=1.

motus.toml

Create a motus.toml file in your project root to store project-level settings. Motus searches upward from the current working directory until it finds this file.
With motus.toml in place, you can omit these values from CLI commands:
motus deploy creates a motus.toml automatically when you first deploy a project. You can also create it by hand.

.env file support

Motus does not auto-load .env files. If you prefer to manage secrets in a .env file, load it yourself at the top of your entry point using python-dotenv:
Create a .env file in your project root:
Then load it before any Motus imports:
Call load_dotenv() before importing any Motus modules. Environment variables are read when modules initialize, so loading them afterward has no effect.

Verifying your configuration

Run this snippet to confirm your API key is set and the client can initialize:
If the key is missing or invalid, the client raises an error at request time with a descriptive message.