Hedge Assistant
Document-driven cash-flow extraction and Supabase operations with Sinapsis Agents and MCP.
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
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
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
| File | Purpose |
|---|---|
README.md | Demo-specific setup and interaction notes. |
webapp.py | Gradio file-upload and chat orchestration. |
webapp_api.py | Alternative FastAPI endpoint. |
configs/csv_loader.yaml | CSV reader Agent. |
configs/excel_loader.yaml | Excel reader Agent. |
configs/pdf_loader.yaml | PDF reader Agent. |
configs/llm_cashflow_new.yaml | Structured cash-flow extraction Agent. |
configs/supabase_mcp_client.yaml | Asynchronous Supabase MCP workflow. |
artifacts/cashflow_prompt.txt | Extraction instructions. |
artifacts/mcp_prompt.txt | MCP instructions. |
docker/Dockerfile | Runtime image. |
docker/compose_test.yaml | Ollama 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:
cd hedge-assistant/dockerdocker compose -f compose_test.yaml up --buildThe 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