feat(agent): complete EvoAgent integration for all 6 agent roles
Migrate all agent roles from Legacy to EvoAgent architecture: - fundamentals_analyst, technical_analyst, sentiment_analyst, valuation_analyst - risk_manager, portfolio_manager Key changes: - EvoAgent now supports Portfolio Manager compatibility methods (_make_decision, get_decisions, get_portfolio_state, load_portfolio_state, update_portfolio) - Add UnifiedAgentFactory for centralized agent creation - ToolGuard with batch approval API and WebSocket broadcast - Legacy agents marked deprecated (AnalystAgent, RiskAgent, PMAgent) - Remove backend/agents/compat.py migration shim - Add run_id alongside workspace_id for semantic clarity - Complete integration test coverage (13 tests) - All smoke tests passing for 6 agent roles Constraint: Must maintain backward compatibility with existing run configs Constraint: Memory support must work with EvoAgent (no fallback to Legacy) Rejected: Separate PM implementation for EvoAgent | unified approach cleaner Confidence: high Scope-risk: broad Directive: EVO_AGENT_IDS env var still respected but defaults to all roles Not-tested: Kubernetes sandbox mode for skill execution
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
"""
|
||||
Analyst Agent - Based on AgentScope ReActAgent
|
||||
Performs analysis using tools and LLM
|
||||
|
||||
.. deprecated:: 0.2.0
|
||||
AnalystAgent is deprecated and will be removed in a future version.
|
||||
Use :class:`backend.agents.base.evo_agent.EvoAgent` instead.
|
||||
See docs/CRITICAL_FIXES.md for migration guide.
|
||||
"""
|
||||
import warnings
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from agentscope.agent import ReActAgent
|
||||
@@ -13,11 +19,23 @@ from ..config.constants import ANALYST_TYPES
|
||||
from ..utils.progress import progress
|
||||
from .prompt_factory import build_agent_system_prompt, clear_prompt_factory_cache
|
||||
|
||||
# Emit deprecation warning on module import
|
||||
warnings.warn(
|
||||
"AnalystAgent is deprecated. Use EvoAgent instead. "
|
||||
"See docs/CRITICAL_FIXES.md for migration guide.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
|
||||
class AnalystAgent(ReActAgent):
|
||||
"""
|
||||
Analyst Agent - Uses LLM for tool selection and analysis
|
||||
Inherits from AgentScope's ReActAgent
|
||||
|
||||
.. deprecated:: 0.2.0
|
||||
Use :class:`backend.agents.base.evo_agent.EvoAgent` with
|
||||
workspace-driven configuration instead.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
@@ -33,6 +51,10 @@ class AnalystAgent(ReActAgent):
|
||||
"""
|
||||
Initialize Analyst Agent
|
||||
|
||||
.. deprecated:: 0.2.0
|
||||
Use :class:`backend.agents.unified_factory.UnifiedAgentFactory`
|
||||
or :class:`backend.agents.base.evo_agent.EvoAgent` instead.
|
||||
|
||||
Args:
|
||||
analyst_type: Type of analyst (e.g., "fundamentals", etc.)
|
||||
toolkit: AgentScope Toolkit instance
|
||||
@@ -42,6 +64,14 @@ class AnalystAgent(ReActAgent):
|
||||
config: Configuration dictionary
|
||||
long_term_memory: Optional ReMeTaskLongTermMemory instance
|
||||
"""
|
||||
# Emit runtime deprecation warning
|
||||
warnings.warn(
|
||||
f"AnalystAgent('{analyst_type}') is deprecated. "
|
||||
"Use EvoAgent via UnifiedAgentFactory instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
if analyst_type not in ANALYST_TYPES:
|
||||
raise ValueError(
|
||||
f"Unknown analyst type: {analyst_type}. "
|
||||
|
||||
Reference in New Issue
Block a user