Menu
Schemas

Configuration Models

Data structures for system configuration — profile extraction, playbook extraction, evaluation, storage, and LLM settings.

Config

Root configuration object for the Reflexio system. Every nested type below is linked — click through to see the fields each accepts.

Saved configurations tolerate removed unknown fields and use defaults for absent fields. A recognized value that fails validation stops loading with StoredConfigurationError; correct the saved value before retrying. It is not replaced by a default policy. Errors name affected top-level settings and omit supplied values. This read compatibility does not loosen API writes, which retain normal schema validation. Existing missing-file, unreadable JSON and decryption handling are separate from recognized-value validation.

PropTypeDefaultDescription
storage_configStorageConfig—Database storage configuration. One of the StorageConfig variants.
storage_config_test?StorageConfigTest"unknown"Latest storage-configuration test state. Primarily populated by the server.
agent_context_prompt?string—Global agent context prompt describing the agent's environment
tool_can_use?array[ToolUseConfig]—Tools the agent can use (shared across success evaluation and playbook extraction)
profile_extractor_config?ProfileExtractorConfig—Profile extraction configuration.
user_playbook_extractor_config?UserPlaybookExtractorConfig—User playbook extraction configuration.
agent_success_config?AgentSuccessConfig—Agent success evaluation configuration. Defaults to an AI-agent success rubric with 5% session sampling; set to null to disable.
profile_window_size?integer10Interactions analyzed per window for profile extraction.
profile_stride_size?integer8New interactions required for the next automatic profile window. Zero selects manual-only extraction across the workspace, including projects with positive cadence overrides. Manual generation and reruns remain available.
playbook_window_size?integer10Interactions analyzed per window for playbook extraction.
playbook_stride_size?integer8New interactions required for the next window for playbook extraction.
extraction_idle_timeout_seconds?int21600Session inactivity delay for judged partial-window evaluation. Default 21600 (six hours); 0 disables for new publications. Captured at admission, so changes apply prospectively.
extraction_max_batch_wait_seconds?integer0Maximum batching wait captured for new publications, including active sessions. Zero disables it. Expiry queues an ordinary judged partial batch; worker queueing and processing still take additional time. Qualify a positive value for latency, learning quality and model-call cost before enabling.
api_key_config?APIKeyConfig—API key configuration for LLM providers
llm_config?LLMConfig—LLM model configuration overrides
retrieval_experiment_config?RetrievalExperimentConfig—The single active user-level retrieval holdout. Read-only through generic config routes; use the experiment lifecycle endpoints to change it.
retrieval_experiment_history?array[RetrievalExperimentRecord][]Active and completed retrieval experiment lifecycle records. Managed by the experiment lifecycle endpoints.
enable_document_expansion?booleanfalseEnable storage-time document expansion for improved FTS recall
retrieval_floor?RetrievalFloorConfig—Read-path relevance floor configuration. Reranks unified-search results with a cross-encoder and drops those below a per-arm floor.
lineage_gc?LineageGCConfig—One retention policy for profile expiry and lineage tombstone reclamation.
expiry_reclamation?ExpiryReclamationConfig—Direct deletion of expired non-audited rows.
governance_retention?GovernanceRetentionConfig—Hosted Enterprise audit-event retention policy.
pending_tool_call_config?PendingToolCallConfig—Configuration for non-blocking async information tools during extraction.
eval_sample_n_per_stratum?integer200F3: stratified-sample cap per (day × group) stratum in the regen pipeline. Strata with fewer items are kept whole. Predictable cost regardless of traffic volume.
eval_concurrency_limit?integer10F3: max simultaneous LLM judge calls in flight per regen job, enforced via a ThreadPoolExecutor. Bound to respect provider rate limits.

Enterprise Offline Tuner Configuration

Enterprise get_config responses include a separate offline-tuner overlay:

json
{
  "offline_tuner_config": {
    "enabled": false
  }
}

