Analyst is an AI-powered data analysis web app built with Next.js.
It accepts prompts plus optional files, asks an LLM to generate Python code, runs that code in an AGB sandbox, and returns execution results (including chart outputs) in the chat UI.
- Multi-provider model support (OpenAI, Anthropic, Google; custom base URL/model override).
- File-aware prompting (
.txt,.csv,.json,.md,.py) with lightweight preprocessing. - Streaming chat responses with throttled rendering for smoother UX.
- Automatic Python code extraction from model output.
- Secure remote execution in AGB sandbox sessions.
- In-chat tool result rendering for execution output.
- Next.js 15 (App Router) + React 19 + TypeScript
- Vercel AI SDK (
ai,@ai-sdk/*) - Tailwind CSS + Radix UI
- AGB Cloud SDK for sandbox lifecycle and code execution
- User enters a prompt and optionally uploads files.
- Frontend sends messages, selected model, and processed files to
/api/chat. - Server builds a system prompt and streams LLM output back to the UI.
- Frontend extracts Python code from the model response.
- Extracted code is posted to
/api/sandboxand executed in AGB. - Execution results are appended as a tool message in chat.
- Node.js 18+ (recommended 20+)
pnpm(recommended),npm,yarn, orbun- A valid AGB API Key
- A valid LLM API Key for the selected provider
API keys are configured in the app settings panel at runtime (not via
.envby default).
Install dependencies:
pnpm installStart the development server:
pnpm devOpen http://localhost:3000.
- Open model settings and provide:
- AGB API Key
- LLM API Key
- Optional Base URL and Custom Model
- Choose a model from the picker.
- Add prompt and optional files.
- Submit and wait for:
- streamed model response
- sandbox execution result message
pnpm dev- Run local development serverpnpm build- Create production buildpnpm start- Start production serverpnpm lint- Run ESLint
app/
api/chat/route.ts # LLM streaming endpoint
api/sandbox/route.ts # AGB sandbox execution endpoint
page.tsx # Main chat UI
components/ # UI and chat components
lib/
model.ts # Provider/model client factory
prompt.ts # System prompt construction
preprocess.ts # File preprocessing helpers
models.json # Model catalog
- The sandbox endpoint currently executes generated code as Python.
- Uploaded files are prefixed and injected into the analysis prompt.
- AGB sessions are created per request and cleaned up after execution.