How ghouma-workspace/agent-api works
AI API Assistant is a full-stack conversational agent: users authenticate, manage conversations, and send messages through a React chat UI; the FastAPI backend persists the turn, runs a LangGraph agent that may call tools, and returns the response with trace details. The README documents tool integrations, prompt management, summarization, caching, rate limiting, circuit breaking, and observability. Several backend modules were not excerpted, so their internal links are shown only where documented; otherwise the graph avoids asserting unverified calls.
Main entry points: chat_service.py Chat service · App.tsx Frontend routing · services.py Service dependencies · nodes Agent nodes
Components 30
React frontend
- Frontend routing
frontend/src/App.tsx - Chat page
frontend/src/pages/ChatPage.tsx - Login page
frontend/src/pages/LoginPage.tsx - Admin page
frontend/src/pages/AdminPage.tsx - Chat components
frontend/src/components/chat - Chat hooks
frontend/src/hooks/useChat.ts - API client
frontend/src/api/client.ts
API and application
- FastAPI app
backend/app/main.py - API routers
backend/app/api/v1/routers - Service dependencies
backend/app/api/deps/services.py - Authentication
backend/app/application/services/auth_service.py - Chat service
backend/app/application/services/chat_service.py - Prompt management
backend/app/application/services/prompt_service.py - Admin service
backend/app/application/services/admin_service.py
Agent and tools
- Agent graph
backend/app/application/agent/graph.py - Agent state
backend/app/application/agent/state.py - Agent nodes
backend/app/application/agent/nodes - Tool registry
backend/app/infrastructure/tools/registry.py - Tool plugins
backend/app/infrastructure/tools - Groq provider
backend/app/infrastructure/llm/groq_provider.py
Persistence and cache
- DB repositories
backend/app/infrastructure/db/repositories - Redis cache and limits
backend/app/infrastructure/cache
Observability and tasks
- Tracing and metrics
backend/app/infrastructure/observability - Summarization task
backend/app/infrastructure/tasks/summarization.py
Other components
- User
- GroqCloud
- Postgres
- Redis
- Langfuse
- Celery queue
Connections 38
- User → Frontend routing: uses
frontend/src/App.tsx - Frontend routing → Chat page: routes to
frontend/src/App.tsx - Frontend routing → Login page: routes to
frontend/src/App.tsx - Frontend routing → Admin page: routes to
frontend/src/App.tsx - Chat page → Chat components: renders
frontend/src/pages/ChatPage.tsx - Chat page → Chat hooks: uses
frontend/src/pages/ChatPage.tsx - Chat hooks → API client: calls
frontend/src/hooks/useChat.ts - Login page → API client: calls
frontend/src/pages/LoginPage.tsx - Admin page → API client: calls
frontend/src/pages/AdminPage.tsx - API client → API routers: HTTP requests
- FastAPI app → API routers: registers
backend/app/main.py - API routers → Service dependencies: resolves services
backend/app/api/v1/routers/auth.py - Service dependencies → Authentication: provides
backend/app/api/deps/services.py - Service dependencies → Chat service: provides
backend/app/api/deps/services.py - Service dependencies → Admin service: provides
backend/app/api/deps/services.py - Authentication → DB repositories: uses interfaces
backend/app/application/services/auth_service.py - Authentication → Postgres: persists sessions
- Chat service → DB repositories: reads and writes
backend/app/application/services/chat_service.py - DB repositories → Postgres: persists
backend/app/infrastructure/db/repositories/chat_repository.py - Chat service → Agent graph: invokes
backend/app/application/services/chat_service.py - Chat service → Agent state: creates
backend/app/application/services/chat_service.py - Agent graph → Agent nodes: dispatches
README.md - Agent graph → Agent state: flows state
backend/app/application/agent/state.py - Agent nodes → Prompt management: fetch prompts
- Agent nodes → Groq provider: requests completions
- Groq provider → GroqCloud: calls
README.md - Agent nodes → Tool registry: selects tools
- Tool registry → Tool plugins: registers plugins
README.md - Tool plugins → Redis cache and limits: checks cached results
README.md - Tool plugins → Redis: rate limits
README.md - Tool plugins → GroqCloud: calls external APIs
README.md - Chat service → Tracing and metrics: records chat telemetry
backend/app/application/services/chat_service.py - Chat service → Langfuse: starts and flushes trace
backend/app/application/services/chat_service.py - Tracing and metrics → Langfuse: exports traces
README.md - Chat service → Summarization task: dispatches periodically
backend/app/application/services/chat_service.py - Summarization task → Celery queue: queued by
README.md - Summarization task → Postgres: compacts history
README.md - Summarization task → Redis: invalidates cache
README.md