LangAlpha is an open-source framework for building persistent, domain-aware AI agents, initially applied to financial research. It tackles the context window limitations of traditional MCP servers by generating typed Python modules from schemas, and enables long-running research workflows through persistent sandboxes and memory. The makers highlight its general applicability beyond finance, despite its Wall Street origins.
A starter prompt for Claude Code, what you'll need, and how to reach them.
You are an expert full-stack developer. Build a foundational open-source framework, similar to LangAlpha, that solves the problem of context window bloat for AI agents interacting with many tools and enables persistent multi-session memory for agent workspaces. The core components should include: 1. **Schema-to-Client Generator:** A module that takes an OpenAPI/JSON Schema definition (representing an MCP server or any tool API) and automatically generates a strongly typed Python client library. This client should minimize token usage by only exposing necessary function signatures and docstrings, with full schema details available via introspection when needed. 2. **Persistent Workspace Manager:** Implement a system for creating and managing isolated, persistent agent workspaces. Each workspace should have its own file system (e.g., a mounted volume or cloud storage integration) where the agent can store its internal memory, research findings, and an index of files/artifacts. This workspace should persist across agent sessions. 3. **Agent Orchestration Integration:** Design the system to integrate seamlessly with popular LLM orchestration libraries (e.g., LangChain or LlamaIndex) or directly with the AI SDK v6 (Gemini). The agent should be able to import and use the generated Python client libraries as if they were local modules, and its context should be automatically loaded from and saved to the persistent workspace at the start/end of each interaction. 4. **Domain Context Injection:** Allow for the definition and injection of arbitrary, structured 'domain context' (e.g., user preferences, specific data points, configuration) into every agent interaction, without re-pasting it into the prompt explicitly each time. Use Next.js 16 App Router, React 19, Tailwind v4 for any UI, and Python for the backend agent logic. Store workspace metadata and agent memory in Neon Postgres on Vercel. For the MVP, focus on demonstrating the schema-to-client generation for a simple mock API (e.g., a weather API) and the ability for an agent to perform a multi-turn conversation, save its findings to its workspace, and then resume that conversation later, recalling its prior work. Your first task is to set up the project structure, including the Python backend for the agent logic and schema processing, and a minimal Next.js frontend to initiate agent sessions and display output. Then, implement a basic version of the schema-to-client generator.
Developers building AI agents and MCP servers would be a prime audience for a persistent agent framework; promote it as the next step beyond basic tool invocation.
Some technical context on what we ran into building this. MCP tools don't really work for financial data at scale. One tool call for five years of daily prices dumps tens of thousands of tokens into the context window. And data vendors pack dozens of tools into a single MCP server, schemas alone can eat 50k+ tokens before the agent does anything useful. So we auto-generate typed Python modules from the MCP schemas at workspace init and upload them into the sandbox. The agent just imports them like a normal library. Only a one-line summary per server stays in the prompt. We have around 80 tools across our servers and the prompt cost is the same whether a server has 3 tools or 30. This part isn't finance-specific, it works with any MCP server. The other big thing was making research actually persist across sessions. Most agents treat a single deliverable (a PDF, a spreadsheet) as the end goal. In investing that's day one. You update the model when earnings drop, re-run comps when a competitor reports, keep layering new analysis on old. But try doing that across agent sessions, files don't carry over, you re-paste context every time. So we built everything around w
Reply in the Hacker News thread to user 'zc2610' and consider opening an issue/PR on the GitHub repo if there's a specific feature or bug to address.
“I've been following LangAlpha's insights on persistent agent workspaces and efficient tool integration. I've built a functional demo addressing these pain points, particularly around context window optimization and multi-session memory. Happy to share how it scales beyond finance to any MCP server.”
Open the original ↗