Two-person academic project ยท 2026

Financial AI agent

A conversational portfolio application built as a real service architecture: streamed inference, retrieval, standardized tool execution, persistent sessions, and explicit trade confirmation.

My role
Backend architecture, orchestration, persistence, delivery, and most frontend integration
Stack
Python, FastAPI, MCP, React, PostgreSQL, ChromaDB, Ollama, Docker
Scope
Proof of concept using projected historical market data

Turn a chatbot into an inspectable application

The goal was not merely to generate financial text. The agent needed to retrieve relevant knowledge, distinguish advice from an instruction, call portfolio tools, persist state, stream progress, and require confirmation before changing a simulated portfolio.

  • 6 servicesContainerized with health checks and persistent volumes.
  • 7 MCP toolsPortfolio, market-data and order operations behind a protocol boundary.
  • 2-step tradesCommands become pending actions before explicit confirmation.

Separate reasoning, retrieval, and actions

The FastAPI orchestrator routes each request between general chat, RAG retrieval, and trade handling. MCP keeps executable tools separate from model inference; PostgreSQL owns portfolio and session state; ChromaDB stores retrievable knowledge; Ollama provides local generation and embeddings.

Architecture diagram connecting a React frontend to FastAPI inference, MCP and PostgreSQL, RAG and ChromaDB, and local Ollama models
Responses and processing events stream to the React client using server-sent events.

My engineering contribution

This was a two-person academic project. I owned the backend architecture, agent orchestration, MCP integration, persistence, containerization, tests, and most frontend integration.

  • Built and refined the FastAPI chat orchestrator, trade-intent flow, guardrails, error handling, and server-sent event protocol.
  • Migrated portfolio state from JSON to PostgreSQL and moved tool execution to FastMCP.
  • Integrated RAG queries, citations, MCP tool-call visibility, persistent sessions, and the React processing-step UI.
  • Containerized the frontend, inference API, MCP server, RAG pipeline, PostgreSQL, and Ollama with Docker Compose.
  • Added focused tests for guardrails, RAG price lookup, trade execution, persistence, and confirmation behavior.

Safety and transparency were part of the architecture

  • Explicit confirmationDetected trade commands become pending actions; the agent cannot silently mutate the simulated portfolio.
  • Protocol boundaryMCP tools expose typed operations instead of giving the model direct database access.
  • Traceable processingThe interface shows RAG queries, tool calls, citations, and streaming progress instead of hiding the agent loop.
  • Persistent statePostgreSQL stores portfolios and sessions; container health checks and volumes make the multi-service system reproducible.
  • Input controlsGuardrails and focused tests cover prompt injection patterns, financial intent, price lookup, and confirmation flow.
  • Honest scopeProjected historical prices make this a controlled proof of concept, not a claim of live financial advice or real trading.