Coding Agent

An autonomous coding agent built with Python and Groq that solves programming tasks through iterative tool calling. The agent plans one action at a time, observes tool outputs, and continues reasoning until the requested task is completed.
Overview
Coding Agent is an autonomous command-line AI agent capable of completing programming tasks through iterative reasoning and tool execution.
Instead of directly generating code for every request, the agent follows a structured reasoning loop: it plans a single action, invokes the appropriate tool, observes the result, and then decides the next step until the task is complete.
This project explores the core concepts behind modern agentic systems by combining LLM reasoning with external tool execution.
Motivation
Large Language Models are powerful at reasoning, but they cannot directly interact with a computer.
This project bridges that gap by allowing the language model to control a small set of trusted Python tools while keeping execution outside the model itself.
The result is a safer and more reliable workflow where the LLM focuses on planning and reasoning, while Python performs the actual operations.
Architecture
User
│
▼
LLM (Groq)
│
▼
JSON Decision
│
▼
Python Agent
│
▼
Tool Execution
│
▼
Observation
│
▼
LLM
│
▼
Repeat Until Finished
How It Works
The agent maintains a conversation history containing:
- System instructions
- User requests
- Assistant reasoning
- Tool observations
For every user request, the language model returns one of two responses:
TOOL
The model requests a single tool invocation.
Example:
- Create a directory
- Read a file
- Write a file
- Execute a terminal command
Python executes the requested tool and sends the result back to the model as an observation.
OUTPUT
When the task has been completed, the model returns a final natural-language response to the user.
This strict separation keeps reasoning and execution independent while preventing the model from pretending that tools have already run.
Available Tools
The current implementation supports:
- Run terminal commands
- Create directories
- Write files
- Append to files
- Read files
- List directory contents
Each tool is executed by Python, not by the language model itself.
Technical Highlights
- Autonomous reasoning loop
- JSON-based structured outputs
- Tool calling architecture
- Observation-driven decision making
- Pydantic schema validation
- Dynamic code generation
- Conversation memory
- Groq LLM integration
- Modular tool registry
- CLI interface
What I Learned
Building this project helped me understand:
- Agentic workflows
- Tool calling
- Structured LLM outputs
- JSON schema validation
- Multi-step reasoning
- Observation-feedback loops
- LLM orchestration
- Safe tool execution
Most importantly, it demonstrated that modern AI agents are not simply chatbots—they are systems that combine reasoning with external actions.
Future Improvements
This project serves as the foundation for more capable AI agents.
Planned improvements include:
- Memory
- Planning module
- Multi-agent collaboration
- Streaming responses
- Browser automation
- Code execution sandbox
- File editing
- Vector memory
- Long-term conversation history
- Support for additional LLM providers
Key Takeaway
This project demonstrates one of the fundamental design patterns used by modern AI agents: reason → execute one tool → observe → reason again.
Rather than relying on a single LLM response, the agent incrementally solves tasks through structured decision making and external tool execution, making it a practical introduction to agentic AI systems.