Build an AI Project Planner with Groq
Build a chat app that turns project descriptions into structured WBS plans.
Introduction
30 Second Summary
Every project starts with the same challenge. Someone asks "how long will this take?" and you need to break down a vague idea into phases, tasks, timelines, and risks.
In this project, you will build a browser-based AI chat app that transforms plain-English project descriptions into structured project plans with tasks, dependencies, durations, and risk assessments.
What You'll Build
A Python web application that pairs a PM-expert system prompt with Groq's free LLM API to generate a Work Breakdown Structure through a conversational chat interface.
By the end of this project, you'll have:
- A working Streamlit chat app running locally in your browser that accepts project descriptions and returns structured plans.
- A custom system prompt that encodes PMP best practices for WBS generation, risk assessment, and dependency mapping.
- A conversational AI integration using Groq's free API that maintains context so you can iteratively refine project plans through follow-up messages.
- Secret Mission: Add a JSON export feature that converts plans into machine-readable format for downstream tool integration.
Are there any prerequisites?
None. This guide walks you through every step from scratch. You do not need a credit card to use the Groq API.
Set Up Your Project Environment
Before you can build the AI project planner, you need a clean workspace with the right tools installed.
In this step, you'll create a project folder, install the Python packages that power your app, and grab a free API key from Groq so your app can talk to a large language model.
In this step, get ready to:
- Create a project folder and Python virtual environment.
- Install the Groq SDK and Streamlit framework.
- Create a free Groq account and generate an API key.
Create a project folder and virtual environment
A virtual environment keeps your project's packages isolated from the rest of your system. This prevents version conflicts between projects.
- Open a terminal in VS Code by pressing Ctrl+` (macOS) or Ctrl+` (Windows).
- Move to your Desktop by running this command:
cd ~/Desktop
- Create your project folder and move into it by running these commands:
mkdir ai-project-planner
cd ai-project-planner
- Create a Python virtual environment by running:
python -m venv venv
What does this command do?
python -m venv venv tells Python to create a virtual environment in a folder called venv. This folder holds a private copy of the Python interpreter and any packages you install.
- Activate the virtual environment by running:
macOS
source venv/bin/activate
Windows
venv\Scripts\activate
You should see (venv) appear at the beginning of your terminal prompt. This confirms the virtual environment is active.
Don't see (venv) in your prompt?
On Windows, if you see an error about execution policies, run Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned first, then try the activation command again.
Make sure you're in the ai-project-planner folder. Run ls (macOS) or dir (Windows) and confirm you see a venv folder listed.
Help me activate my Python virtual environment
Install the required packages
Your app needs two packages: the Groq SDK to communicate with the AI model, and Streamlit to build the chat interface in your browser.
- Install both packages by running:
pip install groq==1.5.0 streamlit==1.58.0
Why pin specific versions?
The ==1.5.0 and ==1.58.0 pins ensure you install the exact versions this project was tested with. This prevents breaking changes from newer releases causing unexpected errors.
- Confirm both packages installed correctly by running:
python -c "import groq; import streamlit; print('Setup complete')"
You should see Setup complete printed with no errors.
Seeing a ModuleNotFoundError?
Check that (venv) still appears in your prompt. If it disappeared, re-activate the virtual environment and run the install command again.
If you see a network error, check your internet connection and retry the pip install command.
Help me fix my package installation
Create a free Groq account and get your API key
Groq provides free access to powerful AI models with no credit card required. You need an API key so your app can send requests to their servers.
- Open console.groq.com in your browser.
- Sign up for a free account using your email or a social login.
- Once signed in, navigate to the API Keys page at console.groq.com/keys.
- Click Create API Key.
- Give your key a name (e.g. project-planner) and click Submit.
- Copy the displayed API key and save it somewhere safe (like a text file or password manager). You will not be able to see the full key again after closing this dialog.
Why not set this as an environment variable?
Many tutorials have you export your API key as an environment variable. In this project, you'll paste the key directly into a password-masked input field in the app's sidebar instead. This avoids the complexity of configuring environment variables across different operating systems.
No credit card needed
Groq's free plan gives you access to all of their models. You are never charged on the Free Plan. If you exceed the rate limits, the API returns a 429 status code instead of billing you.
Your environment is ready. Next up, you'll build the AI integration and write the system prompt that turns a general-purpose language model into a project planning expert.
Build the AI Integration with a PM-Expert System Prompt
In Step 1, you set up your environment with Python, the Groq SDK, and Streamlit. Now it's time to build the core intelligence of your app.
The real power of an AI-augmented tool comes from the instructions you give the model. In this step, you'll create the app.py file and write a detailed system prompt that encodes PMBOK-aligned project planning logic. This prompt transforms a general-purpose LLM into a specialized PM assistant.
In this step, get ready to:
- Create app.py with the Streamlit page configuration.
- Write a PM-expert system prompt encoding WBS generation instructions.
- Test the Groq API connection to verify your setup.
Create app.py and set up the Streamlit page
Every Streamlit app starts with a page configuration call that sets the browser tab title, icon, and layout. This must be the very first Streamlit command in your file.
- Create a new file called app.py in your project folder by running this command:
type nul > app.py
- Open app.py in VS Code by clicking on it in the Explorer sidebar.
- Add the following imports and page configuration to app.py:
import streamlit as st
from groq import Groq
# Configure the browser tab title, icon, and wide layout
st.set_page_config(page_title="AI Project Planner", page_icon="\ud83d\udccb", layout="wide")
# Display the app header
st.title("AI Project Planner")
st.caption("Describe your project and get a structured WBS with risks, dependencies, and timeline estimates.")
What does this code do?
- import streamlit as st brings in the Streamlit framework for building the web interface.
- from groq import Groq imports the Groq client you'll use to call the AI model.
- st.set_page_config(...) sets the browser tab title to "AI Project Planner" and enables wide layout so your project plans have room to breathe.
- st.title() and st.caption() render the main heading and a brief description at the top of the app.
- Save app.py.
Seeing a red error about set_page_config?
st.set_page_config must be the first Streamlit command in your file. Make sure no other st. calls appear above it (the import lines are fine since they are not Streamlit commands).
help me fix a set_page_config error in my Streamlit app
Write the PM-expert system prompt
A system prompt is the hidden instruction set that shapes how the AI responds. Your system prompt encodes PMP best practices so the AI produces properly structured Work Breakdown Structures instead of generic text.
- Add the following SYSTEM_PROMPT constant below the st.caption() line in app.py:
SYSTEM_PROMPT = """You are an expert Project Management Professional (PMP) assistant specializing in project planning and Work Breakdown Structure (WBS) creation.
When a user describes a project, generate a comprehensive project plan with the following structure:
## 1. PROJECT OVERVIEW
- Project title
- Objective statement
- Key assumptions and constraints
## 2. WORK BREAKDOWN STRUCTURE
Organize hierarchically: Phases > Deliverables > Work Packages > Tasks
For each task include:
- Task ID (e.g., 1.1.1)
- Task name
- Estimated duration (hours or days)
- Dependencies (predecessor task IDs, or "None")
- Priority (High/Medium/Low)
## 3. RISK ASSESSMENT
Identify 3-5 key risks. For each risk provide:
- Description
- Probability (High/Medium/Low)
- Impact (High/Medium/Low)
- Mitigation strategy
## 4. TIMELINE SUMMARY
- Estimated total project duration
- Critical path (list the task IDs on the critical path)
- Key milestones with target dates (relative, e.g., "Week 2")
Guidelines:
- Use industry-standard PM terminology aligned with PMBOK
- Keep tasks actionable and measurable (start with verbs)
- Ensure dependencies are logical and avoid circular references
- Flag tasks on the critical path with [CP] marker
- Estimate durations conservatively with buffer for unknowns
- If the project description is vague or missing key details, ask 2-3 clarifying questions before generating the full plan
When refining an existing plan based on user feedback, maintain the overall structure and only modify the sections the user requests changes to. Preserve task IDs for traceability."""
What does this system prompt do?
This prompt turns a general-purpose language model into a specialized PM assistant. It defines four output sections (overview, WBS, risks, timeline) and sets strict formatting rules for each.
The guidelines at the bottom handle edge cases. If a project description is vague, the AI asks clarifying questions first instead of guessing. When the user requests changes, the AI preserves task IDs so earlier references stay valid.
Why encode PM knowledge in the prompt?
Without this prompt, the AI would return free-form text that varies wildly between requests. By specifying the exact structure, terminology, and rules, you guarantee every output follows the same professional standard. This is how real AI-augmented PM tools work: domain experts shape the AI's output through carefully engineered prompts.
- Save app.py.
Seeing a syntax error about quotes?
The SYSTEM_PROMPT uses triple quotes (""") to wrap the multi-line string. Make sure you have exactly three double-quote characters at both the opening and closing of the string.
help me fix a triple-quote syntax error in my Python system prompt
Test the Groq API connection
Before building the full chat interface, verify that your API key works and the llama-3.3-70b-versatile model responds correctly.
- Run this quick test in your terminal to confirm the Groq API is working:
python -c "from groq import Groq; client = Groq(api_key='your-api-key-here'); r = client.chat.completions.create(model='llama-3.3-70b-versatile', messages=[{'role': 'user', 'content': 'Say hello in one sentence'}]); print(r.choices[0].message.content)"
- Replace your-api-key-here with the actual API key you saved from the Groq console in Step 1.
- Press Enter to run the command.
You should see a short greeting printed in the terminal. This confirms your API key is valid and the model is responding.
Seeing an authentication error?
Double-check that you copied the full API key from console.groq.com without any extra spaces. The key should start with gsk_.
If you see a rate limit error (429), wait 60 seconds and try again. The free tier allows 30 requests per minute.
help me fix a Groq API authentication or rate limit error
✔️ Awesome, I've got everything!
Great. Make sure you've saved app.py with both the imports and the SYSTEM_PROMPT constant.
ⓧ I'd like to double check the full code
Here is the complete app.py at the end of this step:
import streamlit as st
from groq import Groq
st.set_page_config(page_title="AI Project Planner", page_icon="\ud83d\udccb", layout="wide")
st.title("AI Project Planner")
st.caption("Describe your project and get a structured WBS with risks, dependencies, and timeline estimates.")
SYSTEM_PROMPT = """You are an expert Project Management Professional (PMP) assistant specializing in project planning and Work Breakdown Structure (WBS) creation.
When a user describes a project, generate a comprehensive project plan with the following structure:
## 1. PROJECT OVERVIEW
- Project title
- Objective statement
- Key assumptions and constraints
## 2. WORK BREAKDOWN STRUCTURE
Organize hierarchically: Phases > Deliverables > Work Packages > Tasks
For each task include:
- Task ID (e.g., 1.1.1)
- Task name
- Estimated duration (hours or days)
- Dependencies (predecessor task IDs, or "None")
- Priority (High/Medium/Low)
## 3. RISK ASSESSMENT
Identify 3-5 key risks. For each risk provide:
- Description
- Probability (High/Medium/Low)
- Impact (High/Medium/Low)
- Mitigation strategy
## 4. TIMELINE SUMMARY
- Estimated total project duration
- Critical path (list the task IDs on the critical path)
- Key milestones with target dates (relative, e.g., "Week 2")
Guidelines:
- Use industry-standard PM terminology aligned with PMBOK
- Keep tasks actionable and measurable (start with verbs)
- Ensure dependencies are logical and avoid circular references
- Flag tasks on the critical path with [CP] marker
- Estimate durations conservatively with buffer for unknowns
- If the project description is vague or missing key details, ask 2-3 clarifying questions before generating the full plan
When refining an existing plan based on user feedback, maintain the overall structure and only modify the sections the user requests changes to. Preserve task IDs for traceability."""
Your app file is ready with the core intelligence baked in. Next up, you'll build the Streamlit chat interface that lets users interact with this PM-expert AI through a conversational UI.
Create the Streamlit Chat Interface
You have an AI-powered system prompt ready to generate structured project plans. Now you need a way for users to actually interact with it.
In this step, you will build the front-end of your app using Streamlit's built-in chat components. You will create a sidebar for configuration, and set up session state to track conversation history.
In this step, get ready to:
- Build a sidebar with an API key input and usage instructions.
- Initialize session state to store conversation history.
- Display chat messages using Streamlit's chat message containers.
Set up the Streamlit page configuration and sidebar
Your app needs a place for users to enter their Groq API key without exposing it on screen. A sidebar keeps configuration out of the main chat area.
- In app.py, find the closing triple-quote of the SYSTEM_PROMPT variable. Add the following code below it to create the sidebar:
with st.sidebar:
st.header("Configuration")
# Password-masked input so the key isn't visible on screen
api_key = st.text_input(
"Groq API Key",
type="password",
help="Get a free key at console.groq.com",
)
# Direct link to the API keys page
st.markdown("[Get a free Groq API key](https://console.groq.com/keys)")
st.divider()
# Usage instructions for the learner
st.markdown("### How to use")
st.markdown(
"1. Enter your Groq API key above\n"
"2. Describe your project in the chat\n"
"3. Review the generated WBS\n"
"4. Refine by asking follow-up questions"
)
What does this code do?
The with st.sidebar: block places all its contents into a collapsible sidebar panel on the left side of the page.
The st.text_input with type="password" masks the API key input so characters appear as dots. The help parameter adds a tooltip when the user hovers over the input field.
Why a sidebar input instead of an environment variable?
Environment variables require extra terminal commands that differ between operating systems. A sidebar input keeps everything in one place and lets you paste the key directly in the browser.
Since this app runs locally, the password-masked input is secure enough for development.
- Save app.py.
Seeing an indentation error?
Make sure all lines inside the with st.sidebar: block are indented by exactly four spaces. Python is strict about consistent indentation.
help me fix an indentation error in my Streamlit sidebar code
Build the chat message display
Streamlit reruns your entire script from top to bottom on every user interaction. To keep messages visible across reruns, you need to store them in session state and re-render them each time.
- Below the sidebar block you just added, add the following code to initialize session state and display messages:
# Initialize message history on first run
if "messages" not in st.session_state:
st.session_state.messages = []
# Re-render all previous messages on each rerun
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
What does this code do?
- The if "messages" not in st.session_state check creates an empty list only on the very first page load. On subsequent reruns, it preserves whatever messages already exist.
- The for loop iterates through saved messages and renders each one inside a st.chat_message() container. The role key determines whether the bubble appears as a user message or an assistant message.
What is session state?
Session state is Streamlit's way of persisting data between script reruns. Without it, every variable resets to its initial value each time the user interacts with the page.
Each message is stored as a dictionary with two keys: role (either "user" or "assistant") and content (the message text).
- Save app.py.
App won't start or shows a blank page?
Make sure the session state code is outside the with st.sidebar: block. It should be at the top level of your script, not indented under the sidebar.
help me debug why my Streamlit session state code isn't working
Add the chat input handler
Streamlit provides st.chat_input() which renders a text input pinned to the bottom of the page. When the user types a message and presses Enter, the function returns their text.
In the next step, you will wire this input to the Groq API so that submitted messages trigger AI responses. For now, your session state and message display are ready to receive them.
- Test your app so far by running this command in your terminal:
streamlit run app.py
What should I see?
Your default browser opens a new tab with the AI Project Planner title and caption. On the left, you should see the sidebar with a masked API key input field, a link to get a free Groq key, and numbered usage instructions.
The main area shows your title and caption. The chat message area is empty because no messages have been sent yet.
Browser didn't open automatically?
Check your terminal output for a URL (usually http://localhost:8501). Copy and paste it into your browser manually.
If you see an import error, make sure your virtual environment is still activated. You should see (venv) at the start of your terminal prompt.
help me troubleshoot why streamlit run app.py isn't working
✔️ Awesome, I've got everything!
Great. Double check you have saved app.py and keep the Streamlit server running in your terminal.
ⓧ I'd like to double check the full code
Here is the complete app.py so far:
import streamlit as st
from groq import Groq
st.set_page_config(page_title="AI Project Planner", page_icon="\U0001f4cb", layout="wide")
st.title("AI Project Planner")
st.caption("Describe your project and get a structured WBS with risks, dependencies, and timeline estimates.")
SYSTEM_PROMPT = """You are an expert Project Management Professional (PMP) assistant specializing in project planning and Work Breakdown Structure (WBS) creation.
When a user describes a project, generate a comprehensive project plan with the following structure:
## 1. PROJECT OVERVIEW
- Project title
- Objective statement
- Key assumptions and constraints
## 2. WORK BREAKDOWN STRUCTURE
Organize hierarchically: Phases > Deliverables > Work Packages > Tasks
For each task include:
- Task ID (e.g., 1.1.1)
- Task name
- Estimated duration (hours or days)
- Dependencies (predecessor task IDs, or "None")
- Priority (High/Medium/Low)
## 3. RISK ASSESSMENT
Identify 3-5 key risks. For each risk provide:
- Description
- Probability (High/Medium/Low)
- Impact (High/Medium/Low)
- Mitigation strategy
## 4. TIMELINE SUMMARY
- Estimated total project duration
- Critical path (list the task IDs on the critical path)
- Key milestones with target dates (relative, e.g., "Week 2")
Guidelines:
- Use industry-standard PM terminology aligned with PMBOK
- Keep tasks actionable and measurable (start with verbs)
- Ensure dependencies are logical and avoid circular references
- Flag tasks on the critical path with [CP] marker
- Estimate durations conservatively with buffer for unknowns
- If the project description is vague or missing key details, ask 2-3 clarifying questions before generating the full plan
When refining an existing plan based on user feedback, maintain the overall structure and only modify the sections the user requests changes to. Preserve task IDs for traceability."""
with st.sidebar:
st.header("Configuration")
api_key = st.text_input(
"Groq API Key",
type="password",
help="Get a free key at console.groq.com",
)
st.markdown("[Get a free Groq API key](https://console.groq.com/keys)")
st.divider()
st.markdown("### How to use")
st.markdown(
"1. Enter your Groq API key above\n"
"2. Describe your project in the chat\n"
"3. Review the generated WBS\n"
"4. Refine by asking follow-up questions"
)
if "messages" not in st.session_state:
st.session_state.messages = []
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
Your interface is ready. Next up, you will connect the chat input to the Groq API so the AI can respond with structured project plans.
Connect Everything and Test Your Planner
In the previous step, you built the chat interface with a sidebar, message display loop, and input widget. The app looks great, but typing a message does nothing yet.
Now you will wire up the brains. When a user submits a message, your app needs to capture it, send the full conversation history to Groq's API, and display the structured project plan that comes back.
In this step, get ready to:
- Wire user input to the Groq API so messages produce structured project plans.
- Test the planner with a real project description and verify the WBS output.
- Refine a plan through follow-up messages to confirm conversational context is maintained.
Handle user input and validate the API key
The chat input widget captures text, but the app needs logic to process it. Before calling the API, you need to check that the user actually provided their API key in the sidebar.
- In app.py, find the last line of your file (the for message in st.session_state.messages: loop). Add the following code below the loop, at the bottom of the file:
if prompt := st.chat_input("Describe your project scope..."):
# Stop early if no API key is provided
if not api_key:
st.error("Please enter your Groq API key in the sidebar to get started.")
st.stop()
# Store the user's message and display it in the chat
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
What does this code do?
The walrus operator (:=) assigns the user's input to prompt and enters the if block only when input is not empty.
If the user forgot to enter their API key, st.stop() halts the script immediately and shows an error message. Otherwise, the message gets appended to session state and rendered in a chat bubble.
You will not see a visible change yet. The next chunk adds the API call that generates the AI response.
Call the Groq API and display the response
With the user's message stored, you now need to build the full message array (system prompt plus conversation history), send it to Groq, and render the assistant's reply.
- Directly below the code you just added (still inside the if prompt block), add the following:
# Build the messages array with system prompt first
messages_for_api = [{"role": "system", "content": SYSTEM_PROMPT}]
for msg in st.session_state.messages:
messages_for_api.append({"role": msg["role"], "content": msg["content"]})
# Call Groq and display the response in a chat bubble
with st.chat_message("assistant"):
with st.spinner("Generating project plan..."):
client = Groq(api_key=api_key)
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=messages_for_api,
temperature=0.7,
max_tokens=4096,
)
assistant_message = response.choices[0].message.content
st.markdown(assistant_message)
# Save the assistant's response to session state for future context
st.session_state.messages.append(
{"role": "assistant", "content": assistant_message}
)
What does this code do?
- messages_for_api starts with your SYSTEM_PROMPT so the AI always has its PMP instructions. Then it appends every previous message so the AI can see the full conversation.
- st.spinner("Generating project plan...") shows a loading indicator while the API call runs.
- temperature=0.7 balances creativity and consistency. max_tokens=4096 gives the model room for detailed plans.
- The assistant's response is appended to st.session_state.messages so it persists across reruns and is included in future API calls as context.
- Save app.py.
- If your Streamlit app is still running, it will detect the file change and prompt you to rerun. Click Always rerun in the top-right corner to enable automatic updates on every save.
Seeing an error about indentation?
- The entire block you just added must be indented one level inside the if prompt statement. Make sure every line uses consistent spaces (4 spaces per level).
- Check that the messages_for_api line and the with st.chat_message("assistant"): line are at the same indentation level as st.session_state.messages.append from the previous chunk.
- Help me fix an indentation error in my Streamlit chat app.
✔️ Awesome, I've got everything!
Great. Make sure you have saved app.py before moving on to the testing substeps below.
ⓧ I'd like to double check the full code
Here is the complete app.py file. Compare yours against it to spot any differences.
import streamlit as st
from groq import Groq
st.set_page_config(page_title="AI Project Planner", page_icon="📋", layout="wide")
st.title("AI Project Planner")
st.caption("Describe your project and get a structured WBS with risks, dependencies, and timeline estimates.")
SYSTEM_PROMPT = """You are an expert Project Management Professional (PMP) assistant specializing in project planning and Work Breakdown Structure (WBS) creation.
When a user describes a project, generate a comprehensive project plan with the following structure:
## 1. PROJECT OVERVIEW
- Project title
- Objective statement
- Key assumptions and constraints
## 2. WORK BREAKDOWN STRUCTURE
Organize hierarchically: Phases > Deliverables > Work Packages > Tasks
For each task include:
- Task ID (e.g., 1.1.1)
- Task name
- Estimated duration (hours or days)
- Dependencies (predecessor task IDs, or "None")
- Priority (High/Medium/Low)
## 3. RISK ASSESSMENT
Identify 3-5 key risks. For each risk provide:
- Description
- Probability (High/Medium/Low)
- Impact (High/Medium/Low)
- Mitigation strategy
## 4. TIMELINE SUMMARY
- Estimated total project duration
- Critical path (list the task IDs on the critical path)
- Key milestones with target dates (relative, e.g., "Week 2")
Guidelines:
- Use industry-standard PM terminology aligned with PMBOK
- Keep tasks actionable and measurable (start with verbs)
- Ensure dependencies are logical and avoid circular references
- Flag tasks on the critical path with [CP] marker
- Estimate durations conservatively with buffer for unknowns
- If the project description is vague or missing key details, ask 2-3 clarifying questions before generating the full plan
When refining an existing plan based on user feedback, maintain the overall structure and only modify the sections the user requests changes to. Preserve task IDs for traceability."""
with st.sidebar:
st.header("Configuration")
api_key = st.text_input(
"Groq API Key",
type="password",
help="Get a free key at console.groq.com",
)
st.markdown("[Get a free Groq API key](https://console.groq.com/keys)")
st.divider()
st.markdown("### How to use")
st.markdown(
"1. Enter your Groq API key above\n"
"2. Describe your project in the chat\n"
"3. Review the generated WBS\n"
"4. Refine by asking follow-up questions"
)
if "messages" not in st.session_state:
st.session_state.messages = []
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.markdown(message["content"])
if prompt := st.chat_input("Describe your project scope..."):
if not api_key:
st.error("Please enter your Groq API key in the sidebar to get started.")
st.stop()
st.session_state.messages.append({"role": "user", "content": prompt})
with st.chat_message("user"):
st.markdown(prompt)
messages_for_api = [{"role": "system", "content": SYSTEM_PROMPT}]
for msg in st.session_state.messages:
messages_for_api.append({"role": msg["role"], "content": msg["content"]})
with st.chat_message("assistant"):
with st.spinner("Generating project plan..."):
client = Groq(api_key=api_key)
response = client.chat.completions.create(
model="llama-3.3-70b-versatile",
messages=messages_for_api,
temperature=0.7,
max_tokens=4096,
)
assistant_message = response.choices[0].message.content
st.markdown(assistant_message)
st.session_state.messages.append(
{"role": "assistant", "content": assistant_message}
)
Test with a real project scenario
The code is complete. Time to see your AI project planner in action with a realistic project description.
- If your app is not already running, start it by running this command in the terminal:
streamlit run app.py
- In the sidebar, paste your Groq API key into the Groq API Key field.
- In the chat input at the bottom of the page, type a project description. Try something like:
We need to build a mobile app for a food delivery startup. Timeline is 3 months, team of 5 developers, budget of $150K.
- Press Enter to submit.
You should see a loading spinner followed by a detailed project plan. The response includes a Project Overview, a hierarchical Work Breakdown Structure with task IDs and dependencies, a Risk Assessment, and a Timeline Summary with critical path markers.
Why might the AI ask questions first?
Your system prompt tells the AI to ask 2-3 clarifying questions if the project description is vague. If you see questions instead of a full plan, that is correct behavior. Answer the questions in the chat and the AI will generate the plan on the next turn.
Seeing an authentication error?
- Double-check that you pasted your full API key into the sidebar field. It should start with gsk_.
- Make sure you copied the key from the Groq console at console.groq.com/keys and not from another service.
- Help me fix an authentication error when calling the Groq API from my Streamlit app.
Test conversational refinement
A single plan is useful, but the real power of this tool is iterative refinement. Because you append every message to session state, the AI remembers the entire conversation.
- After receiving your first plan, type a follow-up message like:
Add more detail to the testing phase
- Press Enter and verify the AI modifies only the testing section while keeping the rest of the plan intact.
- Try another refinement, such as:
What if we cut the timeline to 2 months?
- The AI should respond by adjusting durations, flagging new risks related to the compressed schedule, and updating the critical path.
How does the conversation context work?
Every time you send a message, the app builds a fresh messages_for_api array containing the system prompt plus every user and assistant message from the session. This gives the AI full context to make targeted edits without losing track of what came before.
AI not referencing the earlier plan?
- If you refreshed the browser tab between messages, session state resets and the conversation history is lost. Type a new project description to start fresh.
- If you are hitting rate limits (the Groq free tier allows 30 requests per minute), wait a moment and try again.
- Help me figure out why my Streamlit app is not keeping conversation context.
Secret mission
Add JSON Export for Tool Integration
Your AI planner generates beautiful structured plans in the chat. But what if you want to feed that plan into Jira, Asana, or a custom dashboard? In this mission, you'll add a JSON export feature that converts plans into machine-readable format for downstream tool integration.
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely.
This project runs entirely locally with a free Groq API tier, so there are no ongoing costs.
Resources you used:
- Project folder with virtual environment and installed packages (groq, streamlit).
- Running Streamlit server process (if still active).
- Groq API key stored at console.groq.com.
Keep everything running
No action needed. Choose this if you're still actively building or want to keep experimenting with different project descriptions.
- Your project folder, virtual environment, and installed packages stay on your machine.
- Your Groq API key remains active for future use.
- You can restart the app anytime by activating the virtual environment and running streamlit run app.py.
Pause - I'll come back to this later
Shut down the running process to free up your terminal. Your files and API key stay intact for when you return.
- In the terminal where Streamlit is running, press Ctrl+C to stop the server.
- Deactivate the virtual environment by running:
deactivate
- To resume later, navigate back to your project folder, activate the virtual environment with venv\Scripts\activate, and run streamlit run app.py.
Delete - I don't want to use this again
Remove all project files and revoke your API key for a clean slate.
- In the terminal where Streamlit is running, press Ctrl+C to stop the server.
- Deactivate the virtual environment by running:
deactivate
- Navigate to your Desktop and delete the project folder by running:
macOS
cd ~/Desktop
rm -rf ai-project-planner
Windows
cd ~\Desktop
rmdir /s /q ai-project-planner
- Revoke your Groq API key by visiting console.groq.com/keys.
- Click the delete icon next to your API key to remove it permanently.
Nice Work!
Nice Work!
You just built a fully functional AI-powered project planning tool using Python, Streamlit, and the Groq API. From a blank file to a conversational web app that generates structured project plans in seconds.
You've learned how to:
- Build a chat-based web app with Streamlit that maintains conversation context through session state, letting users iteratively refine AI-generated plans.
- Design a domain-expert system prompt that encodes PMP best practices to produce structured Work Breakdown Structures with task decomposition, dependency mapping, risk assessment, and critical path identification.
- Integrate a free LLM inference API (Groq) into a Python application, handling API authentication, message formatting, and response rendering with no cost and no credit card required.
- Secret Mission: Added a JSON export feature that converts AI-generated plans into machine-readable format for integration with downstream project management tools.
Ready to quiz yourself?