offline_tuner_config is a response overlay, not a persisted shared Config field. The Python client's set_config method strips response overlays from Config model instances, including objects returned by get_config; a dictionary containing an overlay is rejected by strict shared-Config validation. Use the enterprise tuning controls for enablement; availability is separate from the shared Config model. deployment_unsupported means the mode is unrecognized, config_reset_incomplete means setup has not finished, and tuner_not_composed can mean the tenant's method-schema upgrade is pending. Managed platform and self-hosted deployments are supported once their required setup is ready. A response overlay alone does not establish that tuning is active.

StorageConfig

StorageConfig is a union type — pass whichever variant matches your deployment. None is also accepted (no storage configured yet).

StorageConfigSQLite

Local SQLite storage. The default for Local OSS.

PropTypeDefaultDescription
db_path?string—Path to the SQLite file. If omitted, the server writes `reflexio.db` to the directory set by `LOCAL_STORAGE_PATH` (defaults to `~/.reflexio/data/`).

StorageConfigSupabase

Supabase data storage uses a native PostgreSQL connection. Raw remote storage configuration requires an explicit type tag. Normal reads and writes reject historical url, key, read_url, read_key, storage_type, and schema_name inputs. The explicit configuration upgrader removes obsolete HTTP credentials and preserves backend identity, schema, connection pools and read-replica settings.

PropTypeDefaultDescription
type?literal["supabase"]"supabase"Serialized backend identity. Preserved when saving and loading native storage configuration.
db_urlstring—Postgres connection URL for migrations, native reads and transactional writes.
schema?string—Optional Postgres schema. Hosted Reflexio uses this for platform-managed per-org schemas; leave it unset for bring-your-own Supabase.

StorageConfigPostgres

Native PostgreSQL-backed storage for RDS or bring-your-own Postgres deployments.

PropTypeDefaultDescription
type?literal["postgres"]"postgres"Storage discriminator.
db_urlstring—Direct PostgreSQL connection URL.
schema?string—Optional Postgres schema for Reflexio data. Defaults to `public`.
pool_size?integer10Maximum direct SQL connections per process (per organization).
read_db_url?string—Optional reader PostgreSQL URL used for search. Defaults to `db_url`.
read_pool_size?integer—Maximum reader SQL connections per process (per organization). Defaults to `pool_size`.

StorageConfigManagedSupabase

Read-only representation returned when Hosted Enterprise manages native storage credentials. Responses include the actual type (supabase or postgres), managed_by, and schema_present, never the shared database URL. Saving this marker retains the current organization's managed configuration.

PropTypeDefaultDescription
type?literal["supabase", "postgres"]"supabase"Serialized native backend identity, retained when round-tripping the managed marker.
managed_byliteral["platform"]—Indicates that Hosted Enterprise manages the storage connection.
schema_present?booleantrueWhether the managed organization schema is present.

ToolUseConfig

Defines a tool that the agent can use.

PropTypeDefaultDescription
tool_namestring—Name of the tool
tool_descriptionstring—Description of what the tool does

ProfileExtractorConfig

Configuration for profile extraction from interactions.

Extractor and evaluation identities are fixed. Retired identity fields are not configuration choices; omit them from new requests. Convert historical field aliases explicitly before loading or saving an older configuration.

PropTypeDefaultDescription
extraction_definition_promptstring—Prompt defining what to extract from interactions. Use `extraction_definition_prompt`; the historical `profile_content_definition_prompt` name requires explicit configuration conversion.
context_prompt?string—Additional context for profile extraction
tagging_definition_prompt?string—Prompt defining tags applied asynchronously to persisted profiles
should_extract_profile_prompt_override?string—Override prompt for extraction conditions
request_sources_enabled?array[string]—Only extract from these request sources. If not set, extracts from all sources

UserPlaybookExtractorConfig

Configuration for user-playbook extraction. Also exposed as PlaybookConfig (deprecated alias).

Extractor and evaluation identities are fixed. Retired identity fields are not configuration choices; omit them from new requests. Convert historical field aliases explicitly before loading or saving an older configuration.

PropTypeDefaultDescription
extraction_definition_promptstring—Prompt defining what playbook entries to extract. Historical `playbook_definition_prompt`/`feedback_definition_prompt` names require explicit configuration conversion.
tagging_definition_prompt?string—Prompt defining tags applied asynchronously to persisted playbooks
aggregation_config?PlaybookAggregatorConfigPlaybookAggregatorConfig()Configuration for playbook aggregation (clustering similar user playbooks). Missing and legacy `null` values use the enabled defaults. Set `min_cluster_size` to `1` to disable aggregation while retaining user-playbook extraction. Historical `playbook_aggregator_config` requires explicit configuration conversion.
deduplication_config?DeduplicationConfig—Configuration for playbook deduplication against existing user playbooks.
request_sources_enabled?array[string]—Only extract from these request sources. If not set, extracts from all sources

PlaybookAggregatorConfig

Configuration for playbook aggregation (clustering similar user playbooks into agent playbooks).

PropTypeDefaultDescription
min_cluster_size?integer2Minimum user playbooks required before aggregation runs. Set to 1 to disable aggregation while retaining user-playbook extraction.
reaggregation_trigger_count?integer2Number of new user playbooks that trigger a re-aggregation
clustering_similarity?float | nullModel-specific: 0.30 for MiniLM/other models; 0.85 for NomicCosine similarity threshold for clustering. Higher values require user playbooks to be more similar to cluster together (0.0–1.0). When omitted, Reflexio uses the active embedding model's calibrated default.
direction_overlap_threshold?float0.6Token overlap threshold for grouping playbooks by direction (0.0–1.0)

DeduplicationConfig

Controls bounded retrieval of existing playbooks. Every nonempty consolidation batch uses the evidence-backed Create/Replace/Remove method with independent audit before publication. The former strategy selector is retired; configuration upgrades remove known old values while preserving search settings and original backups.

PropTypeDefaultDescription
search_threshold?float0.4Minimum similarity score for bounded deduplication candidate generation (0.0–1.0). This dedicated threshold is independent from the embedding model's user-facing retrieval default; an LLM makes the final duplicate decision.
search_top_k?integer5Maximum number of existing playbooks to retrieve per new playbook

The historical max_unified_content_chars input is ignored and removed on save. It only selected a warning and never limited or truncated consolidation output. Consolidation output length is reported as max_output_chars in the existing playbook_consolidation_done operational event; configure alert thresholds in log monitoring instead of organization settings.

RetrievalExperimentConfig

The one retrieval experiment currently assigning agent search traffic.

PropTypeDefaultDescription
experiment_idstring—Organization-unique experiment ID, up to 128 characters.
holdout_percentagefloat—Percentage of users assigned to holdout. Must be greater than 0 and less than 100.

RetrievalExperimentRecord

Historical lifecycle metadata for a retrieval experiment. It contains all RetrievalExperimentConfig fields plus:

PropTypeDefaultDescription
started_atinteger—Unix timestamp when assignment began.
ended_at?integer—Unix timestamp when assignment stopped. Omitted while active.

RetrievalFloorConfig

Configuration for the read-path relevance floor applied on unified search (/api/search). Retrieved candidates are reranked by a cross-encoder, and any result whose relevance score falls below the per-arm floor is dropped. Because filtering happens after retrieval, a search arm can return fewer than top_k results — including zero — when nothing clears its floor.

Floors are raw, model-specific cross-encoder logits, not probabilities, so they are not bounded to [0, 1] and can be negative. Leave a floor null to use the calibrated default for the reranker discovered from the private inference service; a numeric value, including 0.0, is preserved exactly.

PropTypeDefaultDescription
candidate_pool_size?integer0Candidate budget per arm before flooring. Zero disables flooring; a positive value enables it when the reranker is available. Request top_k and other working-pool requirements remain lower bounds.
profile_floor?float | nullnullMinimum raw cross-encoder logit for a profile result to be kept. Null selects the discovered reranker's calibrated default.
user_playbook_floor?float | nullnullMinimum raw cross-encoder logit for a user-playbook result to be kept. Null selects the discovered reranker's calibrated default.
agent_playbook_floor?float | nullnullMinimum raw cross-encoder logit for an agent-playbook result to be kept. Null selects the discovered reranker's calibrated default.

