Skip to content

phoenixha4/DynamicUI

Repository files navigation

Conduit

An AI-powered conversational onboarding agent using LangGraph and Chainlit. Guides users through structured data collection journeys via a dynamic chat interface with auto-generated forms.

Architecture

User (browser)
    ↓ chat message
Chainlit UI  (ui/app/main.py → drive_conversation)
    ↓
agent_handler.py  (call_langgraph)
    ↓
run_graph()  (backend/agents/graph.py)
    ↓
Response contract (MessageContract | UIFormContract)
    ↓
AGUIForm.jsx  (public/elements/) — renders dynamic form in browser

Conversations are persisted per thread_id using LangGraph's in-memory checkpointer. Each turn the graph decides whether to send a plain message or a structured form.

Project Structure

pitching/
├── backend/
│   ├── server.py                   # FastAPI server (REST endpoints)
│   └── agents/
│       ├── graph.py                # LLM setup, run_graph() entry point
│       ├── state.py                # Placeholder for now
│       ├── nodes/
│       │   ├── planner_node.py     # Placeholder for now
│       │   ├── reviewer_node.py    # Placeholder for now
│       │   └── ui_node.py          # Placeholder for now
│       └── schemas/
│           ├── enums.py            # GraphResponseType, FieldType, TextSubType
│           ├── base_schema.py      # Shared Pydantic base with strict validation
│           ├── graph_input_schema.py
│           ├── graph_output_schema.py
│           ├── state_schema.py
│           ├── planner_schema.py
│           ├── reviewer_schema.py
│           ├── ui_contract.py      # UIFormContract response type
│           ├── ui_schema.py        # UIField definition
│           ├── ui_llm_schema.py    # Structured LLM output schema
│           └── graph_base_contract.py
├── ui/
│   └── app/
│       ├── main.py                 # Chainlit entry point + drive_conversation()
│       ├── agent_handler.py        # LangGraph interface layer
│       ├── handlers.py             # Chainlit event handlers
│       ├── starters.py             # Quick-start conversation buttons
│       ├── constants.py            # TIMEOUT
│       └── logger.py               # structlog setup
├── public/
│   └── elements/
│       └── AGUIForm.jsx            # Dynamic React form component (shadcn UI)
├── .chainlit/
│   └── config.toml                 # Chainlit framework configuration
├── pyproject.toml
├── Makefile
├── .env.example
└── README.md

Features

  • Starter buttons — one-click launchers for Gold Loan, Current Account, Savings Account journeys
  • Dynamic forms — backend drives the UI; supports text, select, date, file_upload, confirmation, OTP, and summary field types
  • Real-time validation — email regex, 10-digit phone, 6-digit OTP, currency input with selector
  • Form timeout — 4-minute countdown timer; auto-submits as chat fallback at zero
  • "Reply in Chat" fallback — users can bypass any form and respond in free text
  • Structured logging — JSON or console output, configurable per environment
  • Thread persistence — conversation state maintained per thread_id across turns

Setup

1. Create virtual environment

uv venv && source .venv/bin/activate

2. Install dependencies

uv sync

3. Install package (editable)

pip install -e .

4. Configure environment

cp .env.example .env

Edit .env and fill in your credentials.

Running the Application

pip install -e .
chainlit run -h ui/app/main.py
chainlit run -w -h app.py

The application will start at http://localhost:8000

About

An AI-powered agent application using LangGraph and Chainlit for conversation-based journeys with an intelligent and dynamic interface.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors