AgentsHarnesses 🇨🇳 31.07.2026 11:01

Self-Building Agent: An Experiment with LangChain4j

OpenAIOpenAI
An experiment where a code assistant uses LangChain4j documentation to build a self-cloning agent. The resulting system can fix bugs and pass tests, but initially fails with GPT-4o, succeeding with GPT-5-mini. The workflow-based approach proved to be three times faster than the supervisor-based one.
The team at InfoQ China conducted a meta-experiment: they gave a code assistant the LangChain4j documentation and asked it to use that documentation to build an agent that could write, test, and debug code. The code assistant designed a multi-agent system based on the supervisor pattern, with four subagents: ExplorerAgent, PlannerAgent, ImplementerAgent, and ExecutorAgent. This first iteration worked impressively, mimicking the pattern of professional code assistants. To test it, they had it fix bugs in a Calculator class with four faulty methods. Initially, using OpenAI's GPT-4o, the system failed with a 'exceeded 100 sequential tool invocations' error. Switching to GPT-5-mini, the system successfully fixed all bugs and ran 11 tests with 0 failures. They also explored a workflow-based alternative, which used a sequence of five steps with loops for planning and execution, including a SummarizerAgent. This alternative also fixed the bugs but ran three times faster than the supervisor-based version, taking only two minutes versus over six minutes. The project is available in a public code repository.
Abbreviations
LLM = Large Language Model — Большая языковая модель
Source: InfoQ 中国 — original
Our earlier posts on this topic ↓
Fresh news