PendingToolCallConfig

Configuration for non-blocking pending tool calls (async information tools) during extraction.

Creation consent and lifetime share pending_ttl_seconds: zero disables new calls; positive seconds choose their exact lifetime. A positive per-tool TTL cannot reopen a zero base. Zero also pauses the existing periodic pending-call expiry sweep, as the former opt-out did. The former enabled switch is rejected by current readers. Normal versioned startup preparation preserves historical opt-outs and custom durations. Existing calls, callbacks and persisted expiry remain intact; frozen execution still checks actual policy changes.

The former max_pending_followups_per_scope warning threshold is retired, including per-tool overrides. Creating or attaching a durable request no longer depends on a synchronous backlog count. Migrate any rules using that warning event; existing created/attached events retain their meanings. TTL and answer-reuse policies remain configurable.

PropTypeDefaultDescription
pending_ttl_seconds?integer0Nonnegative lifetime for new pending calls. Zero disables creation; positive seconds select their expiry. Requires storage and does not cancel accepted work.
prior_answer_valid_seconds?integer2592000How long a prior answer is reused before re-asking.
similarity_threshold?float0.0Similarity threshold for matching prior answers (0.0–1.0).
max_resume_attempts?integer3Maximum resume attempts.
max_finalization_attempts?integer3Maximum finalization attempts.
hmac_secrets?array[string][]HMAC secrets used to sign/verify resume callbacks.
tool_overrides?dict[str, PendingToolCallToolOverrideConfig]—Optional per-tool overrides keyed by exact tool name. Each override may set any of the limit fields above; unset fields fall back to the base values.

Resumed extraction uses the shared durable-learning scheduler and renewable per-user ownership. REFLEXIO_DURABLE_LEARNING_POLL_SECONDS controls pickup (default 2 seconds); REFLEXIO_DURABLE_LEARNING_LEASE_SECONDS controls the renewable user lease (default 300 seconds). There is no additional resume polling timer or non-renewable run-claim lifetime. Local resolutions wake an existing owner.

Stop old workers before upgrading. Normal startup preparation validates and removes historical resume_poll_interval_seconds and resume_claim_ttl_seconds fields, including valid custom values, while preserving org opt-outs and all unrelated policy. The old values are not copied into the renewable lease. Malformed saved values stop conversion without overwriting the original. Current models reject these fields; direct library users must prepare historical files before strict loading.

Old REFLEXIO_RESUME_POLL_INTERVAL_SECONDS and REFLEXIO_RESUME_CLAIM_TTL_SECONDS assignments produce value-free obsolete-setting diagnostics. They do not select or block work policy. Remove them from your deployment configuration. Waiting-call expiry, cached-answer freshness, per-tool overrides and resume versus finalization retry budgets remain independent settings.

LineageGCConfig

Controls reclamation of retired profile and playbook tombstones after the audit and rollback window.

PropTypeDefaultDescription
tombstone_grace_window_days?integer90Nonnegative days to retain tombstones after retirement; zero holds Class A reclamation indefinitely.

Zero holds both expired-profile tombstoning and tombstone deletion, including optimizer evidence governed by the lineage retention policy. Positive days preserve that exact grace period. Plain-row expiry, row caps, and governance retention remain independent. lineage_gc.enabled is retired; the normal versioned upgrade preserves its effective consent and retains the original saved configuration. Reenabling explicitly selects a positive duration.

REFLEXIO_MAINTENANCE_INTERVAL_SECONDS owns the deployment sweep cadence. The older per-org poll_interval_seconds=86400 is accepted and omitted from canonical configuration; custom values require explicit migration.

ExpiryReclamationConfig

PropTypeDefaultDescription
enabled?booleanfalseDirectly reclaim expired non-audited rows such as share links and pending tool calls.

