Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ANative Lab EvoAgentX CodeActions

From Leeroopedia
Knowledge Sources
Domains Actions, Code_Generation
Last Updated 2026-10-21 00:00 GMT

Overview

Concrete actions for extracting and verifying LLM-generated code blocks in code generation workflows.

Description

  • CodeExtraction — Action that extracts and saves code blocks from text. Takes `code_string`, `target_directory`, optional `project_name`. Uses LLM to identify code blocks (language, filename, content), saves them to disk, and identifies the main entry file. `CodeBlockList` parses the structured LLM output.
  • CodeVerification — Action that verifies and corrects code using LLM. Takes code string and optional requirements. Uses LLM to analyze code, identify issues, and produce corrected code. Output includes `analysis_summary`, `issues_identified`, `thought_process`, `modification_strategy`, `verified_code`. Falls back to extracting code blocks if title parsing fails.

Usage

  • Code generation workflows: Use `CodeExtraction` to save LLM-generated code to files.
  • Code verification: Use `CodeVerification` to verify and correct generated code before use.
  • Autoconstruction pipeline: Both actions are part of the code generation pipeline.

Code Reference

Source Location

Signature

class CodeExtraction(Action):
    # CodeExtractionInput: code_string, target_directory, project_name
    # CodeExtractionOutput: code_blocks (CodeBlockList), main_file
    ...

class CodeVerification(Action):
    # CodeVerificationInput: code, requirements
    # CodeVerificationOutput: analysis_summary, issues_identified, verified_code
    ...

Import

from evoagentx.actions.code_extraction import CodeExtraction
from evoagentx.actions.code_verification import CodeVerification

I/O Contract

Inputs

Name Type Required Description
code_string str Yes Text containing code blocks
target_directory str Yes (extraction) Directory to save code files
code str Yes (verification) Code to verify
requirements str No Optional code requirements

Outputs

Name Type Description
code_blocks CodeBlockList List of extracted code blocks
verified_code str Corrected code
issues_identified List[str] Issues found in code

Usage Examples

Extract and Verify Code

from evoagentx.actions.code_extraction import CodeExtraction
from evoagentx.actions.code_verification import CodeVerification

# 1. Extract code blocks from LLM output
extraction = CodeExtraction(llm=llm)
result = extraction(code_string=llm_output, target_directory="./project")

# 2. Verify the extracted code
verification = CodeVerification(llm=llm)
verified = verification(code=result.code_blocks.to_code())

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment