27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
"""Tool registry. All personas get the full core toolset; a persona's `tool_emphasis`
|
|
is a prompt hint (which tools to lean on), not a hard restriction. get_portfolio is bound
|
|
per-persona so each agent sees only its own account.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from config.personas import Persona
|
|
from tools.market_data import get_bars, get_fundamentals, get_news, get_quote
|
|
from tools.options import get_option_chain, get_option_quote
|
|
from tools.portfolio import make_get_portfolio
|
|
from tools.python_exec import run_python
|
|
from tools.sandbox import run_analysis
|
|
from tools.web import web_fetch, web_search
|
|
|
|
# Tools that are the same for every persona (portfolio is added per-persona below).
|
|
BASE_TOOLS = [
|
|
run_python, run_analysis, web_search, web_fetch, get_quote, get_bars, get_news,
|
|
get_fundamentals, get_option_chain, get_option_quote,
|
|
]
|
|
|
|
|
|
def build_toolset(persona: Persona | None = None) -> list:
|
|
"""Return the tool list for an agent, including a portfolio tool bound to its account."""
|
|
account = persona.id if persona is not None else ""
|
|
return [*BASE_TOOLS, make_get_portfolio(account)]
|