GovernanceRetentionConfig

Hosted Enterprise retention policy for audit events. These fields are accepted but do not perform audit-event reclamation in Local OSS.

PropTypeDefaultDescription
audit_events_max_age_days?integer0Nonnegative maximum audit-event age in days. Zero retains indefinitely; positive values authorize reclamation at that age.
audit_events_delete_batch_limit?integer500Maximum expired rows deleted per table in one sweep; positive and at most 2147483647.

Audit reclamation applies the configured batch limit separately to audit events and erasure tombstones in the existing transaction. The limit is supported again; saved custom values are preserved. Invalid saved values stop loading rather than resetting retention policy. Deletion capacity remains independent of expiration age.

Upgrade historical audit_events_retention_enabled and audit_events_retention_days through the supported configuration upgrade before using current readers. False or missing enablement becomes zero, including when a positive age was saved. True preserves the historical age. Exact originals retain disabled custom ages for deliberate recovery. An old positive age alone never grants deletion consent.

AgentSuccessConfig

Configuration for agent success evaluation. Evaluation judges the complete source-filtered session, or an explicitly requested cutover prefix. It does not use extraction window/stride overrides. Omit retired evaluation window fields; they no longer control evaluation. Use the top-level profile and playbook fields for extraction geometry.

Extractor and evaluation identities are fixed. Retired identity fields are not configuration choices; omit them from new requests. Convert historical field aliases explicitly before loading or saving an older configuration.

PropTypeDefaultDescription
success_definition_promptstring—Prompt defining what constitutes a successful agent interaction. Config defaults include a built-in AI-agent success rubric.
tagging_definition_prompt?string—Prompt defining tags applied asynchronously to persisted evaluation summaries. On stored-config reads, the retired `metadata_definition_prompt` field is discarded and does not become tagging instructions; new writes reject that retired field.
request_sources_enabled?list[string]—Only evaluate requests from these sources. If not set, evaluates all sources.
sampling_rate?float0.05Fraction of sessions to evaluate automatically (0.0–1.0)
evaluation_only_sampling_rate?float | nullnull (inherits sampling_rate)Fraction of evaluation-only sessions to evaluate automatically with the session-success judge (0.0–1.0). When null, inherits the current sampling_rate.
retrieved_learning_sampling_rate?float | nullnull (inherits sampling_rate)Fraction of sessions on which the retrieved-learning relevance and impact judge runs (0.0–1.0). When null, inherits sampling_rate. Its verdicts back the retrieved-learning evaluation API and the Evaluations page; set it independently to grade served learnings more or less densely than the session-success judge. The enterprise offline playbook tuner samples and judges its own sessions and does not read these verdicts, so this rate does not affect tuning.

Historical extraction presets

A preset fills the profile and playbook window and stride fields. Edit either pair independently after applying a preset. Settings saves the four numerical fields.

Normal API/SDK writes and stored reads reject extraction_preset, old window names, plural extractor names and retired optimizer switches. Use canonical configuration names. To upgrade a saved local file while retaining its original, run:

Terminal
reflexio config upgrade-file old.json --output canonical.json

The explicit upgrader understands the historical presets below. Historical window and stride values supply defaults for both extractors. Each extractor keeps its effective value from the old nested overrides when present. Historical project preset tags do not override inherited geometry and require the project conversion operation. ExtractionPreset is migration-only, available from reflexio.config_migration; it is no longer exported by the current configuration schema.

  • quick_chat — short conversations (support bots, quick Q&A). window_size=5, stride_size=3.
  • standard — general-purpose conversational agents. window_size=10, stride_size=8 (the default numeric geometry).
  • long_form — long conversations (coding assistants, research). window_size=25, stride_size=10.
  • high_volume — high-traffic agents (1000+ daily interactions). window_size=15, stride_size=8.

APIKeyConfig

API key configuration for LLM providers. When custom_endpoint is configured, it takes priority over all other providers for LLM completion calls (but not embeddings).

PropTypeDefaultDescription
custom_endpoint?CustomEndpointConfig—Custom OpenAI-compatible endpoint
openai?OpenAIConfig—OpenAI API configuration (direct or Azure)
anthropic?AnthropicConfig—Anthropic API configuration
openrouter?OpenRouterConfig—OpenRouter API configuration
gemini?GeminiConfig—Google Gemini API configuration
minimax?MiniMaxConfig—MiniMax API configuration
deepseek?DeepSeekConfig—DeepSeek API configuration
dashscope?DashScopeConfig—Alibaba DashScope (Qwen) API configuration
zai?ZAIConfig—Zhipu AI (GLM) API configuration
moonshot?MoonshotConfig—Moonshot (Kimi) API configuration
xai?XAIConfig—xAI (Grok) API configuration

CustomEndpointConfig

OpenAI-compatible gateway credentials and base URL. Models belong to LLMConfig: generation_model_name is required with a custom endpoint; omitted text-role choices inherit it. The retired endpoint model field is rejected. Validated against SSRF: cloud metadata endpoints are always blocked, and when REFLEXIO_BLOCK_PRIVATE_URLS=true, literal private IPs plus hostnames resolving to private, loopback, link-local, reserved, multicast, or unspecified IPs are blocked.

PropTypeDefaultDescription
api_keystring—API key for the custom endpoint.
api_basestring—Base URL of the custom endpoint (e.g., 'http://localhost:8000/v1').

OpenAIConfig

OpenAI API configuration. At least one of api_key or azure_config must be provided.

PropTypeDefaultDescription
api_key?string—Direct OpenAI API key.
azure_config?AzureOpenAIConfig—Azure OpenAI configuration (use instead of `api_key` for Azure-hosted OpenAI).

AzureOpenAIConfig

The selected model identifies the deployment as azure/<deployment-name>. Older saved deployment_name values are ignored and removed from canonical configuration.

PropTypeDefaultDescription
api_keystring—Azure OpenAI API key.
endpointstring—Azure resource endpoint (e.g. `https://your-resource.openai.azure.com/`).
api_version?string"2024-02-15-preview"API version.

AnthropicConfig

PropTypeDefaultDescription
api_keystring—Anthropic API key.

OpenRouterConfig

PropTypeDefaultDescription
api_keystring—OpenRouter API key.

GeminiConfig

PropTypeDefaultDescription
api_keystring—Google Gemini API key.

MiniMaxConfig

PropTypeDefaultDescription
api_keystring—MiniMax API key.

DeepSeekConfig

PropTypeDefaultDescription
api_keystring—DeepSeek API key.

DashScopeConfig

PropTypeDefaultDescription
api_keystring—Alibaba DashScope (Qwen) API key.
api_base?string—Base URL. If unset, the default is used — override for intl vs. China endpoints.

ZAIConfig

PropTypeDefaultDescription
api_keystring—Zhipu AI (GLM) API key.

MoonshotConfig

PropTypeDefaultDescription
api_keystring—Moonshot (Kimi) API key.

XAIConfig

PropTypeDefaultDescription
api_keystring—xAI (Grok) API key.

LLMConfig

LLM model and output policies. Custom gateways require generation_model_name; omitted should-run and pre-retrieval choices inherit it. Other providers use system defaults for an unset role. Embedding selection remains independent of the text gateway.

PropTypeDefaultDescription
should_run_model_name?string | false | null—Extraction eligibility model. Use false to skip the check or null to inherit the default.
generation_model_name?string—Model for generation tasks and the fallback for evaluation
evaluation_model_name?string | null—Model for evaluation. Unset uses the configured generation model or the provider evaluation default.
generation_max_output_tokens?positive integer | null—Explicit generation output-token budget. Required for custom-gateway extraction; unset preserves native provider defaults. Never inferred from context size.
generation_timeout_seconds?integer | null—Generation timeout in seconds; unset uses the generation client default.
embedding_model_name?string—Model for embedding generation
pre_retrieval_model_name?string—Model for pre-retrieval query reformulation