Spaces:
Running
Running
title: The True C-Codestral IDE Agent | |
emoji: π | |
colorFrom: red | |
colorTo: red | |
sdk: gradio | |
sdk_version: 5.33.1 | |
app_file: app.py | |
pinned: true | |
license: mit | |
tags: | |
- agent-demo-track | |
- mcp-server-track | |
<div align="center"> | |
# π The True C-Codestral IDE Agent | |
**An intelligent, multi-step AI agent that transforms natural language instructions into compiled C code, acting as a complete, interactive C development environment.** | |
[](https://huggingface.co/spaces/Agents-MCP-Hackathon/c) | |
[](https://huggingface.co/spaces/Agents-MCP-Hackathon/c) | |
</div> | |
This project is a submission for the **Agents & MCP Hackathon 2025**, participating in both the **Agentic Demo Showcase** and the **MCP Tool / Server** tracks. | |
--- | |
## π₯ Demo Video | |
[](https://www.youtube.com/watch?v=LuO--JG7t7o) | |
**(Click the image to watch the demo on YouTube)** | |
--- | |
## β¨ Core Features / ν΅μ¬ κΈ°λ₯ | |
This agent is more than a simple code generator; it's a true AI development partner that understands and executes complex, sequential tasks. | |
* **π§ Multi-Step Agentic Workflow** | |
* **EN**: Understands and sequentially executes chained commands like "Refactor this code for readability, and then compile it." | |
* **KR**: "μ½λλ₯Ό 리ν©ν λ§νκ³ , κ·Έ λ€μμ μ»΄νμΌν΄μ€"μ κ°μ 볡μ‘νκ³ μ°κ²°λ λͺ λ Ήμ μ΄ν΄νκ³ μμ°¨μ μΌλ‘ μμ μ μνν©λλ€. | |
* **π€ Powered by Codestral** | |
* **EN**: Utilizes Mistral AI's latest specialized model for code, `Codestral`, to generate and analyze high-quality C code. | |
* **KR**: Mistral AIμ μ΅μ μ½λ μ λ¬Έ λͺ¨λΈμΈ `Codestral`μ μ¬μ©νμ¬ μ ννκ³ νμ§ λμ C μ½λλ₯Ό μμ±νκ³ λΆμν©λλ€. | |
* **β‘ On-the-Fly Compilation & Execution** | |
* **EN**: Instantly compiles and runs code using `gcc` on the backend. It provides real-time feedback on the console, including success status, output, or compilation errors. | |
* **KR**: λ°±μλμμ `gcc`λ₯Ό ν΅ν΄ μ½λλ₯Ό μ¦μ μ»΄νμΌνκ³ μ€νν©λλ€. μ±κ³΅ μ¬λΆ, κ²°κ³Ό, μ»΄νμΌ μ€λ₯κΉμ§ μ€μκ°μΌλ‘ μ½μμ νμνμ¬ μλ²½ν C κ°λ° κ²½νμ μ 곡ν©λλ€. | |
* **βοΈ Dual-Mode Interface** | |
* **EN**: Features both a conversational **IDE Agent** for users and **MCP Tools API** endpoints for other agents. | |
* **KR**: μ¬μ©μλ₯Ό μν λνν **IDE Agent**μ λ€λ₯Έ μμ΄μ νΈλ€μ΄ μ¬μ©ν μ μλ **MCP Tools API**λ₯Ό λͺ¨λ μ 곡ν©λλ€. | |
* **π Bilingual Instruction Support** | |
* **EN**: Capable of understanding and processing instructions given in both English and Korean. | |
* **KR**: νκ΅μ΄μ μμ΄λ‘ μμ±λ λͺ λ Ήμ΄λ₯Ό λͺ¨λ μ΄ν΄νκ³ μ²λ¦¬ν μ μμ΅λλ€. | |
--- | |
## π― Hackathon Tracks Contribution / ν΄μ»€ν€ νΈλ κΈ°μ¬ | |
This project makes clear contributions to two separate tracks. | |
### π€ Track 3: Agentic Demo Showcase | |
The **IDE Agent** tab is a complete demonstration of a powerful AI agent. | |
1. **Stateful Interaction**: The agent maintains the code (state) throughout the conversation, building upon previous steps. | |
2. **Complex Command Parsing**: It deconstructs user requests based on connectors like "and" or "then" to create a multi-step execution plan. | |
3. **Autonomous Tool Use**: Based on its plan, the agent autonomously selects and uses its internal tools: `generate_code`, `compile_and_run`, and `analyze_and_refactor`. | |
These capabilities prove it is a true "agent," moving beyond the limitations of a simple chatbot. | |
### π§ Track 1: MCP Tool / Server | |
The **MCP Tools API** tab demonstrates how a Gradio app can function as an MCP (Model Context Protocol) server. | |
* Each function in this tab (`Generate C Code`, `Compile & Run C Code`, etc.) acts as a discrete API endpoint that can be called by any MCP client or other agents. | |
* This exposes the agent's powerful C language processing capabilities as modular tools, allowing other AI services to easily integrate them. | |
--- | |
## π οΈ How It Works & Technical Details / κΈ°μ μ€ν λ° μλ λ°©μ | |
* **Frontend**: Built with `Gradio` to create a modern, interactive web UI. The interface is cleanly separated into two tabs for its distinct purposes (IDE and MCP). | |
* **LLM Backend**: Leverages `Mistral AI`'s `Codestral-latest` model via API calls to handle the core intelligence of code generation, analysis, and refactoring. | |
* **Execution Backend**: Uses Python's `subprocess` module to run the `gcc` compiler in a secure environment, allowing it to feed actual C code execution results back to the user. | |
* **Agent Logic**: The agent's core logic parses user commands with regular expressions to create a task queue. It then iterates through this queue, executing each task sequentially. Results and logs from each step are streamed to the user in real-time for full transparency. | |
## π How to Use / μ¬μ© λ°©λ² | |
1. **IDE Agent Tab**: | |
* **EN**: Write your C code in the **C Code Editor** on the left, or leave it empty to ask the agent to generate new code. In the **Instruction** box on the right, type your command in natural language (English or Korean), e.g., "Create a program that prints 'Hello World' and then run it." Click **Execute**. The agent will perform the tasks, stream its progress to the **Console / Output**, and update the code editor automatically if needed. | |
* **KR**: μΌμͺ½μ **C Code Editor**μ μ½λλ₯Ό μμ±νκ±°λ, λΉμλκ³ μλ‘μ΄ μ½λ μμ±μ μμ²ν μ μμ΅λλ€. μ€λ₯Έμͺ½ **Instruction** λ°μ€μ μνλ μμ μ μμ°μ΄(νκ΅μ΄ λλ μμ΄)λ‘ μ λ ₯ν©λλ€. (μ: "Hello Worldλ₯Ό μΆλ ₯νλ μ½λλ₯Ό λ§λ€κ³ μ€νν΄μ€"). **Execute** λ²νΌμ λλ₯΄λ©΄ μμ΄μ νΈκ° μμ μ μννλ©° **Console / Output**μ μ§ν κ³Όμ κ³Ό μ΅μ’ κ²°κ³Όλ₯Ό νμνκ³ , νμμ μ½λ νΈμ§κΈ° λ΄μ©μ μλμΌλ‘ μ λ°μ΄νΈν©λλ€. | |
2. **MCP Tools API Tab**: | |
* **EN**: This tab is designed for other agents or services to use this Space as an API. You can open each tool's accordion to test its functionality individually. | |
* **KR**: μ΄ νμ λ€λ₯Έ μμ΄μ νΈλ μλΉμ€κ° μ΄ Spaceλ₯Ό APIμ²λΌ μ¬μ©ν λλ₯Ό μν κ²μ λλ€. κ° λꡬ(Tool) μΉμ μ μ΄μ΄ κ°λ³ κΈ°λ₯μ ν μ€νΈν΄λ³Ό μ μμ΅λλ€. |