Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI4Finance Foundation FinRobot execute ic recommendation

From Leeroopedia
Knowledge Sources
Domains Finance, Private_Equity, Decision_Gate
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete pipeline step for the IC memo recommendation with a code-level IRR hurdle gate that overrides the LLM narrative when the LBO IRR falls below the sponsor's 15% hurdle, provided by the FinRobot pipeline layer.

Description

The _execute_recommendation function is the IC memo recommendation step executor. It:

  1. Reads the ICFinancials (containing the LBO result) from structured_context
  2. Runs the LLM recommendation agent for the qualitative narrative
  3. Applies the IRR hurdle gate: when LBO IRR < SPONSOR_IRR_HURDLE (15%), prepends a mandatory "DO NOT PROCEED" override prefix to the LLM's recommendation
  4. Returns the final recommendation text

The gate is a code-level override — the LLM's recommendation narrative is preserved but the mandatory override prefix ensures the code gate, not the narrative, is the final authority on deal feasibility.

Usage

  • IC_Memo workflow (Step 5): The final recommendation step. The IRR hurdle gate is the non-negotiable authority.
  • Import this when you need an IC memo recommendation with a deterministic IRR gate.

Code Reference

Source Location

  • Repository: FinRobot
  • File: finrobot_desktop/finrobot/engine/pipelines/ic_memo.py

Signature

async def _execute_recommendation(
    agent: Agent,
    deps: FinRobotDeps,
    prompt: str,
    structured_context: dict,
    ticker: str,
) -> StepOutput:
    """IC memo recommendation with IRR hurdle gate.

    Reads ICFinancials from structured_context for the LBO IRR.
    The code gate overrides the LLM recommendation to DO NOT PROCEED
    when LBO IRR < SPONSOR_IRR_HURDLE (15%).
    """

Import

from finrobot.engine.pipelines.ic_memo import _execute_recommendation

I/O Contract

Inputs

Name Type Required Description
agent Agent Yes PydanticAI recommendation agent
deps FinRobotDeps Yes Settings, data_layer
prompt str Yes Recommendation prompt
structured_context dict Yes Must contain ICFinancials with lbo_result.irr
ticker str Yes Target company symbol

Outputs

Name Type Description
StepOutput StepOutput Recommendation text with IRR gate override prefix if IRR < hurdle

Usage Examples

IC Memo Recommendation

from finrobot.engine.pipelines.ic_memo import _execute_recommendation

result = await _execute_recommendation(
    agent=rec_agent,
    deps=deps,
    prompt="Provide an IC recommendation",
    structured_context=ctx,  # contains ICFinancials with lbo_result
    ticker="AAPL",
)
print(result.output)  # May start with "OVERRIDE: DO NOT PROCEED..."

Related Pages

Implements Principle

Requires Environment

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment