SAGE
Software Assistant for Generative Embedded
An intelligent code generation and flashing tool for ESP32C6 development boards powered by local large language models. SAGE transforms natural language descriptions into complete, optimized Arduino code.
SAGE streamlines embedded systems development by generating Arduino code from natural language descriptions. Using a collaborative AI approach with CrewAI, SAGE simulates a development team with Senior and Junior Engineer agents working together.
The Senior Engineer analyzes requirements and creates technical specifications, while the Junior Engineer generates the actual code. This collaborative approach creates higher quality code than traditional code generation tools.
Documentation
Key Features
AI-Powered Code Generation
Generate Arduino code from natural language descriptions like "make LEDs blink in sequence" or "create a WiFi status monitor."
Automated Compilation & Flashing
Build and upload code to ESP32C6 boards with a single command, streamlining your development workflow.
Intelligent Error Handling
Automatically analyze and fix compilation errors, reducing debugging time and frustration.
ESP32C6-Specific Optimizations
Code tailored specifically for ESP32C6 hardware, taking advantage of its unique capabilities.
Technical Architecture
SAGE uses a novel architecture based on the CrewAI framework to simulate a collaborative development team:

Senior Engineer Agent
- Analyzes requirements
- Creates technical specifications
- Validates code quality
- Produces documentation
Junior Engineer Agent
- Generates code based on specifications
- Implements hardware interfacing
- Handles debugging and testing
Example Usage
The easiest way to use SAGE is through the interactive mode:
$ python main.py --interactive
╔══════════════════════════════════════════════════════════════════════════╗
║ SAGE - Software Assistant for Generative Embedded ║
║ Generate Arduino code for ESP32C6 using AI with CrewAI Framework ║
╚══════════════════════════════════════════════════════════════════════════╝
Enter project name: WiFiStatusMonitor
What would you like your ESP32C6 to do?
Connect to WiFi and display the connection status using different LED patterns
(solid GREEN for connected, blinking YELLOW for connecting, solid RED for disconnected).
Initializing SAGE engineering crew...
Generating Arduino code and documentation...
This might take a few minutes as the engineering team works...
Sample Requirements Inputs
LED Sequencing:
"Make the RED, GREEN, and YELLOW LEDs blink in sequence, with each LED staying on for 500ms."
Battery Monitor:
"Create a battery level monitor that displays the current battery level on Serial and shows different colors on the RGB LEDs depending on the battery level."
Development Process
Phase 1: Setup
Command-line interface, Ollama client integration, Arduino CLI wrapper
Phase 2: Code Generation
LLM prompting strategy, code generation pipeline, CrewAI integration
Phase 3: Build System
Reliable compilation, cross-platform upload, error recovery mechanisms
Technologies Used
- Python
- CrewAI Framework
- Ollama
- Arduino CLI
- ESP32C6
- Rich (Terminal UI)
Requirements
- Python 3.8+
- Arduino CLI
- Ollama with qwen2.5-coder:14b model
- ESP32C6 development board
- CrewAI (auto-installed)
Project Impact
SAGE significantly reduces development time for ESP32C6 projects by automating:
- Boilerplate code generation
- Hardware initialization
- Peripheral configuration
- Error handling implementation