How code-creations-io/create-self-healing-code-agent works
Project type and purpose
• This is a CLI-driven, Python-based “self-healing code generation” tool.
• It uses a small multi-agent framework (Smolagents) and an LLM (OpenAI) to draft code, write tests, run them, and iteratively patch until tests pass.
File structure
• Top level:
• main.py (entry point; loads env, invokes orchestrator)
• requirements.txt, .gitignore, .env (config & deps)
• agents/ (contains each agent’s code + LLM backend + orchestrator)
• agents/:
• llm_backends.py (wraps OpenAI / LiteLLMModel)
• code_writer.py (CodeWriter agent)
• test_writer.py (TestWriter agent)
• critic.py (CodeCritic agent)
• orchestrator.py (threads them together, runs pytest in work_dir)
README for additional insights
• Describes a “self-correcting loop” of up to 5 rounds.
• Workflow: prompt → code_writer → write user_code.py → test_writer → write test_user_code.py → pytest → if fail → critic → patch code → repeat.
• Tech stack: Python 3.11, Smolagents, OpenAI LLM, pytest, rich, dotenv.