config
code_context_agent.config ¶
Configuration module using pydantic-settings.
This module provides application configuration management through environment variables using pydantic-settings. Settings are loaded from environment variables with the CODE_CONTEXT_ prefix and optionally from a .env file.
Example
from code_context_agent.config import get_settings settings = get_settings() print(settings.app_name) 'code-context-agent'
Environment Variables
CODE_CONTEXT_APP_NAME: Application name (default: "code-context-agent") CODE_CONTEXT_DEBUG: Enable debug mode (default: False) CODE_CONTEXT_LOG_LEVEL: Logging level (default: "INFO") CODE_CONTEXT_OUTPUT_FORMAT: Output format - "rich", "json", or "plain" (default: "rich") CODE_CONTEXT_MODEL_ID: Bedrock model ID for the agent (default: Opus 4.6) CODE_CONTEXT_REGION: AWS region for Bedrock CODE_CONTEXT_TEMPERATURE: Model temperature (default 1.0 for thinking) CODE_CONTEXT_LSP_SERVERS: Ordered fallback chains of LSP server commands per language (JSON dict) CODE_CONTEXT_LSP_TIMEOUT: LSP operation timeout in seconds CODE_CONTEXT_LSP_STARTUP_TIMEOUT: Maximum seconds to wait for LSP server to initialize CODE_CONTEXT_LSP_MAX_FILES: Maximum files before LSP analysis is skipped CODE_CONTEXT_AGENT_MAX_TURNS: Maximum agent turns before stopping (default: 1000) CODE_CONTEXT_AGENT_MAX_DURATION: Maximum agent duration in seconds (default: 1200) CODE_CONTEXT_OTEL_DISABLED: Disable OpenTelemetry tracing (default: True)
DEFAULT_OUTPUT_DIR module-attribute ¶
Default output directory name for analysis artifacts.
AnalysisMode ¶
Bases: StrEnum
Analysis mode selection.
Settings ¶
Bases: BaseSettings
Application settings loaded from environment variables.
Settings are loaded from environment variables prefixed with CODE_CONTEXT_ and optionally from a .env file in the current working directory.
Attributes:
| Name | Type | Description |
|---|---|---|
app_name | str | The application name used for identification and logging. |
debug | bool | Enable debug mode for verbose output and additional diagnostics. |
log_level | str | Logging level for the application logger. |
output_format | Literal['rich', 'json', 'plain'] | Output format for CLI responses. |
get_settings cached ¶
Get application settings instance (cached singleton).
Returns the same Settings instance on subsequent calls. Settings are loaded from environment variables and the optional .env file on first call.
Call get_settings.cache_clear() if you need to reload from environment (e.g., in tests).
Returns:
| Type | Description |
|---|---|
Settings | Settings instance loaded from environment. |
Example
settings = get_settings() settings.debug False settings.log_level 'INFO'