STATEK
API Reference
Settings

Settings

STATEK settings combine explicit constructor values, configured sources, and environment variables.

SymbolImport pathPurposeStability
StatekSettingsstatek.settings or statekMain settings modelCore
LLM_API_Settingsstatek.settings or statekProvider connection settingsCore
MultiSourceBaseSettingsstatek.multi_source_settings or statekSettings base class with additional sourcesAdvanced
SettingValuesSourcestatek.multi_source_settings or statekAbstract settings sourceAdvanced
ChatStylestatek.chat_styleChat and console formatting enumCore
TaskDifficultystatek.task_difficultyDifficulty enum for prompts and model selectionCore
StatekLocalestatek.localeLocale object for language-specific promptsCore
get_statek_settingsstatek.settingsCached settings objectCore
get_provider_settingsstatek.settingsCached provider settings lookupCore
set_log_level, get_statek_logger, statek_logstatek.settingsLogging helpersAdvanced

LLM_API_Settings

class LLM_API_Settings(BaseSettings):
    api_url: str
    api_key: str
    response_format_file: Optional[str] = None
    use_prompt_caching: bool = False

Stores 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 patternEffect
{PROVIDER}_API_URL, {PROVIDER}_API_KEYCreates LLM_API_Settings for that provider.
{PROVIDER}_RESPONSE_FORMAT_FILEAdds a JSON response-format file path.
{PROVIDER}_USE_PROMPT_CACHINGEnables provider prompt caching when value is true-like.
STATEK_PROMPT_FILES_DIRLoads prompt definition files.
STATEK_LOGS_PATHEnables per-job logs.
STATEK_EXAMPLES_DIR, STATEK_DOCUMENTS_DIRConfigures example and document helpers.
STATEK_MAX_TURNS, STATEK_MAX_EXCEPTIONS, STATEK_MAX_CONSECUTIVE_EXCEPTIONS, STATEK_MAX_TOKEN_USAGEHarness limits.
STATEK_LIMIT_EXTENSION_PER_COMPLETIONExtends limits after job completion.
STATEK_CHAT_STYLE, STATEK_EXAMPLES_STYLEParses ChatStyle values.
STATEK_XML_BOX_CONSOLE, STATEK_XML_BOX_EXAMPLEXML wrapper tag names.
STATEK_LOG_LEVELLogger level.
STATEK_DEFAULT_ACLDefault ACL mode string.
STATEK_RPC_HOST, STATEK_RPC_PORTRPC host and port.
STATEK_DEFAULT_DIFFICULTYDefault task difficulty label.
STATEK_MODEL_INFO_DIRModel pricing metadata directory loaded by statek.init(). See STATEK Metering.
STATEK_PYTHON_SANDBOX_MODESets Python sandbox mode. Defaults to restricted; off disables the built-in sandbox.
STATEK_PYTHON_SANDBOX_MAX_SOURCE_BYTES, STATEK_PYTHON_SANDBOX_MAX_AST_NODESLimits accepted model-written Python source before execution.
STATEK_PYTHON_SANDBOX_ALLOWED_IMPORTSComma-separated import roots allowed in restricted mode.
STATEK_PYTHON_SANDBOX_ALLOWED_TOOLSComma-separated hidden or internal tool names explicitly allowed in restricted mode.

Methods and properties

MemberReturnsDescription
get_prompt_def(name)`PromptDefNone`
get_provider_settings(provider=None)`LLM_API_SettingsNone`
get_xml_box_tags()dict[str, str]Returns configured XML box tag names.
default_aclStatek_ACLReturns 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")
SymbolImport pathDescription
ChatStylefrom statek.chat_style import ChatStyleControls console, markdown, dialog, and direct provider-tool execution styles.
TaskDifficultyfrom statek.task_difficulty import TaskDifficultySupports low, medium, and high task difficulty. parse_task_difficulty(value) accepts enum values plus L/M/H and full labels.
StatekLocalefrom statek.locale import StatekLocale, resolve_localeCombines 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=ERROR
from statek.settings import get_statek_settings
 
settings = get_statek_settings()
provider = settings.get_provider_settings("OPENAI")

Related APIs: Providers, Prompts, Configuration, STATEK Metering.