[PR #513] [MERGED] Add a llamactl init functionality #514

Closed
opened 2026-02-16 02:15:25 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/run-llama/llama_deploy/pull/513
Author: @logan-markewich
Created: 5/26/2025
Status: Merged
Merged: 5/27/2025
Merged by: @logan-markewich

Base: mainHead: logan/llamactl_init


📝 Commits (10+)

📊 Changes

28 files changed (+7957 additions, -26 deletions)

View changed files

📝 llama_deploy/apiserver/deployment_config_parser.py (+36 -9)
📝 llama_deploy/cli/__init__.py (+2 -0)
llama_deploy/cli/init.py (+491 -0)
📝 llama_deploy/control_plane/config.py (+4 -1)
📝 llama_deploy/message_queues/apache_kafka.py (+1 -1)
📝 llama_deploy/message_queues/aws.py (+3 -3)
📝 llama_deploy/message_queues/rabbitmq.py (+1 -1)
📝 llama_deploy/message_queues/redis.py (+1 -1)
📝 llama_deploy/message_queues/simple/config.py (+8 -4)
📝 llama_deploy/message_queues/solace.py (+1 -1)
templates/basic/src/__init__.py (+0 -0)
templates/basic/src/workflow.py (+28 -0)
templates/basic/ui/.gitignore (+41 -0)
templates/basic/ui/app/favicon.ico (+0 -0)
templates/basic/ui/app/globals.css (+26 -0)
templates/basic/ui/app/layout.tsx (+32 -0)
templates/basic/ui/app/page.tsx (+261 -0)
templates/basic/ui/eslint.config.mjs (+16 -0)
templates/basic/ui/next.config.ts (+10 -0)
templates/basic/ui/package-lock.json (+6731 -0)

...and 8 more files

📄 Description

Allows a user to quickly bootstrap a deployment with/without UI.

Since all our config is pydantic objects, we can take advantage of that to make the generated deployment.yml file self-documenting (this got a little more complicated than I expected, but I feel its worth it)

Example CLI Usage

(llama-deploy) loganmarkewich@Mac llama_deploy % uv run llamactl init
Project name [llama-deploy-app]: 
Destination directory [.]: 
Control plane port [8000]: 
Select message queue type
 (aws, kafka, rabbitmq, redis, simple, solace) [simple]: 

Workflow template:
  basic     - Basic workflow with OpenAI integration (recommended)
  none      - Do not create any sample workflow code (you just want a deployment.yml)

Select workflow template (basic, none) [basic]: 

Would you like to bundle a sample next.js UI with your deployment? [Y/n]: 
Created project directory: llama-deploy-app
Created deployment config: llama-deploy-app/deployment.yml
Cloning template files from repository...
Cloning into '/var/folders/lw/xwsz_3yj4ln1gvkxhyddbvvw0000gn/T/tmpeecy06f0'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (124/124), done.
remote: Compressing objects: 100% (110/110), done.
remote: Total 124 (delta 2), reused 85 (delta 1), pack-reused 0 (from 0)
Receiving objects: 100% (124/124), 18.72 KiB | 1.56 MiB/s, done.
Resolving deltas: 100% (2/2), done.
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 0), reused 7 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (10/10), 608.52 KiB | 3.50 MiB/s, done.
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 14 (delta 0), reused 10 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (14/14), 66.46 KiB | 1.30 MiB/s, done.
Template files copied successfully to llama-deploy-app

Project llama-deploy-app created successfully!
Next steps:
  1. cd llama-deploy-app
  2. Edit the deployment.yml file to add your OpenAI API key
  3. Start the API server:
     python -m llama_deploy.apiserver
     (or with Docker: docker run -p 4501:4501 -v .:/opt/app -w /opt/app llamaindex/llama-deploy)
  4. In another terminal, deploy your workflow:
     llamactl deploy deployment.yml
  5. Test your workflow:
     llamactl run --deployment llama-deploy-app --arg message 'Hello!'

To use the UI component:
  • Open your browser to: http://localhost:4501/ui/llama-deploy-app/
  • The UI will be served automatically by the API server

