code • AI Agents Framework
PraisonAI Code – AI-powered code editing tools.
code
AI Agents Framework
PraisonAI Code – AI-powered code editing tools.
This module provides tools for AI agents to read, write, and modify code files with precision using search/replace diff strategies similar to Kilo Code.
Features:
- read_file: Read file contents with optional line ranges
- write_file: Create or overwrite files
- list_files: List directory contents with filtering
- apply_diff: Apply SEARCH/REPLACE diffs with fuzzy matching
- search_replace: Multiple search/replace operations
- execute_command: Run shell commands safely
Example:
from praisonai.code import read_file, write_file, apply_diff
# Read a file
content = read_file("path/to/file.py")
# Write a file
write_file("path/to/new_file.py", "print('hello')")
# Apply a diff
result = apply_diff("path/to/file.py", diff_content)Import
from praisonai import code