Coderen met een AI

Programming with an AI Agent

Artificial intelligence (AI) has fundamentally changed the way we program. AI agents can generate, optimize, and even assist with debugging code. However, there are several limitations that programmers must keep in mind when working with AI.

Problems with Sequence and Duplication

AI agents have difficulty with the correct ordering of code. For example, they might place initializations at the end of a file, causing runtime errors. Furthermore, AI can readily define multiple versions of the same class or function within a project, leading to conflicts and confusion.

A Code Platform with Memory and Project Structure Helps

One solution is to use AI code platforms that can manage memory and project structures. This helps maintain consistency in complex projects. Unfortunately, these features are not always applied consistently. As a result, the AI might lose the coherence of a project and introduce unwanted duplications or incorrect dependencies during programming.

Most AI coding platforms work with so-called tools that the large language model can invoke. These tools are based on an open standard protocol (MCP). It is therefore possible to connect an AI coding agent to an IDE like Visual Code. Optionally, you can set up an LLM locally with llama or Ollama and choose a MCP server to integrate with. Models can be found on huggingface.

IDE Extensions Are Essential

To better manage AI-generated code, developers can use IDE extensions that monitor code correctness. Tools such as linters, type checkers, and advanced code analysis tools help detect and correct errors early on. They are an essential complement to AI-generated code to ensure quality and stability.

The Cause of Recurring Errors: Context and Role in APIs

One of the main reasons AI agents continue to repeat errors lies in how AI interprets APIs. AI models require context and a clear role description to generate effective code. This means prompts must be complete: they should not only contain the functional requirements but also explicitly state the expected outcome and constraints. To facilitate this, you can store prompts in a standard format (MDC) and include them by default when querying the AI. This is particularly useful for generic programming rules you adhere to, as well as the functional and technical requirements and the structure of your project.

Tools like FAISS and LangChain Help

Products such as FAISS and LangChain offer solutions to help AI better handle context. For example, FAISS helps efficiently search and retrieve relevant code snippets, while LangChain assists in structuring AI-generated code and maintaining context within a larger project. However, you can also set this up locally yourself using RAC databases.

Conclusion: Useful, But Not Yet Autonomous

AI is a powerful tool for programmers and can help accelerate development processes. Nevertheless, it is not yet truly capable of independently designing and building a more complex codebase without human oversight. Programmers should view AI as an assistant that can automate tasks and generate ideas, but which still requires guidance and correction to achieve a good result.

Schedule contact to help set up the development environment, enabling teams to maximize its potential and focus more on requirements engineering and design rather than debugging and writing code.

 

Gerard

Gerard works as an AI consultant and manager. With extensive experience at large organizations, he can unravel a problem and work towards a solution remarkably quickly. Combined with an economic background, he ensures commercially sound decisions.

AIR (Artificial Intelligence Robot)