Skip to content

Conversation

@Hrithik-Gavankar
Copy link
Collaborator

Migrated NGUI E2E server to Lightrail/LlamaStack with modular architecture.

Issues Resolved
✅ NGUI-442 - Fixed empty data_path and data arrays for nested/complex structures
✅ NGUI-433 - Added ability to mock backend data via REST API

Key Changes:

  1. Lightrail Compatibility
  • Migrated from LangGraph to LlamaStack
  • Updated to next-gen-ui-agent & next-gen-ui-llama-stack v0.3.0+ (fixes empty data bug)
  • Added Lightrail deployment configuration
  1. Modular Architecture

app/
├── agents/ # NGUI agent setup
├── data_sources/ # Inline, default, filtering
├── routes/ # API endpoints
├── utils/ # Validation, logging, responses
└── config.py # Configuration

  1. New Features
  • Default data fallback - Uses movies_data.json when no data provided
  • Smart filtering agent - Intelligently filters data based on prompts
  • Enhanced error handling - Standardized error codes with suggestions

Testing:

Local deployment

lightrail-local-cli build && lightrail-local-cli start

Test with default data

curl -X POST http://localhost:8080/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Show me some movies"}'

# Test with custom data (mock)
curl -X POST http://localhost:8080/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Show products", "data": [{"name":"Laptop","price":999}]}'

Copy link
Collaborator

@velias velias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like this modularization of the app, hope it somehow corresponds to the @jschuler proposal from his debug view PR.
I added few proposals and questions.

@jschuler
Copy link
Collaborator

Hi @Hrithik-Gavankar, this branch is a bit out of date and needs a merge from main branch. Also, I didn't debug too much but I think it breaks the current way of running the test server locally, which is:

  • have a tests/ngui-e2e/server/.env file with contents from models.corp, example:
# gemini
# https://gitlab.cee.redhat.com/models-corp/user-documentation/-/blob/main/models/gemini.md
LLM_MODEL=gemini-2.0-flash
LLM_BASE_URL=https://gemini--apicast-production.apps.int.stc.ai.prod.us-east-1.aws.paas.redhat.com:443/v1beta/openai
LLM_API_KEY=<KEY HERE>
  • start tests/ngui-e2e/client
npm run dev
  • start tests/ngui-e2e/server
./start_server.sh

can you try and run this as baseline, to ensure it works and also after you add lightrail support?

I would also suggest to make minimal lightrail changes first by:

  1. Create tests/ngui-e2e/server/.light folder and files
  2. Update config tests/ngui-e2e/server/config.py to load from either set of variables
  3. Update BUILD file tests/ngui-e2e/server/BUILD

Once we have this minimally added we can create followup PR with other improvements? WDYT

@velias
Copy link
Collaborator

velias commented Jan 16, 2026

Why are the same files and folder structures directly in the /server folder, but also in the /server/app subfolder? This seems suspicious to me 😉

@Hrithik-Gavankar
Copy link
Collaborator Author

Why are the same files and folder structures directly in the /server folder, but also in the /server/app subfolder? This seems suspicious to me 😉

Thanks @velias for noticing this 👍, Those root-level modules were leftover from the migration and aren't used - the application only imports from app/ to align with Lightrail's structure. Removed the dead code in the latest commit.

@Hrithik-Gavankar Hrithik-Gavankar marked this pull request as draft January 19, 2026 12:59
- Refactor server to use LlamaStack integration
- Add modular app/ structure with agents, routes, utils
- Add Lightrail deployment configuration (.light folder)
- Update config to use NGUI_MODEL and LLAMA_STACK_BASE_URL
- Remove deprecated LangChain implementation
- Add intelligent data filtering with generic_data_filter_agent
- Update BUILD files for pants compatibility
- Fix generate.py to use correct config variable names
@Hrithik-Gavankar Hrithik-Gavankar marked this pull request as ready for review January 19, 2026 14:05
Copy link
Collaborator

@velias velias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good now

@Hrithik-Gavankar Hrithik-Gavankar merged commit 482fce5 into main Jan 20, 2026
12 checks passed
@Hrithik-Gavankar Hrithik-Gavankar deleted the NGUI-474-modular-arch branch January 20, 2026 12:32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have liked to keep this. makes it easy to start the server locally

}


@router.get("/model-info")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a useful endpoint for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants