diff --git a/python/configs/agent_cards/aswath_damodaran_agent.json b/python/configs/agent_cards/aswath_damodaran_agent.json index b5d28a931..3cf4796b5 100644 --- a/python/configs/agent_cards/aswath_damodaran_agent.json +++ b/python/configs/agent_cards/aswath_damodaran_agent.json @@ -1,5 +1,6 @@ { "name": "AswathDamodaranAgent", + "display_name": "Aswath Damodaran Agent", "url": "http://localhost:10010/", "description": "Valuation-focused analysis using robust discounted cash flow and intrinsic value methods. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Value Tesla using a DCF with scenario analysis", "What's the intrinsic value range for Nvidia based on conservative growth assumptions?" ], - "tags": ["valuation", "DCF", "intrinsic value"] + "tags": [ + "valuation", + "DCF", + "intrinsic value" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/ben_graham_agent.json b/python/configs/agent_cards/ben_graham_agent.json index 85ff7adfe..a3263413b 100644 --- a/python/configs/agent_cards/ben_graham_agent.json +++ b/python/configs/agent_cards/ben_graham_agent.json @@ -1,5 +1,6 @@ { "name": "BenGrahamAgent", + "display_name": "Ben Graham Agent", "url": "http://localhost:10011/", "description": "Margin-of-safety and value-investing oriented screens and stock selection. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,11 @@ "Find stocks trading below intrinsic value with strong balance sheets", "Screen for deep value opportunities in the small-cap universe" ], - "tags": ["value investing", "margin of safety"] + "tags": [ + "value investing", + "margin of safety" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/bill_ackman_agent.json b/python/configs/agent_cards/bill_ackman_agent.json index 3d39be94d..c8c990bf0 100644 --- a/python/configs/agent_cards/bill_ackman_agent.json +++ b/python/configs/agent_cards/bill_ackman_agent.json @@ -1,5 +1,6 @@ { "name": "BillAckmanAgent", + "display_name": "Bill Ackman Agent", "url": "http://localhost:10012/", "description": "Event-driven and activist-investor style analysis focused on catalysts and corporate structure improvements. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Identify potential activist targets with undervalued assets", "What catalysts could unlock value at Company X?" ], - "tags": ["activist", "event-driven", "catalyst"] + "tags": [ + "activist", + "event-driven", + "catalyst" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/cathie_wood_agent.json b/python/configs/agent_cards/cathie_wood_agent.json index 129dc1417..ded5d4434 100644 --- a/python/configs/agent_cards/cathie_wood_agent.json +++ b/python/configs/agent_cards/cathie_wood_agent.json @@ -1,5 +1,6 @@ { "name": "CathieWoodAgent", + "display_name": "Cathie Wood Agent", "url": "http://localhost:10013/", "description": "High-conviction growth and disruptive-innovation oriented analysis with long-term thematic views. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Assess the long-term growth thesis for ARK-style thematic investments", "How might disruptive technology revenues evolve over the next 5 years?" ], - "tags": ["growth", "disruption", "thematic"] + "tags": [ + "growth", + "disruption", + "thematic" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/charlie_munger_agent.json b/python/configs/agent_cards/charlie_munger_agent.json index 2e66b8fec..3cb80f6bc 100644 --- a/python/configs/agent_cards/charlie_munger_agent.json +++ b/python/configs/agent_cards/charlie_munger_agent.json @@ -1,5 +1,6 @@ { "name": "CharlieMungerAgent", + "display_name": "Charlie Munger Agent", "url": "http://localhost:10014/", "description": "Broad multidisciplinary perspective, focus on high-quality businesses with durable competitive advantages. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Identify companies with long-term competitive moats", "Evaluate management quality and capital allocation decisions" ], - "tags": ["quality investing", "moat", "capital allocation"] + "tags": [ + "quality investing", + "moat", + "capital allocation" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/fundamentals_analyst_agent.json b/python/configs/agent_cards/fundamentals_analyst_agent.json index 0f8485654..23539c5f3 100644 --- a/python/configs/agent_cards/fundamentals_analyst_agent.json +++ b/python/configs/agent_cards/fundamentals_analyst_agent.json @@ -1,5 +1,6 @@ { "name": "FundamentalsAnalystAgent", + "display_name": "Fundamentals Analyst", "url": "http://localhost:10023/", "description": "Financial-statement-driven analysis covering profitability, cash flows, and balance sheet strength. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Analyze revenue and margin trends for Microsoft", "Assess liquidity and leverage for Boeing" ], - "tags": ["fundamentals", "financial statements", "metrics"] + "tags": [ + "fundamentals", + "financial statements", + "metrics" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/michael_burry_agent.json b/python/configs/agent_cards/michael_burry_agent.json index 35ea1d46e..d6a47d5b1 100644 --- a/python/configs/agent_cards/michael_burry_agent.json +++ b/python/configs/agent_cards/michael_burry_agent.json @@ -1,5 +1,6 @@ { "name": "MichaelBurryAgent", + "display_name": "Michael Burry Agent", "url": "http://localhost:10015/", "description": "Contrarian, deep-research driven value and special-situation analysis. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Find contrarian opportunities overlooked by the market", "Analyze distressed or deeply undervalued securities" ], - "tags": ["contrarian", "deep value", "special situations"] + "tags": [ + "contrarian", + "deep value", + "special situations" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/mohnish_pabrai_agent.json b/python/configs/agent_cards/mohnish_pabrai_agent.json index 11ae4c70f..ca18a30de 100644 --- a/python/configs/agent_cards/mohnish_pabrai_agent.json +++ b/python/configs/agent_cards/mohnish_pabrai_agent.json @@ -1,5 +1,6 @@ { "name": "MohnishPabraiAgent", + "display_name": "Mohnish Pabrai Agent", "url": "http://localhost:10016/", "description": "Concentrated, low-risk value investing with a focus on high-upside asymmetric bets. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Build a concentrated portfolio of high-conviction value ideas", "Where are asymmetric risk-reward opportunities today?" ], - "tags": ["concentrated", "value", "asymmetric"] + "tags": [ + "concentrated", + "value", + "asymmetric" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/peter_lynch_agent.json b/python/configs/agent_cards/peter_lynch_agent.json index c9a70459d..122a72da2 100644 --- a/python/configs/agent_cards/peter_lynch_agent.json +++ b/python/configs/agent_cards/peter_lynch_agent.json @@ -1,5 +1,6 @@ { "name": "PeterLynchAgent", + "display_name": "Peter Lynch Agent", "url": "http://localhost:10017/", "description": "Bottom-up, growth-at-a-reasonable-price (GARP) style stock picking and idea generation. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Spot consumer-facing growth stories with reasonable valuations", "Which small-cap growth companies show durable revenue expansion?" ], - "tags": ["GARP", "bottom-up", "growth"] + "tags": [ + "GARP", + "bottom-up", + "growth" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/phil_fisher_agent.json b/python/configs/agent_cards/phil_fisher_agent.json index fa0eb5153..2fe2c21e6 100644 --- a/python/configs/agent_cards/phil_fisher_agent.json +++ b/python/configs/agent_cards/phil_fisher_agent.json @@ -1,5 +1,6 @@ { "name": "PhilFisherAgent", + "display_name": "Phil Fisher Agent", "url": "http://localhost:10018/", "description": "Qualitative growth investing focused on management, R&D, and long-term industry positioning. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Assess a company's management and research capabilities", "What are the long-term secular growth drivers for Company Y?" ], - "tags": ["qualitative", "management", "R&D"] + "tags": [ + "qualitative", + "management", + "R&D" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/rakesh_jhunjhunwala_agent.json b/python/configs/agent_cards/rakesh_jhunjhunwala_agent.json index 02c66092d..0e35cc881 100644 --- a/python/configs/agent_cards/rakesh_jhunjhunwala_agent.json +++ b/python/configs/agent_cards/rakesh_jhunjhunwala_agent.json @@ -1,5 +1,6 @@ { "name": "RakeshJhunjhunwalaAgent", + "display_name": "Rakesh Jhunjhunwala Agent", "url": "http://localhost:10019/", "description": "Concentrated, conviction-driven investing with an emphasis on high-growth emerging opportunities. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Identify high-growth opportunities in emerging markets", "Which mid-cap names have the potential to scale rapidly?" ], - "tags": ["emerging markets", "conviction", "growth"] + "tags": [ + "emerging markets", + "conviction", + "growth" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/sec_agent.json b/python/configs/agent_cards/sec_agent.json index 8835119bd..507ad4ada 100644 --- a/python/configs/agent_cards/sec_agent.json +++ b/python/configs/agent_cards/sec_agent.json @@ -1,5 +1,6 @@ { "name": "SecAgent", + "display_name": "SEC Agent", "url": "http://localhost:10003/", "description": "SecAgent can analyze SEC filings like 10-Q, 10-K, 13-F and analyze stock holdings of institutional investment managers. It can chat about stock performance, financial metrics, and market trends or track specific stocks and provide updates.", "skills": [ @@ -12,7 +13,11 @@ "How has the portfolio of Vanguard Group changed over the last four quarters?", "Can you provide insights on the stock performance of Apple and Microsoft based on recent 13F filings?" ], - "tags": ["13F", "stock holdings", "institutional investors"] + "tags": [ + "13F", + "stock holdings", + "institutional investors" + ] }, { "id": "compare_quarterly_reports", @@ -23,7 +28,11 @@ "Analyze Apple's Q1 vs Q4 financial performance from their 10-Q filings", "What are the key changes in Amazon's quarterly revenue and expenses over the past year?" ], - "tags": ["10-Q", "quarterly reports", "financial analysis"] + "tags": [ + "10-Q", + "quarterly reports", + "financial analysis" + ] }, { "id": "summarize_annual_reports", @@ -34,7 +43,11 @@ "What are the main highlights from Microsoft's annual 10-K filing?", "Provide a comprehensive summary of Meta's business segments from their 10-K report" ], - "tags": ["10-K", "annual reports", "financial summary"] + "tags": [ + "10-K", + "annual reports", + "financial summary" + ] }, { "id": "compare_industry_performance", @@ -45,7 +58,11 @@ "Compare the profitability metrics of JPMorgan, Bank of America, and Wells Fargo", "Analyze the revenue growth rates of Netflix, Disney, and Warner Bros Discovery" ], - "tags": ["industry comparison", "financial metrics", "competitive analysis"] + "tags": [ + "industry comparison", + "financial metrics", + "competitive analysis" + ] }, { "id": "analyze_revenue_mix_evolution", @@ -56,7 +73,11 @@ "Analyze the evolution of Amazon's revenue streams from 2020 to 2023", "What changes occurred in Apple's product revenue mix in the last 5 years?" ], - "tags": ["revenue mix", "business segments", "financial evolution"] + "tags": [ + "revenue mix", + "business segments", + "financial evolution" + ] }, { "id": "assess_financial_health_metrics", @@ -67,7 +88,11 @@ "What do the debt-to-equity ratios tell us about Boeing's financial stability?", "Analyze the cash flow trends and liquidity position of General Electric" ], - "tags": ["financial health", "liquidity", "debt analysis"] + "tags": [ + "financial health", + "liquidity", + "debt analysis" + ] }, { "id": "identify_risk_factors", @@ -78,9 +103,21 @@ "Analyze the regulatory risks mentioned in JPMorgan's annual report", "Compare the risk disclosures between traditional automakers and EV companies" ], - "tags": ["risk factors", "financial risk", "SEC filings"] + "tags": [ + "risk factors", + "financial risk", + "SEC filings" + ] } ], - - "enabled": true + "enabled": true, + "metadata": { + "version": "1.0.0", + "author": "ValueCell Team", + "tags": [ + "sec", + "13f", + "fund-analysis" + ] + } } \ No newline at end of file diff --git a/python/configs/agent_cards/sentiment_analyst_agent.json b/python/configs/agent_cards/sentiment_analyst_agent.json index fcff4aeb6..de7cb029e 100644 --- a/python/configs/agent_cards/sentiment_analyst_agent.json +++ b/python/configs/agent_cards/sentiment_analyst_agent.json @@ -1,5 +1,6 @@ { "name": "SentimentAnalystAgent", + "display_name": "Sentiment Analyst", "url": "http://localhost:10024/", "description": "Market sentiment and positioning analysis using newsflow, social signals, and positioning data. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Gauge retail sentiment around meme stocks", "Summarize recent news sentiment for Amazon" ], - "tags": ["sentiment", "news", "social"] + "tags": [ + "sentiment", + "news", + "social" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/stanley_druckenmiller_agent.json b/python/configs/agent_cards/stanley_druckenmiller_agent.json index cd1073a0d..b1f2e061f 100644 --- a/python/configs/agent_cards/stanley_druckenmiller_agent.json +++ b/python/configs/agent_cards/stanley_druckenmiller_agent.json @@ -1,5 +1,6 @@ { "name": "StanleyDruckenmillerAgent", + "display_name": "Stanley Druckenmiller Agent", "url": "http://localhost:10020/", "description": "Macro-driven allocation and tactical trading insights combining top-down macro views with security selection. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Develop a macro-informed allocation between equities and bonds", "What macro catalysts are likely to affect tech stocks this quarter?" ], - "tags": ["macro", "allocation", "tactical"] + "tags": [ + "macro", + "allocation", + "tactical" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/technical_analyst_agent.json b/python/configs/agent_cards/technical_analyst_agent.json index a23db4bf8..acb908ce1 100644 --- a/python/configs/agent_cards/technical_analyst_agent.json +++ b/python/configs/agent_cards/technical_analyst_agent.json @@ -1,5 +1,6 @@ { "name": "TechnicalAnalystAgent", + "display_name": "Technical Analyst", "url": "http://localhost:10022/", "description": "Chart-based technical analysis for entries, exits, trend identification and momentum signals. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Provide support/resistance levels for AAPL", "Identify bullish or bearish chart patterns for TSLA" ], - "tags": ["technical", "charts", "momentum"] + "tags": [ + "technical", + "charts", + "momentum" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/trading_agents.json b/python/configs/agent_cards/trading_agents.json index 2e115af9b..8d83ca964 100644 --- a/python/configs/agent_cards/trading_agents.json +++ b/python/configs/agent_cards/trading_agents.json @@ -1,24 +1,67 @@ { "name": "TradingAgentsAdapter", + "display_name": "Trading Agents", "url": "http://localhost:10002", "description": "TradingAgents - Multi-agent trading analysis system with market, sentiment, news and fundamentals analysis", "capabilities": { "streaming": true, "push_notifications": false }, - "skills": [{ - "id": "trading_agents", - "name": "Trading Agents", - "description": "Trading Agents - Multi-agent trading analysis system with market, sentiment, news and fundamentals analysis", - "examples": [ - "Analyze APPL using all analysts", - "Analyze NVDA using market and fundamentals analysts", - "Analyze TSLA using all analysts, date 2024-01-15, enable debug mode" - ], - "tags": ["analysis", "multi-agent", "stocks", "US market"] - }], + "skills": [ + { + "id": "trading_agents", + "name": "Trading Agents", + "description": "Trading Agents - Multi-agent trading analysis system with market, sentiment, news and fundamentals analysis", + "examples": [ + "Analyze APPL using all analysts", + "Analyze NVDA using market and fundamentals analysts", + "Analyze TSLA using all analysts, date 2024-01-15, enable debug mode" + ], + "tags": [ + "analysis", + "multi-agent", + "stocks", + "US market" + ] + } + ], "provider": { "organization": "Tauric", "url": "https://arxiv.org/abs/2412.20138" + }, + "metadata": { + "version": "1.0.0", + "author": "ValueCell Team", + "tags": [ + "trading", + "analysis", + "multi-agent", + "stocks", + "finance" + ], + "supported_tickers": [ + "AAPL", + "GOOGL", + "MSFT", + "NVDA", + "TSLA", + "AMZN", + "META", + "NFLX", + "SPY" + ], + "supported_analysts": [ + "market", + "social", + "news", + "fundamentals" + ], + "supported_llm_providers": [ + "openai", + "anthropic", + "google", + "ollama", + "openrouter" + ] } } \ No newline at end of file diff --git a/python/configs/agent_cards/valuation_analyst_agent.json b/python/configs/agent_cards/valuation_analyst_agent.json index 6aa3227eb..192dbcf31 100644 --- a/python/configs/agent_cards/valuation_analyst_agent.json +++ b/python/configs/agent_cards/valuation_analyst_agent.json @@ -1,5 +1,6 @@ { "name": "ValuationAnalystAgent", + "display_name": "Valuation Analyst", "url": "http://localhost:10025/", "description": "Multi-method valuation using DCF, comparables, and precedent transactions to derive price targets. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Produce a 12-month price target using DCF and comps", "Compare valuation multiples across peers" ], - "tags": ["valuation", "comparables", "DCF"] + "tags": [ + "valuation", + "comparables", + "DCF" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/configs/agent_cards/warren_buffett_agent.json b/python/configs/agent_cards/warren_buffett_agent.json index 48eb1bbe4..03b7b2e17 100644 --- a/python/configs/agent_cards/warren_buffett_agent.json +++ b/python/configs/agent_cards/warren_buffett_agent.json @@ -1,5 +1,6 @@ { "name": "WarrenBuffettAgent", + "display_name": "Warren Buffett Agent", "url": "http://localhost:10021/", "description": "Long-term value investing with emphasis on durable businesses, simple economics, and shareholder-friendly management. **CAUTION**: Only stock symbols in {AAPL, GOOGL, MSFT, NVDA, TSLA} is/are supported and the agent will refuse to answer for other symbols. The input should contain one or more stock symbol(s) from this list. ", "skills": [ @@ -11,8 +12,12 @@ "Evaluate a company's long-term competitive advantage and free cash flow generation", "Which businesses should be held for decades?" ], - "tags": ["long-term", "value", "moat"] + "tags": [ + "long-term", + "value", + "moat" + ] } ], "enabled": true -} +} \ No newline at end of file diff --git a/python/valuecell/core/agent/card.py b/python/valuecell/core/agent/card.py index 11ead50af..1a0351290 100644 --- a/python/valuecell/core/agent/card.py +++ b/python/valuecell/core/agent/card.py @@ -5,12 +5,18 @@ from a2a.types import AgentCapabilities, AgentCard from valuecell.utils import get_agent_card_path +FIELDS_UNDEFINED_IN_AGENT_CARD_MODEL = {"enabled", "metadata", "display_name"} + def parse_local_agent_card_dict(agent_card_dict: dict) -> Optional[AgentCard]: if not isinstance(agent_card_dict, dict): return None - if "enabled" in agent_card_dict: - del agent_card_dict["enabled"] + # Defined by us, remove fields that are not part of AgentCard + for field in FIELDS_UNDEFINED_IN_AGENT_CARD_MODEL: + if field in agent_card_dict: + del agent_card_dict[field] + + # Requested fields as per AgentCard model if "description" not in agent_card_dict: agent_card_dict["description"] = ( f"No description available for {agent_card_dict.get('name', 'unknown')} agent." @@ -25,6 +31,8 @@ def parse_local_agent_card_dict(agent_card_dict: dict) -> Optional[AgentCard]: agent_card_dict["default_output_modes"] = [] if "version" not in agent_card_dict: agent_card_dict["version"] = "" + + # Parse into AgentCard model agent_card = AgentCard.model_validate(agent_card_dict) return agent_card diff --git a/python/valuecell/server/db/init_db.py b/python/valuecell/server/db/init_db.py index 51acdac2a..e23020d9c 100644 --- a/python/valuecell/server/db/init_db.py +++ b/python/valuecell/server/db/init_db.py @@ -1,20 +1,24 @@ """Database initialization script for ValueCell Server.""" +import json import logging import sys from pathlib import Path -from typing import Optional, TYPE_CHECKING +from typing import TYPE_CHECKING, Optional + +from valuecell.utils.path import get_agent_card_path if TYPE_CHECKING: from .models.asset import Asset -from sqlalchemy import text, inspect +from sqlalchemy import inspect, text from sqlalchemy.exc import SQLAlchemyError - -from .connection import get_database_manager, DatabaseManager -from .models.base import Base -from ..config.settings import get_settings -from ..services.assets import get_asset_service +from valuecell.server.config.settings import get_settings +from valuecell.server.db.connection import DatabaseManager, get_database_manager +from valuecell.server.db.models.agent import Agent +from valuecell.server.db.models.asset import Asset +from valuecell.server.db.models.base import Base +from valuecell.server.services.assets import get_asset_service # Configure logging logging.basicConfig( @@ -150,8 +154,6 @@ def initialize_assets_with_service(self) -> bool: session = self.db_manager.get_session() try: - from .models.asset import Asset - initialized_count = 0 for ticker in default_tickers: @@ -293,7 +295,6 @@ def initialize_assets_with_service(self) -> bool: def _create_fallback_asset(self, ticker: str) -> Optional["Asset"]: """Create fallback asset data when adapter search fails.""" - from .models.asset import Asset # Basic fallback data for common tickers (using proper EXCHANGE:SYMBOL format) fallback_data = { @@ -413,90 +414,8 @@ def initialize_basic_data(self) -> bool: session = self.db_manager.get_session() try: - # Import models here to avoid circular imports - from .models.agent import Agent - # Define default agents - default_agents = [ - { - "name": "AIHedgeFundAgent", - "display_name": "AI Hedge Fund Agent", - "description": "AI-powered hedge fund analysis and trading agent", - "version": "1.0.0", - "enabled": True, - "capabilities": { - "streaming": False, - "push_notifications": False, - }, - "metadata": { - "version": "1.0.0", - "author": "ValueCell Team", - "tags": ["hedge-fund", "ai", "trading"], - }, - }, - { - "name": "Sec13FundAgent", - "display_name": "SEC 13F Fund Agent", - "description": "SEC 13F fund analysis and tracking agent", - "version": "1.0.0", - "enabled": True, - "capabilities": { - "streaming": False, - "push_notifications": False, - }, - "metadata": { - "version": "1.0.0", - "author": "ValueCell Team", - "tags": ["sec", "13f", "fund-analysis"], - }, - }, - { - "name": "TradingAgentsAdapter", - "display_name": "Trading Agents Adapter", - "description": "TradingAgents - Multi-agent trading analysis system with market, sentiment, news and fundamentals analysis", - "version": "1.0.0", - "enabled": True, - "capabilities": { - "streaming": True, - "push_notifications": False, - }, - "metadata": { - "version": "1.0.0", - "author": "ValueCell Team", - "tags": [ - "trading", - "analysis", - "multi-agent", - "stocks", - "finance", - ], - "supported_tickers": [ - "AAPL", - "GOOGL", - "MSFT", - "NVDA", - "TSLA", - "AMZN", - "META", - "NFLX", - "SPY", - ], - "supported_analysts": [ - "market", - "social", - "news", - "fundamentals", - ], - "supported_llm_providers": [ - "openai", - "anthropic", - "google", - "ollama", - "openrouter", - ], - }, - }, - ] + default_agents = get_local_agent_cards() # Insert default agents for agent_data in default_agents: @@ -624,6 +543,28 @@ def init_database(force: bool = False) -> bool: return False +def get_local_agent_cards() -> list[dict]: + """Get list of local agent card configurations.""" + agent_cards_dir = Path(get_agent_card_path()) + agent_cards = [] + + if not agent_cards_dir.exists() or not agent_cards_dir.is_dir(): + logger.warning(f"Agent cards directory does not exist: {agent_cards_dir}") + return agent_cards + + for file_path in agent_cards_dir.glob("*.json"): + try: + with file_path.open("r", encoding="utf-8") as f: + card_config = json.load(f) + agent_cards.append(card_config) + logger.info(f"Loaded agent card config: {file_path.name}") + except Exception as e: + logger.error(f"Error loading agent card config {file_path.name}: {e}") + continue + + return agent_cards + + def main(): """Main entry point for database initialization script.""" import argparse diff --git a/python/valuecell/server/db/models/agent.py b/python/valuecell/server/db/models/agent.py index 1954b532b..d053a311c 100644 --- a/python/valuecell/server/db/models/agent.py +++ b/python/valuecell/server/db/models/agent.py @@ -110,7 +110,13 @@ def from_config(cls, config_data: Dict[str, Any]) -> "Agent": description=config_data.get("description"), version=config_data.get("version", "1.0.0"), enabled=config_data.get("enabled", True), - capabilities=config_data.get("capabilities"), + capabilities=config_data.get( + "capabilities", + { + "streaming": True, + "push_notifications": False, + }, + ), agent_metadata=config_data.get("metadata"), config=config_data.get("config"), )