How manojkesani/rln works
Trillian is a browser-based chat application backed by a FastAPI service. A user authenticates, selects a model, creates or opens a conversation, and sends turns that the API runs through an agent before returning a reply (optionally streamed). Conversation metadata, agent checkpoints, and per-model-call usage are distinct state paths. The graph follows the documented router and service wiring; several frontend-to-API and external-provider links are not visible in the supplied excerpts, so they are omitted or marked unverified.
Main entry points: main.py FastAPI app · chat.py Conversation service · App.tsx Route app · conversations.py Conversation routes
Components 27
Web application
- Route app
apps/web/src/App.tsx - Login page
apps/web/src/pages/LoginPage.tsx - Auth guard
apps/web/src/components/RequireAuth.tsx - Chat page
apps/web/src/pages/ChatPage.tsx - API client
apps/web/src/api/client.ts - SSE parser
apps/web/src/lib/sse.ts
API and domain services
- FastAPI app
apps/api/app/main.py - Auth routes
apps/api/app/routers/auth.py - Auth service
apps/api/app/services/auth.py - Conversation routes
apps/api/app/routers/conversations.py - Conversation service
apps/api/app/services/chat.py - Stream service
apps/api/app/services/streaming.py - Usage service
apps/api/app/services/usage.py - Model routes
apps/api/app/routers/models.py
Model execution
- Model catalog
apps/api/app/llm/catalog.py - Model factory
apps/api/app/llm/factory.py - Provider adapters
apps/api/app/llm/providers.py - Agent builder
apps/api/app/agents/builder.py - Usage callbacks
apps/api/app/llm/callbacks.py
Persistence and observability
- Conversation records
apps/api/app/db/models/conversation.py - Model-call records
apps/api/app/db/models/llm_call.py - Agent checkpoints
apps/api/app/db/checkpointer.py - DB sessions
apps/api/app/db/session.py - Tracing setup
apps/api/app/tracing.py
Other components
- User
- Phoenix collector
- LLM providers
Connections 35
- User → Route app: uses
- Route app → Login page: routes to
apps/web/src/App.tsx - Route app → Auth guard: protects route
apps/web/src/App.tsx - Route app → Chat page: routes to
apps/web/src/App.tsx - Chat page → API client: requests
- Chat page → SSE parser: parses stream
- User → FastAPI app: sends requests
- FastAPI app → Auth routes: mounts
apps/api/app/main.py - FastAPI app → Conversation routes: mounts
apps/api/app/main.py - FastAPI app → Model routes: mounts
apps/api/app/main.py - FastAPI app → Tracing setup: sets up
apps/api/app/main.py - FastAPI app → Agent checkpoints: opens
apps/api/app/main.py - Auth routes → Auth service: calls
apps/api/app/routers/auth.py - Conversation routes → Conversation service: calls
apps/api/app/routers/conversations.py - Conversation routes → Stream service: calls
apps/api/app/routers/conversations.py - Conversation routes → Usage service: calls
apps/api/app/routers/conversations.py - Model routes → Model catalog: queries
apps/api/app/routers/models.py - Conversation service → Model factory: builds model
apps/api/app/services/chat.py - Conversation service → Agent builder: builds agent
apps/api/app/services/chat.py - Conversation service → Usage callbacks: registers
apps/api/app/services/chat.py - Conversation service → Conversation records: reads and writes
apps/api/app/services/chat.py - Conversation service → Agent checkpoints: loads history
apps/api/app/services/chat.py - Stream service → Model factory: builds model
apps/api/app/services/streaming.py - Stream service → Agent builder: runs agent
apps/api/app/services/streaming.py - Stream service → Usage callbacks: registers
apps/api/app/services/streaming.py - Usage service → Model-call records: reads usage
apps/api/app/services/usage.py - Model catalog → Provider adapters: uses
apps/api/app/llm/catalog.py - Model factory → Provider adapters: selects
apps/api/app/llm/factory.py - Usage callbacks → DB sessions: opens session
apps/api/app/llm/callbacks.py - Usage callbacks → Model-call records: writes records
apps/api/app/llm/callbacks.py - DB sessions → Conversation records: persists
- DB sessions → Model-call records: persists
- Agent builder → Agent checkpoints: saves state
apps/api/app/agents/builder.py - Tracing setup → Phoenix collector: exports traces
- Provider adapters → LLM providers: calls models