INNER CODE UNIT · Python

_apply_agent_card

Fincept-Corporation/FinceptTerminal · fincept-qt/scripts/agents/finagent_core/main.py:213

def _apply_agent_card(config: Dict[str, Any]):
    """If config names a registry agent (agent_id) whose card carries
    instructions, return (card config + this run's wiring, card name); otherwise
    (config, None). DB-saved agents are already expanded by the host."""
    agent_id = config.get("agent_id", "")
    if not agent_id:
        return config, None
    try:
        from finagent_core.agent_loader import get_loader
        card = get_loader().registry.get(agent_id)
    except Exception as e:
        logger.warning(f"Could not load agent card '{agent_id}': {e}")
        return config, None
    if not card or not card.config.get("instructions"):
        return config, None
    merged = {**card.config}
    for key, value in config.items():
        if key in _RUN_CONFIG_KEYS or key.startswith("terminal_"):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…