-
Notifications
You must be signed in to change notification settings - Fork 0
Stav/observability and ux #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0928097
4eff068
341808d
9b4f557
63ca448
6a45199
0cf90c4
e9c4009
3cb1ede
69bf431
2bf1999
861e1e1
6fb25db
a1c6cfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,9 @@ | ||||||||||||||
| from pydantic import Field | ||||||||||||||
| from pydantic_settings import BaseSettings, SettingsConfigDict | ||||||||||||||
| from typing import Literal | ||||||||||||||
|
|
||||||||||||||
| # Reload trigger comment (timeout added) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| class AgentSettings(BaseSettings): | ||||||||||||||
| model_config = SettingsConfigDict(env_file=".env", extra="ignore") | ||||||||||||||
|
|
@@ -14,19 +18,57 @@ class AgentSettings(BaseSettings): | |||||||||||||
| EMBEDDER_KEY: str = "" | ||||||||||||||
| HYBRID_SEARCH_MAX_TABLES: int = 10 | ||||||||||||||
| MAX_PROFILES_TO_FETCH: int = 3 | ||||||||||||||
| PROFILE_FETCH_CONCURRENCY: int = Field(default=4, gt=0) | ||||||||||||||
| REDIS_URL: str = "redis://localhost:6379" | ||||||||||||||
|
|
||||||||||||||
| LANGFUSE_SECRET_KEY: str = Field(min_length=1) | ||||||||||||||
| LANGFUSE_PUBLIC_KEY: str = Field(min_length=1) | ||||||||||||||
| LANGFUSE_BASE_URL: str = Field(min_length=1) | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| # ── Jeen Integration ────────────────────────────────────────────────────── | ||||||||||||||
| JEEN_LLM_CORE_URL: str = "" # If empty, agent gracefully skips fetching | ||||||||||||||
| JEEN_API_KEY: str = "" # If empty, agent gracefully skips fetching | ||||||||||||||
| SKILLS_HOT_RELOAD: bool = False # If true, bypass Redis cache for skills | ||||||||||||||
|
|
||||||||||||||
| # ── G4: Feature Flags & Execution Modes ────────────────────────────────── | ||||||||||||||
| BACKEND_URL: str = "" # Studio backend URL for flag reads (e.g. http://backend:8000) | ||||||||||||||
| # If empty, FlagBridge falls back to env-var defaults | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| # Langfuse prompt names | ||||||||||||||
| LANGFUSE_PROMPT_EXTRACTOR: str = "text2sql/extractor" | ||||||||||||||
| LANGFUSE_PROMPT_SCHEMA_EXPLORER: str = "text2sql/schema_explorer" | ||||||||||||||
| LANGFUSE_PROMPT_QUERY_BUILDER: str = "text2sql/query_builder" | ||||||||||||||
| LANGFUSE_PROMPT_REFINER: str = "text2sql/refiner" | ||||||||||||||
| LANGFUSE_PROMPT_FINALIZER_SUMMARY: str = "text2sql/finalizer_summary" | ||||||||||||||
| LANGFUSE_PROMPT_FINALIZER_SQL_EXPLANATION: str = "text2sql/finalizer_sql_explanation" | ||||||||||||||
| LANGFUSE_PROMPT_FINALIZER_SQL_EXPLANATION: str = ( | ||||||||||||||
| "text2sql/finalizer_sql_explanation" | ||||||||||||||
| ) | ||||||||||||||
| LANGFUSE_PROMPT_REJECTION_ROUTER: str = "text2sql/rejection_router" | ||||||||||||||
|
|
||||||||||||||
| # ── G2-01: Table Scoping ────────────────────────────────────────────────── | ||||||||||||||
| TABLE_SCOPING_MODE: Literal["strict", "hybrid"] = "hybrid" | ||||||||||||||
|
|
||||||||||||||
| # ── G2-03: Advanced Schema Explorer phases ──────────────────────────────── | ||||||||||||||
| ENABLE_SEMANTIC_TYPING: bool = True # single batched LLM call — adds id/timestamp/category labels | ||||||||||||||
| ENABLE_JOIN_GRAPH: bool = False | ||||||||||||||
| ENABLE_SCHEMA_SUMMARIZATION: bool = False # generated once at profile-time, not at runtime | ||||||||||||||
| ENABLE_AMBIGUITY_DETECT: bool = True | ||||||||||||||
|
|
||||||||||||||
| # ── G2-04: Satisfaction Check ───────────────────────────────────────────── | ||||||||||||||
| SATISFACTION_CHECK_ENABLED: bool = True | ||||||||||||||
| SATISFACTION_CHECK_EXECUTION: bool = True | ||||||||||||||
| SATISFACTION_CHECK_PLAUSIBILITY: bool = True | ||||||||||||||
| SATISFACTION_CHECK_COLUMNS: bool = True | ||||||||||||||
| SATISFACTION_CHECK_SEMANTIC: bool = False # LLM-heavy, off by default | ||||||||||||||
| SATISFACTION_MIN_ROWS: int = 1 | ||||||||||||||
| SATISFACTION_MAX_ROWS: int = 50_000 | ||||||||||||||
| SATISFACTION_SEMANTIC_THRESHOLD: float = 0.75 | ||||||||||||||
| SATISFACTION_MAX_FAILURES: int = 2 # escalate to HITL after this many check failures | ||||||||||||||
|
|
||||||||||||||
| # ── G2-05: Redis Schema Cache ───────────────────────────────────────────── | ||||||||||||||
| SCHEMA_CACHE_TTL: int = 600 # seconds — DDL content | ||||||||||||||
| PROFILE_CACHE_TTL: int = 1800 # seconds — table profile statistics | ||||||||||||||
|
Comment on lines
+69
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Validate cache TTLs as positive values. These settings are unbounded, but Suggested change- SCHEMA_CACHE_TTL: int = 600 # seconds — DDL content
- PROFILE_CACHE_TTL: int = 1800 # seconds — table profile statistics
+ SCHEMA_CACHE_TTL: int = Field(default=600, gt=0) # seconds — DDL content
+ PROFILE_CACHE_TTL: int = Field(default=1800, gt=0) # seconds — table profile statistics📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| settings = AgentSettings() | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Drop root before the image starts.
The final container still runs
uvicornas root. Any compromise inagent.maingets full container privileges unnecessarily. Create a dedicated runtime user and switch to it beforeCMD.Suggested change
📝 Committable suggestion
🧰 Tools
🪛 Checkov (3.3.1)
[low] 1-26: Ensure that HEALTHCHECK instructions have been added to container images
(CKV_DOCKER_2)
[low] 1-26: Ensure that a user for the container has been created
(CKV_DOCKER_3)
🤖 Prompt for AI Agents
Source: Linters/SAST tools