Settings
STATEK settings combine explicit constructor values, configured sources, and environment variables.
| Symbol | Import path | Purpose | Stability |
|---|---|---|---|
StatekSettings | statek.settings or statek | Main settings model | Core |
LLM_API_Settings | statek.settings or statek | Provider connection settings | Core |
MultiSourceBaseSettings | statek.multi_source_settings or statek | Settings base class with additional sources | Advanced |
SettingValuesSource | statek.multi_source_settings or statek | Abstract settings source | Advanced |
ChatStyle | statek.chat_style | Chat and console formatting enum | Core |
TaskDifficulty | statek.task_difficulty | Difficulty enum for prompts and model selection | Core |
StatekLocale | statek.locale | Locale object for language-specific prompts | Core |
get_statek_settings | statek.settings | Cached settings object | Core |
get_provider_settings | statek.settings | Cached provider settings lookup | Core |
set_log_level, get_statek_logger, statek_log | statek.settings | Logging helpers | Advanced |
LLM_API_Settings
class LLM_API_Settings(BaseSettings):
api_url: str
api_key: str
response_format_file: Optional[str] = None
use_prompt_caching: bool = FalseStores connection settings for one provider.
from statek import LLM_API_Settings
settings = LLM_API_Settings(
api_url="https://api.openai.com/v1/chat/completions",
api_key="...",
)StatekSettings
class StatekSettings(MultiSourceBaseSettings):
llm_api_settings: dict[str, LLM_API_Settings] = {}
default_llm_api_provider: str = "OPENROUTER"
prompt_files_dir: str | None = None
prompt_defs: dict[str, PromptDef] = {}
logs_path: str | None = None
examples_dir: str | None = None
documents_dir: str | None = None
max_turns: int = 5
max_exceptions: int = 3
max_consecutive_exceptions: int = 1
max_token_usage: int = 10000
limit_extension_per_completion: float = 0.0
chat_style: ChatStyle | None = None
examples_style: ChatStyle | None = None
xml_box_console: str | None = None
xml_box_example: str | None = None
log_level: str = "ERROR"
default_acl_str: str = "DENY"
statek_rpc_host: str | None = None
statek_rpc_port: int | None = None
statek_default_difficulty: str = "M"
statek_model_info_dir: str | None = None
python_sandbox_mode: str = "restricted"
python_sandbox_max_source_bytes: int = 200_000
python_sandbox_max_ast_nodes: int = 20_000
python_sandbox_allowed_imports: str = "datetime,calendar,..."
python_sandbox_allowed_tools: str = ""Environment variables
| Variable pattern | Effect |
|---|---|
{PROVIDER}_API_URL, {PROVIDER}_API_KEY | Creates LLM_API_Settings for that provider. |
{PROVIDER}_RESPONSE_FORMAT_FILE | Adds a JSON response-format file path. |
{PROVIDER}_USE_PROMPT_CACHING | Enables provider prompt caching when value is true-like. |
STATEK_PROMPT_FILES_DIR | Loads prompt definition files. |
STATEK_LOGS_PATH | Enables per-job logs. |
STATEK_EXAMPLES_DIR, STATEK_DOCUMENTS_DIR | Configures example and document helpers. |
STATEK_MAX_TURNS, STATEK_MAX_EXCEPTIONS, STATEK_MAX_CONSECUTIVE_EXCEPTIONS, STATEK_MAX_TOKEN_USAGE | Harness limits. |
STATEK_LIMIT_EXTENSION_PER_COMPLETION | Extends limits after job completion. |
STATEK_CHAT_STYLE, STATEK_EXAMPLES_STYLE | Parses ChatStyle values. |
STATEK_XML_BOX_CONSOLE, STATEK_XML_BOX_EXAMPLE | XML wrapper tag names. |
STATEK_LOG_LEVEL | Logger level. |
STATEK_DEFAULT_ACL | Default ACL mode string. |
STATEK_RPC_HOST, STATEK_RPC_PORT | RPC host and port. |
STATEK_DEFAULT_DIFFICULTY | Default task difficulty label. |
STATEK_MODEL_INFO_DIR | Model pricing metadata directory loaded by statek.init(). See STATEK Metering. |
STATEK_PYTHON_SANDBOX_MODE | Sets Python sandbox mode. Defaults to restricted; off disables the built-in sandbox. |
STATEK_PYTHON_SANDBOX_MAX_SOURCE_BYTES, STATEK_PYTHON_SANDBOX_MAX_AST_NODES | Limits accepted model-written Python source before execution. |
STATEK_PYTHON_SANDBOX_ALLOWED_IMPORTS | Comma-separated import roots allowed in restricted mode. |
STATEK_PYTHON_SANDBOX_ALLOWED_TOOLS | Comma-separated hidden or internal tool names explicitly allowed in restricted mode. |
Methods and properties
| Member | Returns | Description |
|---|---|---|
get_prompt_def(name) | `PromptDef | None` |
get_provider_settings(provider=None) | `LLM_API_Settings | None` |
get_xml_box_tags() | dict[str, str] | Returns configured XML box tag names. |
default_acl | Statek_ACL | Returns wildcard default ACL mode. |
Shared enums and locale
ChatStyle.CONSOLE
ChatStyle.MARKDOWN
ChatStyle.MD_DIALOG
ChatStyle.DIRECT
TaskDifficulty.low
TaskDifficulty.medium
TaskDifficulty.high
StatekLocale(lang_code, country_code)
resolve_locale("EN-US")| Symbol | Import path | Description |
|---|---|---|
ChatStyle | from statek.chat_style import ChatStyle | Controls console, markdown, dialog, and direct provider-tool execution styles. |
TaskDifficulty | from statek.task_difficulty import TaskDifficulty | Supports low, medium, and high task difficulty. parse_task_difficulty(value) accepts enum values plus L/M/H and full labels. |
StatekLocale | from statek.locale import StatekLocale, resolve_locale | Combines language and country codes. resolve_locale(...) accepts strings such as EN-US and caches resolved objects in-process. |
For practical locale selection behavior, see Locale Selection.
export OPENAI_API_URL="https://api.openai.com/v1/chat/completions"
export OPENAI_API_KEY="..."
export STATEK_LOG_LEVEL=ERRORfrom statek.settings import get_statek_settings
settings = get_statek_settings()
provider = settings.get_provider_settings("OPENAI")Related APIs: Providers, Prompts, Configuration, STATEK Metering.