INNER CODE UNIT · Python

_run_error_text

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

def _run_error_text(response: Any):
    """Return the error text when an Agno run failed, else None.

    Agno reports a failed run (missing/invalid API key, provider error, ...) as an
    ordinary RunOutput with status ERROR whose `content` is the error message. It
    used to be wrapped as {"success": True, "response": "<error message>"}, so the
    UI showed an API-key error as a successful answer.
    """
    status = getattr(response, "status", None)
    value = getattr(status, "value", status)
    if isinstance(value, str) and value.upper() == "ERROR":
        content = getattr(response, "content", None)
        return str(content) if content else "Agent run failed"
    return None


def _ui_guardrails_config(ui_cfg: Any):
    """Translate the CREATE tab's guardrail checkboxes into GuardrailsModule.from_config keys.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…