feat: production-agentic infrastructure remediation#112
Conversation
Upgrades agentic infrastructure across all 9 production domains: **Cost Controls (C1)**: CostTrackingLLM wrapper enforces per-request ($1) and daily ($50) budget caps on every LLM call via OpenRouterProvider. **Model Profiles (S2)**: Extracted MODEL_PROFILES to YAML config file for updates without code changes. **Persistent Memory (C2)**: SQLite-backed checkpointer replaces in-memory MemorySaver across all 6 agents. Write-through memory stores with persistent SQLite connection (not per-write). **Deployment Hardening (I1)**: /health, /health/ready, /health/live endpoints. Dockerfile HEALTHCHECK. docker-compose restart policies, resource limits, health-conditioned depends_on, graceful shutdown. **Decision Audit Trail (I2)**: DecisionLog SQLAlchemy model with logging on all 10 agent-invoking tools. Error classification and fire-and-forget writes. **Backtesting Replanning (S1)**: 3 bounded retry loops in the LangGraph workflow (market regime, strategy selection, validation). Fixed attribute-style TypedDict access bug. **Research Vector Store (S3)**: ChromaDB-backed semantic cache with temporal decay scoring and deduplication. Optional dependency with graceful fallback. **Multi-Agent Coordination**: SharedAgentContext for cross-agent findings, context handoff in supervisor invoke paths, result aggregation with conflict detection, session cleanup. **Tool Integration**: Per-category rate limiter (8 categories), enforced asyncio.timeout() per tool, ErrorCategory + DecisionStatus enums, tool registry status endpoint. **Security**: SecretStr for all API keys, SecretsFilter log masking, public binding validation, input sanitization module. 681 tests passing, 0 lint errors.
…s.product create_param_combs expects a tuple-based operation tree, not a dict. Use itertools.product to generate parameter combination dicts directly, which is what _generate_signals() actually consumes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8b3d732eb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
test |
Code ReviewBugs (must fix)
Warnings (should fix)
Notes
|
…st tracking
- Use get_api_key()/get_exa_api_key() instead of raw SecretStr in data.py
and research.py to prevent masked credentials in API calls
- Remove duplicate DB/Redis cleanup from on_event("shutdown") handler;
shutdown_handler callbacks already handle disposal
- Generate per-invocation request_id in CostTrackingLLM instead of
per-instance, preventing budget accumulation across unrelated calls
- Add __class__ property shim so isinstance(wrapper, BaseChatModel)
returns True for LangGraph compatibility
- Only set _table_ensured=True on success in DecisionLogger, allowing
retry after transient DB failures
Code ReviewBugs (must fix)
Warnings (should fix)
Notes
|
Summary
Comprehensive production-agentic remediation across all 9 domains, upgrading the MaverickMCP codebase to production-grade agentic infrastructure.
CostTrackingLLMwrapper with per-request ($1.00) and daily ($50.00) budget caps,CostAccumulatorwith thread-safe tracking, externalized model profiles to YAMLMemoryStorewith persistent connections,SqliteSaver-backed LangGraph checkpointer replacing in-memoryMemorySaveracross all agentsDecisionLoggerwith async-safe fire-and-forget DB writes,DecisionLogSQLAlchemy model with indexes,SecretsFilterfor API key masking in logs/health,/health/ready,/health/liveendpoints, graceful shutdown with SIGTERM handling, resource limits in docker-composeSharedAgentContextfor cross-agent finding sharing, prior findings injection into agent prompts, real result aggregation with conflict detectionasyncio.timeout()enforcement, error classification (ErrorCategoryStrEnum),get_tool_registry_statusintrospection toolSecretStrfor all API keys in settings, input sanitization (sanitize_ticker,sanitize_text_input,sanitize_portfolio_name),warn_on_public_bindingvalidatoroptimize_strategycrash —vbt.utils.params.create_param_combs()expects tuple operation trees, replaced withitertools.productto generate parameter dicts28 files changed, 5277 insertions, 454 deletions
Test plan
optimize_strategybacktest tool verified working after fix