Skip to main content
Loading navigation
Back to prompt library

Construct LlamaIndex Clearing Risk Agent

Linked challenge: Build a Real-Time Clearing Risk Engine using LlamaIndex RAG Framework

Prompt source

implementation8 lines4 sectionsNo variables0 checklist items
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llama_index.core.agent import AgentRunner
from llama_index.core.tools import FunctionTool

def calculate_required_margin(exposure: float, collateral: float, vix: float) -> dict:
    # Execute margin calculation formula...
    pass

margin_tool = FunctionTool.from_defaults(fn=calculate_required_margin)

# Build LlamaIndex agent with vector index memory and margin tool...