Docs /tutorials/ Hedge Assistant
tutorials / use-cases

Hedge Assistant

Document-driven cash-flow extraction and Supabase operations with Sinapsis Agents and MCP.

financellmmcpagentsdockerDocumentation latest

Source: Hedge Assistant — GitHub

The Hedge Assistant illustrates how Sinapsis can extract transaction information from uploaded financial documents, transform that information into structured cash-flow entries, and use an asynchronous MCP-enabled Agent to interact with Supabase.

Its executable source is maintained in sinapsis-demos/hedge-assistant, not in this documentation repository. Repository access may be required. The source currently targets development infrastructure and has not been verified as a public, reproducible deployment.

What it demonstrates

  • File-specific document loading for CSV, Excel, and PDF inputs.

  • Structured cash-flow extraction with a schema-constrained LLM response.

  • An asynchronous iterative Agent using an MCP client to request Supabase operations.

  • A Gradio chat interface, with an alternative FastAPI entry point.

The example uses several individually configured Agents coordinated by the application. The diagram below shows application orchestration, not a single Sinapsis Agent DAG. Each Agent has its own declared Template graph and DataContainer boundary.

Application flow

◇ DiagramDrag nodes · Scroll to zoom · Drag canvas to pan
flowchart TD
    U([User message and optional document]) --> APP[Gradio or FastAPI application]
    APP --> LOAD[Document loader Agent<br/>CSV / Excel / PDF]
    LOAD --> CONTEXT[Document context]
    CONTEXT --> LLM[Cash-flow extraction Agent<br/>LLaMACPPTextCompletion]
    LLM --> STRUCT[Structured cash-flow data]
    STRUCT --> MCP[Asynchronous MCP Agent<br/>AsyncWhileLoop]
    MCP --> SUPA[(Supabase)]
    MCP --> ANSWER([Assistant response])

Green-bordered nodes reference Sinapsis templates. Hover or focus them to fetch documentation.

View Mermaid source
mermaid
flowchart TD
    U([User message and optional document]) --> APP[Gradio or FastAPI application]
    APP --> LOAD[Document loader Agent<br/>CSV / Excel / PDF]
    LOAD --> CONTEXT[Document context]
    CONTEXT --> LLM[Cash-flow extraction Agent<br/>LLaMACPPTextCompletion]
    LLM --> STRUCT[Structured cash-flow data]
    STRUCT --> MCP[Asynchronous MCP Agent<br/>AsyncWhileLoop]
    MCP --> SUPA[(Supabase)]
    MCP --> ANSWER([Assistant response])

The loader selected by the application depends on the uploaded file extension. The extraction Agent returns records containing fields such as pay_receive, value_date, exposure_currency, exposure_amount, counterparty, and reference. The MCP Agent wraps a SupabaseMCPClient and EndpointLLMCompletionWithMCP within AsyncWhileLoop.

The application also sends the user's instruction to the MCP stage. The repository enables SQL execution and migration-related capabilities in its Supabase MCP configuration; deployments should restrict permissions and validate actions before granting access to real financial data.

Source files

FilePurpose
README.mdDemo-specific setup and interaction notes.
webapp.pyGradio file-upload and chat orchestration.
webapp_api.pyAlternative FastAPI endpoint.
configs/csv_loader.yamlCSV reader Agent.
configs/excel_loader.yamlExcel reader Agent.
configs/pdf_loader.yamlPDF reader Agent.
configs/llm_cashflow_new.yamlStructured cash-flow extraction Agent.
configs/supabase_mcp_client.yamlAsynchronous Supabase MCP workflow.
artifacts/cashflow_prompt.txtExtraction instructions.
artifacts/mcp_prompt.txtMCP instructions.
docker/DockerfileRuntime image.
docker/compose_test.yamlOllama and application services.

These links use the moving main branch; pin an immutable tested release or commit for a published tutorial.

Requirements and running the demo

The demo README specifies Docker/Compose with BuildKit, NVIDIA Container Toolkit, access to sinapsis-nvidia:base, and an NVIDIA GPU. The Compose configuration starts Ollama and pulls qwen2.5:7b; the extraction Agent uses a separate local GGUF configuration. The image build also references private package and SSH-based dependencies, so additional repository/index access may be needed.

From a checkout of the demos repository, the README's intended launch command is:

Terminalbash
cd hedge-assistant/docker
docker compose -f compose_test.yaml up --build

The interface is configured for port 7860 (open http://localhost:7860 on the machine running Docker). This is the repository's documented command, not a verified quickstart. A working deployment requires valid credentials, accessible model assets, and review of host-specific Docker mounts.

The repository also includes webapp_api.py for an alternative API-based integration; the provided Compose file starts webapp.py by default.

For the underlying concepts, see Agents and Templates. For the declared graph contract, see Agent Model.

Published from Git revision 7b7ba25d627b