Configuration API¶
Pydantic settings and datasource configuration.
- class sqldbagent.core.config.PoolSettings(**data)[source]¶
Bases:
BaseModelDatabase pool settings.
- Variables:
size – Base pool size for sync engine usage.
max_overflow – Additional overflow connections allowed above
size.timeout_seconds – Time to wait for a pooled connection.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.SafetySettings(**data)[source]¶
Bases:
BaseModelDefault SQL safety policy settings.
- Variables:
read_only – Whether execution paths should default to read-only behavior.
allow_writes – Whether writable execution may be requested explicitly on top of the read-only default.
statement_timeout_seconds – Default execution timeout.
max_rows – Default maximum row count for user-facing query surfaces.
allowed_schemas – Optional schema allowlist enforced by higher layers.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.ProfilingSettings(**data)[source]¶
Bases:
BaseModelDefault profiling settings.
- Variables:
default_sample_size – Default number of sample rows.
max_sample_size – Maximum sample rows allowed by default tooling.
exact_unique_counts – Whether generic profilers should compute exact unique counts.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.ArtifactSettings(**data)[source]¶
Bases:
BaseModelArtifact persistence settings.
- Variables:
root_dir – Base directory for generated artifacts.
snapshots_dir – Snapshot subdirectory under
root_dir.documents_dir – Document-export subdirectory under
root_dir.diagrams_dir – Diagram-export subdirectory under
root_dir.prompts_dir – Prompt-export subdirectory under
root_dir.prompt_enhancements_dir – Prompt-enhancement subdirectory under
root_dir.embeddings_cache_dir – Embedding cache subdirectory under
root_dir.vectorstores_dir – Retrieval/vectorstore manifest subdirectory under
root_dir.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.EmbeddingSettings(**data)[source]¶
Bases:
BaseModelEmbedding-provider settings.
- Variables:
provider – Embedding backend identifier.
model – Provider-specific embedding model name.
dimensions – Optional embedding dimensionality override.
batch_size – Batch size used by embedding providers when supported.
cache_query_embeddings – Whether query embeddings should also be cached.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.RetrievalSettings(**data)[source]¶
Bases:
BaseModelRetrieval and vectorstore settings.
- Variables:
backend – Retrieval backend identifier.
qdrant_url – Base Qdrant HTTP URL.
qdrant_api_key – Optional Qdrant API key.
qdrant_grpc_port – Qdrant gRPC port when gRPC transport is enabled.
qdrant_prefer_grpc – Whether to prefer gRPC transport.
collection_prefix – Prefix used when generating Qdrant collection names.
default_top_k – Default number of documents returned from retrieval.
default_fetch_k – Fetch pool size used by MMR retrieval.
use_mmr – Whether retrievers should prefer MMR over plain similarity.
score_threshold – Optional score threshold applied to retrieval.
create_payload_indexes – Whether payload indexes should be created in Qdrant.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.LLMSettings(**data)[source]¶
Bases:
BaseModelOptional model-provider settings.
- Variables:
default_provider – Default provider identifier for future LLM features.
default_model – Default model name for future LLM features.
reasoning_effort – Default reasoning effort for supported reasoning models.
openai_api_key – Optional OpenAI API key loaded from the environment.
openai_base_url – Optional OpenAI-compatible base URL.
anthropic_api_key – Optional Anthropic API key loaded from the environment.
anthropic_base_url – Optional Anthropic base URL override.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.LangSmithSettings(**data)[source]¶
Bases:
BaseModelLangSmith tracing and project settings.
- Variables:
tracing – Whether LangSmith tracing is enabled for supported surfaces.
project – LangSmith project name used for traces.
api_key – Optional LangSmith API key loaded from the environment.
endpoint – Optional LangSmith API endpoint override.
workspace_id – Optional LangSmith workspace identifier.
tags – Default LangSmith trace tags applied across surfaces.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.AgentCheckpointSettings(**data)[source]¶
Bases:
BaseModelAgent checkpoint persistence settings.
- Variables:
backend – Checkpoint backend to use for agent persistence.
postgres_url – Optional Postgres connection string for LangGraph checkpointing.
auto_setup – Whether Postgres checkpointer tables should be initialized automatically.
pipeline – Whether the Postgres saver should use pipelining when supported.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.AgentMemorySettings(**data)[source]¶
Bases:
BaseModelAgent long-term memory store settings.
- Variables:
backend – Memory-store backend used by LangGraph runtime.store.
postgres_url – Optional Postgres connection string for durable memory.
auto_setup – Whether Postgres store tables should be initialized automatically.
pipeline – Whether the Postgres store should use pipelining when supported.
namespace_prefix – Prefix used when building sqldbagent store namespaces.
auto_sync_from_snapshot – Whether agents should persist snapshot-derived datasource context into the long-term store automatically.
auto_create_snapshot_if_missing – Whether state-seeding should create a snapshot for the active schema when no stored snapshot exists yet.
include_in_system_prompt – Whether remembered store context should be merged into the effective system prompt.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.AgentSettings(**data)[source]¶
Bases:
BaseModelAgent orchestration settings.
- Variables:
name – Stable agent name for LangChain/LangGraph surfaces.
include_latest_snapshot_context – Whether agents should inject latest snapshot summaries.
max_model_calls_per_run – Optional cap for model calls in a single run.
max_tool_calls_per_run – Optional cap for tool calls in a single run.
enable_todo_middleware – Whether the LangChain todo middleware should be enabled.
enable_human_in_the_loop – Whether
safe_query_sqlshould require approval middleware.enable_summarization_middleware – Whether context summarization middleware is enabled.
summarization_trigger_fraction – Fractional context threshold for summarization.
summarization_keep_messages – Number of recent messages to preserve after summarization.
summarization_model – Optional dedicated model identifier for summarization.
tool_call_digest_limit – Maximum number of compressed tool-call summaries to retain.
checkpoint – Agent checkpoint persistence settings.
memory – Agent long-term memory store settings.
enable_prompt_enhancements – Whether dynamic prompts should merge saved prompt-enhancement artifacts.
- Parameters:
data (
Any)name (str)
include_latest_snapshot_context (bool)
max_model_calls_per_run (int | None)
max_tool_calls_per_run (int | None)
enable_todo_middleware (bool)
enable_human_in_the_loop (bool)
enable_summarization_middleware (bool)
summarization_trigger_fraction (float)
summarization_keep_messages (int)
summarization_model (str | None)
tool_call_digest_limit (int)
checkpoint (AgentCheckpointSettings)
memory (AgentMemorySettings)
enable_prompt_enhancements (bool)
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- checkpoint: AgentCheckpointSettings¶
- memory: AgentMemorySettings¶
- class sqldbagent.core.config.MCPSettings(**data)[source]¶
Bases:
BaseModelFastMCP server settings.
- Variables:
transport – Default MCP transport to serve.
host – Default host for HTTP-based transports.
port – Default port for HTTP-based transports.
path – Default HTTP path for streamable transports.
log_level – Default FastMCP/Uvicorn log level for HTTP transports.
show_banner – Whether the FastMCP banner should be shown on startup.
stateless_http – Whether streamable HTTP should run in stateless mode.
- Parameters:
- model_config: ClassVar[ConfigDict] = {'extra': 'ignore', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.core.config.DatasourceSettings(**data)[source]¶
Bases:
BaseModelSingle datasource definition.
- Variables:
name – Stable datasource identifier used by services and adapters.
dialect – Database dialect used by the datasource.
url – SQLAlchemy-compatible connection URL.
echo – Whether SQLAlchemy should emit SQL logs.
pool – Pool configuration for this datasource.
safety – Default safety policy for this datasource.
- Parameters:
data (
Any)name (str)
dialect (Dialect)
url (str)
echo (bool)
pool (PoolSettings)
safety (SafetySettings)
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- dialect: Dialect¶
- pool: PoolSettings¶
- safety: SafetySettings¶
- class sqldbagent.core.config.AppSettings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_prefix_target=None, _env_file=PosixPath('.'), _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, _build_sources=None, **values)[source]¶
Bases:
BaseSettingsTop-level application settings.
- Variables:
env – Deployment environment label.
log_level – Default application log level.
datasources – Configured datasource definitions.
datasource_aliases – Optional alias map from short names to datasource names.
profiling – Default profiling settings.
artifacts – Artifact persistence settings.
llm – Optional model-provider settings.
langsmith – LangSmith tracing settings.
embeddings – Embedding-provider settings.
retrieval – Retrieval/vectorstore settings.
agent – Agent orchestration settings.
mcp – FastMCP server settings.
- Parameters:
_nested_model_default_partial_update (
bool|None, default:None)_env_prefix_target (
Literal['variable','alias','all'] |None, default:None)_env_file (
Path|str|Sequence[Path|str] |None, default:PosixPath('.'))_cli_parse_args (
bool|list[str] |tuple[str,...] |None, default:None)_cli_settings_source (
CliSettingsSource[Any] |None, default:None)_cli_implicit_flags (
bool|Literal['dual','toggle'] |None, default:None)_cli_kebab_case (
bool|Literal['all','no_enums'] |None, default:None)_cli_shortcuts (
Mapping[str,str|list[str]] |None, default:None)_secrets_dir (
Path|str|Sequence[Path|str] |None, default:None)_build_sources (
tuple[tuple[PydanticBaseSettingsSource,...],dict[str,Any]] |None, default:None)values (
Any)env (str)
log_level (str)
datasources (list[DatasourceSettings])
profiling (ProfilingSettings)
artifacts (ArtifactSettings)
llm (LLMSettings)
langsmith (LangSmithSettings)
embeddings (EmbeddingSettings)
retrieval (RetrievalSettings)
agent (AgentSettings)
mcp (MCPSettings)
default_datasource_name (str | None)
default_schema_name (str | None)
llm_default_provider (str | None)
llm_default_model (str | None)
llm_reasoning_effort (str | None)
openai_api_key (str | None)
openai_base_url (str | None)
anthropic_api_key (str | None)
anthropic_base_url (str | None)
langsmith_tracing (bool | None)
langsmith_project (str | None)
langsmith_api_key (str | None)
langsmith_endpoint (str | None)
langsmith_workspace_id (str | None)
agent_name (str | None)
agent_include_latest_snapshot_context (bool | None)
agent_max_model_calls_per_run (int | None)
agent_max_tool_calls_per_run (int | None)
agent_enable_todo_middleware (bool | None)
agent_enable_human_in_the_loop (bool | None)
agent_enable_summarization_middleware (bool | None)
agent_summarization_trigger_fraction (float | None)
agent_summarization_keep_messages (int | None)
agent_summarization_model (str | None)
agent_tool_call_digest_limit (int | None)
agent_checkpoint_backend (Literal['memory', 'postgres'] | None)
agent_checkpoint_postgres_url (str | None)
agent_checkpoint_auto_setup (bool | None)
agent_checkpoint_pipeline (bool | None)
agent_memory_backend (Literal['disabled', 'memory', 'postgres'] | None)
agent_memory_postgres_url (str | None)
agent_memory_auto_setup (bool | None)
agent_memory_pipeline (bool | None)
agent_memory_namespace_prefix (str | None)
agent_memory_auto_sync_from_snapshot (bool | None)
agent_memory_auto_create_snapshot_if_missing (bool | None)
agent_memory_include_in_system_prompt (bool | None)
qdrant_url (str | None)
qdrant_api_key (str | None)
qdrant_grpc_port (int | None)
qdrant_prefer_grpc (bool | None)
embeddings_provider (Literal['openai', 'hash'] | None)
embeddings_model (str | None)
embeddings_dimensions (int | None)
embeddings_batch_size (int | None)
embeddings_cache_query_embeddings (bool | None)
sqlite_path (str | None)
postgres_host (str | None)
postgres_port (int)
postgres_db (str | None)
postgres_user (str | None)
postgres_password (str | None)
postgres_demo_host (str | None)
postgres_demo_port (int)
postgres_demo_db (str | None)
postgres_demo_user (str | None)
postgres_demo_password (str | None)
mssql_host (str | None)
mssql_port (int)
mssql_database (str | None)
mssql_user (str | None)
mssql_password (str | None)
mssql_driver (str)
- model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': '__', 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'SQLDBAGENT_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'populate_by_name': True, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_by_alias': True, 'validate_by_name': True, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- datasources: list[DatasourceSettings]¶
- profiling: ProfilingSettings¶
- artifacts: ArtifactSettings¶
- llm: LLMSettings¶
- langsmith: LangSmithSettings¶
- embeddings: EmbeddingSettings¶
- retrieval: RetrievalSettings¶
- agent: AgentSettings¶
- mcp: MCPSettings¶
- classmethod validate_unique_datasources(value)[source]¶
Reject duplicate datasource names.
- Parameters:
value (
list[DatasourceSettings]) – Configured datasource definitions.- Returns:
Validated datasource definitions.
- Return type:
- build_default_datasources()[source]¶
Build convenience datasource definitions from environment fields.
- Returns:
Settings with synthesized datasources when needed.
- Return type:
- resolve_datasource_name(name)[source]¶
Resolve a datasource name or alias to its canonical datasource name.