feat(024-generic-agent-interface-contrib): create BaseAgent abstract class with analyze(input) -> output contract
This commit is contained in:
parent
41ce854d86
commit
45d6dc22b7
|
|
@ -217,3 +217,6 @@ __marimo__/
|
|||
|
||||
# Cache
|
||||
**/data_cache/
|
||||
.kiro/
|
||||
ralph-kiro.sh
|
||||
progress.txt
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ No standardized input/output contract for agents. Hard to swap, compose, or benc
|
|||
## Tasks
|
||||
- [x] 1. Define AgentInput schema: ticker, date, context (market data, news, fundamentals)
|
||||
- [x] 2. Define AgentOutput schema: rating (5-tier), confidence, price_targets, thesis, risk_factors
|
||||
- [ ] 3. Create BaseAgent abstract class with analyze(input) -> output contract
|
||||
- [x] 3. Create BaseAgent abstract class with analyze(input) -> output contract
|
||||
- [ ] 4. Refactor existing agents (fundamentals, sentiment, news, technical) to implement BaseAgent
|
||||
- [ ] 5. Create AgentRegistry for pluggable agent discovery
|
||||
- [ ] 6. Add agent benchmarking: compare outputs across different LLM backends
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from .base_agent import BaseAgent
|
||||
from .utils.agent_utils import create_msg_delete
|
||||
from .utils.agent_states import AgentState, InvestDebateState, RiskDebateState
|
||||
from .utils.memory import FinancialSituationMemory
|
||||
|
|
@ -21,6 +22,7 @@ from .managers.portfolio_manager import create_portfolio_manager
|
|||
from .trader.trader import create_trader
|
||||
|
||||
__all__ = [
|
||||
"BaseAgent",
|
||||
"FinancialSituationMemory",
|
||||
"AgentState",
|
||||
"AgentInput",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
"""Abstract base class for trading agents with a standardized analyze contract."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from .utils.schemas import AgentInput, AgentOutput
|
||||
|
||||
|
||||
class BaseAgent(ABC):
|
||||
"""Base class all trading agents must implement.
|
||||
|
||||
Subclasses provide ``analyze`` which accepts an :class:`AgentInput` and
|
||||
returns an :class:`AgentOutput`, ensuring a uniform contract across every
|
||||
agent in the system.
|
||||
"""
|
||||
|
||||
name: str = "unnamed_agent"
|
||||
|
||||
@abstractmethod
|
||||
def analyze(self, agent_input: AgentInput) -> AgentOutput:
|
||||
"""Run analysis and return a standardized output."""
|
||||
...
|
||||
Loading…
Reference in New Issue