Skip to main content

CodeAgent

Defined in the code_agent module.
Agent for code generation, execution, review, and refactoring. This agent provides capabilities for:
  • Generating code from natural language descriptions
  • Executing code in a sandboxed environment
  • Reviewing code for issues and improvements
  • Refactoring and fixing code
  • Explaining code functionality

Constructor

name
str
default:"'CodeAgent'"
No description available.
llm
Optional
No description available.
code
Optional
No description available.
instructions
Optional
No description available.
verbose
bool
default:"True"
No description available.

Methods

Usage

from praisonaiagents import CodeAgent
    
    agent = CodeAgent(name="Coder")
    
    # Generate code
    code = agent.generate("Write a function to calculate fibonacci")
    
    # Execute code
    result = agent.execute("print('Hello, World!')")
    
    # Review code
    review = agent.review(code)