Files
ss-tools/specs/033-gradio-agent-chat/plan.md
2026-06-09 10:10:26 +03:00

1.9 KiB

Implementation Plan: Gradio Agent Chat (LangGraph)

Branch: 033-gradio-agent-chat | Date: 2026-06-08 | Spec: spec.md

Summary

Gradio agent backend + Svelte frontend via @gradio/client submit(). LangGraph create_react_agent() + interrupt()/Command(resume=...) + PostgresSaver + RunnableWithMessageHistory. Structured JSON metadata streaming. No REST confirmations, no custom WebSocket.

Technical Context

Language: Python 3.9+/TypeScript Svelte 5 runes Key Dependencies: gradio>=5.0, langgraph>=0.2, langchain-core>=0.3, langchain-openai>=0.3, langgraph-checkpoint-postgres, pdfplumber, openpyxl (back); @gradio/client (front) Storage: PostgreSQL 16 (persistence + checkpoints via langgraph-checkpoint-postgres) Testing: pytest (back), vitest L1 model + L2 UX (front) Frontend: SvelteKit SPA, model-first (AgentChatModel.svelte.ts C4), runes-only Performance: First token <1.5s, streaming 60fps, file upload ≤10MB

Constitution Check — Passed

All 8 principles satisfied: semantic contracts, decision memory, external orchestrator, module discipline, RBAC, Svelte 5 runes, test-driven C3+, attention-optimized.

Project Structure

New/Changed Files

backend/src/agent/         — app.py, langgraph_setup.py, tools.py, middleware.py, document_parser.py
backend/src/api/routes/    — agent_conversations.py, auth.py
backend/src/models/        — agent.py
backend/src/schemas/       — agent.py
frontend/src/lib/models/   — AgentChatModel.svelte.ts (rewritten)
frontend/src/lib/components/assistant/ — ConversationList, ToolCallCard, ConfirmationCard, ConnectionIndicator
frontend/src/routes/agent/ — +page.svelte
frontend/src/types/        — agent.ts
docker/                    — Dockerfile.agent, docker-compose.yml updated, nginx.conf updated

Deprecated

backend/src/api/routes/assistant/_tool_registry.py@DEPRECATED Tombstone (FR-022). #endregion (plan summary)