> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# code • AI Agents Framework

> PraisonAI Code - AI-powered code editing tools.

# code

<Badge color="purple">AI Agents Framework</Badge>

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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonai import code
```

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Code Agent" icon="code" href="/docs/features/codeagent" />

  <Card title="Code Feature" icon="terminal" href="/docs/features/code" />
</CardGroup>
