How rohit-db/bi-hub-app works
BI Hub is a Chainlit business-intelligence chat app with two selectable answer paths: an in-app reasoning agent using Genie MCP, or a Multi-Agent Supervisor endpoint. A message is authenticated, combined with bounded chat history, routed to the selected agent, normalized into streaming events, and rendered to the user; table output can be formatted from pipe tables. Lakebase backs durable chat history, with app-owned Chainlit tables. The README also documents Unity Catalog governance and MAS trace logging; their runtime wiring is not shown in the sampled sources, so those links are marked unverified.
Main entry points: routes.py Message router · identity.py Identity and tokens · app.py Chainlit app · reasoning_agent.py Reasoning agent
Components 23
Chat and presentation
- Chainlit app
src/app/app.py - Message router
src/app/routes.py - History builder
src/app/routes.py - Event normalizer
src/app/services/mas_normalizer.py - Stream renderer
src/app/services/renderer.py - Table parser
src/app/services/table_parser.py
Agent execution
- Reasoning agent
src/app/agent/reasoning_agent.py - Genie MCP client
src/app/agent/genie_mcp.py - MAS client
src/app/services/mas_client.py
Identity and access
- Identity validation
src/app/auth/ensure_identity.py - Header authentication
src/app/auth/header.py - Identity and tokens
src/app/auth/identity.py - App configuration
src/app/config.py
Persistence
- Chainlit data layer
src/app/memory/layer.py - Lakebase PostgreSQL
- Lakebase credentials
src/app/memory/credentials.py - Durable schema
src/app/memory/schema.py - Schema setup
src/scripts/setup_chainlit_schema.py
Other components
- BI user
- Managed Genie MCP
- MAS endpoint
- Unity Catalog governance
- MAS trace logging
Connections 26
- BI user → Chainlit app: sends chat
README.md - Chainlit app → Message router: registers handlers
src/app/app.py - Message router → Identity validation: validates identity
src/app/routes.py - Header authentication → Identity and tokens: creates identity
src/app/auth/header.py - Identity validation → Identity and tokens: constructs tokens
src/app/auth/ensure_identity.py - Identity validation → App configuration: reads auth settings
src/app/auth/ensure_identity.py - Message router → History builder: builds context
src/app/routes.py - Message router → Reasoning agent: routes Genie One
src/app/routes.py - Message router → MAS client: routes supervisor
src/app/routes.py - Reasoning agent → Genie MCP client: opens tool server
src/app/agent/reasoning_agent.py - Genie MCP client → Managed Genie MCP: queries space
README.md - Reasoning agent → Identity and tokens: reads bearer token
src/app/agent/reasoning_agent.py - MAS client → Identity and tokens: reads bearer token
src/app/services/mas_client.py - MAS client → MAS endpoint: streams invocations
src/app/services/mas_client.py - Message router → Event normalizer: normalizes events
src/app/routes.py - Message router → Stream renderer: renders stream
src/app/routes.py - Stream renderer → Table parser: parses tables
src/app/services/renderer.py - Chainlit app → Chainlit data layer: configures persistence
src/app/app.py - Chainlit data layer → Lakebase PostgreSQL: persists chat
README.md - Chainlit data layer → Lakebase credentials: injects credentials
- Durable schema → Lakebase PostgreSQL: creates tables
README.md - Durable schema → Lakebase credentials: connects with credentials
src/app/memory/schema.py - Schema setup → Lakebase PostgreSQL: grants schema access
README.md - Managed Genie MCP → Unity Catalog governance: governed data access
README.md - MAS endpoint → Unity Catalog governance: governed data access
README.md - MAS endpoint → MAS trace logging: logs traces
README.md