Example output app (added some styles)
image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/run-llama/llama_deploy/pull/513 **Author:** [@logan-markewich](https://github.com/logan-markewich) **Created:** 5/26/2025 **Status:** ✅ Merged **Merged:** 5/27/2025 **Merged by:** [@logan-markewich](https://github.com/logan-markewich) **Base:** `main` ← **Head:** `logan/llamactl_init` --- ### 📝 Commits (10+) - [`c253313`](https://github.com/run-llama/llama_deploy/commit/c253313e38e4d6207b69b08c1a297474e6dd5976) wip - [`a71e956`](https://github.com/run-llama/llama_deploy/commit/a71e9567ac25cf89cfb50c13d5d54d516da80e5b) add basic template - [`12f5812`](https://github.com/run-llama/llama_deploy/commit/12f58122315dfae84d5702f8cbbb348b0f68aa7a) update template naming - [`b89c43d`](https://github.com/run-llama/llama_deploy/commit/b89c43d8391f675631bab1a1b4635a8ced7dd96b) update basic template - [`bec2426`](https://github.com/run-llama/llama_deploy/commit/bec2426a89b7d64b1c4b422e67797aa62e173629) clean up basic template - [`73dd20a`](https://github.com/run-llama/llama_deploy/commit/73dd20aa73879de0c8085b8e72bffa64517ae864) make style better - [`3b02347`](https://github.com/run-llama/llama_deploy/commit/3b02347d677b962fc2f30f08aa4fb51947c24af1) remove lock - [`cbefd67`](https://github.com/run-llama/llama_deploy/commit/cbefd67d99c07ab83bac9c4e1e713b2ce3357d36) add openai to basic demo - [`2416f59`](https://github.com/run-llama/llama_deploy/commit/2416f599381bf71d3e06b18b65a95edf02c77386) final nit - [`352256f`](https://github.com/run-llama/llama_deploy/commit/352256f5a9f94f34794e8fe9ffd1a4f91afbb942) remove chat template for now ### 📊 Changes **28 files changed** (+7957 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `llama_deploy/apiserver/deployment_config_parser.py` (+36 -9) 📝 `llama_deploy/cli/__init__.py` (+2 -0) ➕ `llama_deploy/cli/init.py` (+491 -0) 📝 `llama_deploy/control_plane/config.py` (+4 -1) 📝 `llama_deploy/message_queues/apache_kafka.py` (+1 -1) 📝 `llama_deploy/message_queues/aws.py` (+3 -3) 📝 `llama_deploy/message_queues/rabbitmq.py` (+1 -1) 📝 `llama_deploy/message_queues/redis.py` (+1 -1) 📝 `llama_deploy/message_queues/simple/config.py` (+8 -4) 📝 `llama_deploy/message_queues/solace.py` (+1 -1) ➕ `templates/basic/src/__init__.py` (+0 -0) ➕ `templates/basic/src/workflow.py` (+28 -0) ➕ `templates/basic/ui/.gitignore` (+41 -0) ➕ `templates/basic/ui/app/favicon.ico` (+0 -0) ➕ `templates/basic/ui/app/globals.css` (+26 -0) ➕ `templates/basic/ui/app/layout.tsx` (+32 -0) ➕ `templates/basic/ui/app/page.tsx` (+261 -0) ➕ `templates/basic/ui/eslint.config.mjs` (+16 -0) ➕ `templates/basic/ui/next.config.ts` (+10 -0) ➕ `templates/basic/ui/package-lock.json` (+6731 -0) _...and 8 more files_ </details> ### 📄 Description Allows a user to quickly bootstrap a deployment with/without UI. Since all our config is pydantic objects, we can take advantage of that to make the generated `deployment.yml` file self-documenting (this got a little more complicated than I expected, but I feel its worth it) Example CLI Usage ```bash (llama-deploy) loganmarkewich@Mac llama_deploy % uv run llamactl init Project name [llama-deploy-app]: Destination directory [.]: Control plane port [8000]: Select message queue type (aws, kafka, rabbitmq, redis, simple, solace) [simple]: Workflow template: basic - Basic workflow with OpenAI integration (recommended) none - Do not create any sample workflow code (you just want a deployment.yml) Select workflow template (basic, none) [basic]: Would you like to bundle a sample next.js UI with your deployment? [Y/n]: Created project directory: llama-deploy-app Created deployment config: llama-deploy-app/deployment.yml Cloning template files from repository... Cloning into '/var/folders/lw/xwsz_3yj4ln1gvkxhyddbvvw0000gn/T/tmpeecy06f0'... remote: Enumerating objects: 124, done. remote: Counting objects: 100% (124/124), done. remote: Compressing objects: 100% (110/110), done. remote: Total 124 (delta 2), reused 85 (delta 1), pack-reused 0 (from 0) Receiving objects: 100% (124/124), 18.72 KiB | 1.56 MiB/s, done. Resolving deltas: 100% (2/2), done. remote: Enumerating objects: 10, done. remote: Counting objects: 100% (10/10), done. remote: Compressing objects: 100% (9/9), done. remote: Total 10 (delta 0), reused 7 (delta 0), pack-reused 0 (from 0) Receiving objects: 100% (10/10), 608.52 KiB | 3.50 MiB/s, done. remote: Enumerating objects: 14, done. remote: Counting objects: 100% (14/14), done. remote: Compressing objects: 100% (14/14), done. remote: Total 14 (delta 0), reused 10 (delta 0), pack-reused 0 (from 0) Receiving objects: 100% (14/14), 66.46 KiB | 1.30 MiB/s, done. Template files copied successfully to llama-deploy-app Project llama-deploy-app created successfully! Next steps: 1. cd llama-deploy-app 2. Edit the deployment.yml file to add your OpenAI API key 3. Start the API server: python -m llama_deploy.apiserver (or with Docker: docker run -p 4501:4501 -v .:/opt/app -w /opt/app llamaindex/llama-deploy) 4. In another terminal, deploy your workflow: llamactl deploy deployment.yml 5. Test your workflow: llamactl run --deployment llama-deploy-app --arg message 'Hello!' To use the UI component: • Open your browser to: http://localhost:4501/ui/llama-deploy-app/ • The UI will be served automatically by the API server ``` Example output app (added some styles) <img width="965" alt="image" src="https://github.com/user-attachments/assets/01d3c1d7-2e07-4c56-b592-621f0438e306" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 02:15:25 -05:00
yindo closed this issue 2026-02-16 02:15:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_deploy#514