Participant: Sreenandan Shashidharan
Problem Statement: Pathway - Financial Agents that work with Real-time Insights
The challenge is to build a "production grade, streaming native, agentic system" for the finance world. The core requirement is to use the Pathway framework as the streaming data engine to create applications that react to data as it arrives, moving beyond traditional batch processing.
This solution must leverage streaming to enable features like "always up to date metrics" and "live indexes that refresh as documents and events change".
This project implements the foundational backend for a real-time financial insights agent. It is a streaming-native RAG (Retrieval-Augmented Generation) pipeline built entirely on the Pathway framework.
Our application (app.py) continuously monitors a stream of financial news articles (simulated via feed.jsonl). As new articles arrive, the pipeline automatically:
- Ingests the streaming data (
headline,body). - Processes the text by splitting it into manageable chunks (
TokenCountSplitter). - Embeds each chunk into a vector representation using a local
SentenceTransformermodel. - Indexes these vectors in a real-time
DocumentStore.
This DocumentStore is then exposed via a DocumentStoreServer, providing a live REST API. Any LLM or financial agent can query this API to retrieve the most up-to-the-second relevant news to make informed decisions, directly addressing the need for "live indexing for retrieval".
In Future work, I am working on integrating with Ollama to make it agentic RAG and have much more context.
The architecture is simple, modular, and built entirely on Pathway's core components, as required by the "Problem Statement".
-> [TokenCountSplitter] -> [SentenceTransformerEmbedder] -> [DocumentStore] -> [DocumentStoreServer (REST API)]]
How Pathway is Used:
- Streaming Data Ingest: Uses
pw.io.jsonlines.readin"streaming"mode to readfeed.jsonl. Theautocommit_duration_ms=500ensures new data is picked up almost instantly (within 500ms). - Real-time Transformations: The application uses Pathway's functional API (
.select(),.flatten()) to transform the raw data into indexed chunks. - Live Indexing (LLM xPack): Uses
pathway.xpacks.llm.embedders.SentenceTransformerEmbedderandpathway.xpacks.llm.document_store.DocumentStore. TheDocumentStoreis connected directly to the streaming input, so its index is incrementally updated as new articles arrive, requiring no manual re-indexing. - API Server (LLM xPack): Uses
pathway.xpacks.llm.servers.DocumentStoreServerto instantly expose our live index via a standard REST API. This aligns with the RAG templates provided in the developer resources.
This application is containerized using the provided Dockerfile for easy, one-command execution.
- Docker Desktop installed and running.
- A PowerShell terminal.
Open a PowerShell terminal in the project's root directory (where the Dockerfile is) and run:
docker build -t pathway-financial-agent .Run the following command to start the server. We use -v to mount the local feed.jsonl file into the container, allowing us to modify it from our host machine to simulate a live data stream.
docker run -p 8000:8000 -v ${PWD}/feed.jsonl:/app/feed.jsonl --rm --name pathway-app pathway-financial-agentLeave this terminal running. You will see logs from the Pathway server, indicating it's running on 0.0.0.0:8000.
Open a new, separate PowerShell terminal. You will use this to query the server and simulate new data.
See the PATHWAY OUTPUT SCRIPT.pdf for the step-by-step commands to run in this new terminal.