Aider Genius Lite is a simple Jac-based Streamlit application for AI-powered code generation with task planning and validation. It provides a clean, intuitive interface for generating code from natural language requests with real-time feedback and validation.
importfrombyllm.lib{Model}importfrompathlib{Path}globllm=Model(model_name="gemini/gemini-2.5-flash");# Simple task object with semantic annotationsobjTask{hasname:str,type:str,details:str,priority:int=1;}semTask="A specific development task with clear implementation requirements";semTask.name="Clear, descriptive name for the task";semTask.type="Task category: code, fix, docs, or test";semTask.details="Specific implementation instructions";semTask.priority="Task priority: 1=high, 2=medium, 3=low";objCodeResult{hastask_name:str="",code:str="",status:str="",feedback:str="";}semCodeResult="Result of code generation task";semCodeResult.task_name="Name of the completed task";semCodeResult.code="Generated code solution";semCodeResult.status="Task completion status: success or failed";semCodeResult.feedback="Validation feedback and suggestions";# Core AI functionsdefcreate_plan(request:str)->list[Task]byllm(method="Reason");defgenerate_solution(task:Task)->strbyllm(method="Reason");defvalidate_code(code:str,task:Task)->strbyllm(method="Reason");# Nodes for walker traversalnodeTaskNode{hastask:Task=Task(name="",type="",details="",priority=1),code:str="",feedback:str="",status:str="pending",result:CodeResult=CodeResult();defprocess_task{print(f"Working on: {self.task.name}");self.code=generate_solution(self.task);self.feedback=validate_code(self.code,self.task);self.status="success"ifself.feedbackelse"failed";print(f"Completed: {self.task.name}");# Create resultself.result.task_name=self.task.name;self.result.code=self.code;self.result.status=self.status;self.result.feedback=self.feedback;}}nodeSummaryNode{hasresults:list[CodeResult]=[];defshow_summary{output=f"Summary ({len(self.results)} tasks):\n\n";forresultinself.results{status_icon="SUCCESS"ifresult.status=="success"else"FAILED";output+=f"{status_icon}{result.task_name}\n";ifresult.codeandlen(result.code)>0{code_preview=result.code[:300];iflen(result.code)>300{code_preview+="...";}output+=f" Code: {code_preview}\n";}ifresult.feedback{output+=f" Feedback: {result.feedback[:100]}...\n";}output+="\n";}print(output);}}# GeniusAgent as a walkerwalkerGeniusAgent{hasrequest:str,tasks:list[Task]=[],results:list[CodeResult]=[],current_task_index:int=0;canstartwith`rootentry{print("Genius Lite - AI Coding Assistant");print("Simple, structured code generation with validation");print("="*50);self.tasks=create_plan(self.request);print(f"Created {len(self.tasks)} tasks");iflen(self.tasks)>0{# Create task nodes and connect themtask_nodes=[];fortaskinself.tasks{task_node=TaskNode();task_node.task=task;task_nodes.append(task_node);}# Connect nodes in sequenceforiinrange(len(task_nodes)-1){task_nodes[i]++>task_nodes[i+1];}# Connect last task node to summarysummary_node=SummaryNode();summary_node.results=self.results;task_nodes[-1]++>summary_node;# Start traversal from first taskvisittask_nodes[0];}else{print("No tasks created, ending execution");}}canprocess_taskwithTaskNodeentry{# Let the node handle its own processinghere.process_task();# Collect result from node and add to walker's resultsself.results.append(here.result);# Continue to next nodevisit[-->];}canshow_summarywithSummaryNodeentry{# Pass results to the summary nodehere.results=self.results;# Let the node handle its own summary displayhere.show_summary();# Report results for API endpointreport{"status":"success","tasks":[{"name":result.task_name,"code":result.code,"status":result.status,"feedback":result.feedback}forresultinself.results],"total_tasks":len(self.results)};}}
importstreamlitasst;importrequests;defbootstrap_frontend(token:str){st.set_page_config(page_title="Genius Lite - AI Coding Assistant",page_icon="💻",layout="wide");st.title("🚀 Genius Lite - AI Coding Assistant");st.markdown("✨ Simple, structured code generation with validation");# Initialize session stateif"results"notinst.session_state{st.session_state.results=None;}if"loading"notinst.session_state{st.session_state.loading=False;}# Main interfacest.markdown("### 💡 What would you like me to code for you?");# Exampleswithst.expander("💫 Example Requests"){ifst.button("🧮 Create a Python calculator"){st.session_state.user_request="Create a Python calculator with basic math operations";}ifst.button("🎮 Make a simple game"){st.session_state.user_request="Create a simple number guessing game in Python";}}# Text inputuser_request=st.text_area("📝 Describe your coding request:",value=st.session_state.get("user_request",""),height=100,placeholder="e.g., Create a Python script that sorts a list of numbers 📊");# Generate buttonifst.button("🚀 Generate Code"){ifuser_request.strip(){st.session_state.loading=True;st.session_state.results=None;st.rerun();}else{st.warning("⚠️ Please enter a coding request!");}}# Show loading stateifst.session_state.loading{withst.spinner("🧠 AI is thinking and generating code..."){try{response=requests.post("http://localhost:8000/walker/GeniusAgent",json={"request":user_request},headers={"Authorization":f"Bearer {token}"});ifresponse.status_code==200{result=response.json();st.session_state.results=result.get("reports",[{}])[0];st.session_state.loading=False;st.success("✅ Code generation completed!");st.rerun();}else{st.error(f"❌ Generation failed: {response.text}");st.session_state.loading=False;}}exceptrequests.exceptions.Timeout{st.error("⏰ Request timed out. Please try again with a simpler request.");st.session_state.loading=False;}exceptExceptionase{st.error(f"❌ Error: {str(e)}");st.session_state.loading=False;}}}# Display resultsifst.session_state.results{results=st.session_state.results;st.markdown("---");st.markdown("## 🎯 Generated Code Results");if"total_tasks"inresults{st.info(f"📋 Completed {results['total_tasks']} tasks");}if"tasks"inresultsandresults["tasks"]{i=1;fortaskinresults["tasks"]{task_name=task.get('name','Unnamed Task');withst.expander(f"📝 Task {i}: {task_name}"){# Task statusstatus=task.get("status","unknown");ifstatus=="success"{st.success("✅ Completed successfully");}else{st.error("❌ Failed");}# Generated codeiftask.get("code"){st.markdown("**🔧 Generated Code:**");st.code(task["code"]);# Copy buttonifst.button(f"📋 Copy Code {i}"){st.write("📋 Code copied to clipboard! (Use Ctrl+C to copy manually)");}}# Feedbackiftask.get("feedback"){st.markdown("**💬 AI Feedback:**");st.info(task["feedback"]);}}i+=1;}}# Clear results buttonifst.button("🗑️ Clear Results"){st.session_state.results=None;st.session_state.user_request="";st.rerun();}}# Footerst.markdown("---");st.markdown("**🤖 Powered by Genius Lite AI Assistant**");st.markdown("✨ Features: 📋 Task planning • 🔧 Code generation • ✅ Validation");}globINSTANCE_URL="http://localhost:8000",TEST_USER_EMAIL="test@mail.com",TEST_USER_PASSWORD="password",response=requests.post(f"{INSTANCE_URL}/user/login",json={"email":TEST_USER_EMAIL,"password":TEST_USER_PASSWORD});withentry{ifresponse.status_code!=200{# Try registering the user if login failsresponse=requests.post(f"{INSTANCE_URL}/user/register",json={"email":TEST_USER_EMAIL,"password":TEST_USER_PASSWORD});assertresponse.status_code==201;response=requests.post(f"{INSTANCE_URL}/user/login",json={"email":TEST_USER_EMAIL,"password":TEST_USER_PASSWORD});assertresponse.status_code==200;}}globtoken=response.json()["token"];withentry{bootstrap_frontend(token);}
"Create a Python calculator with basic math operations"
"Make a simple number guessing game in Python"
Looking for the full version? This is a lite version for learning purposes. Check out the full-scale Aider Genius project for a complete implementation with advanced features.
Aider Genius Lite demonstrates the power of agentic AI for code generation, showcasing how intelligent systems can understand, plan, and execute complex programming tasks autonomously.