Appearance
File operations
Host editor, file_read, and file_write can be gated with filesystem_permissions on AgentConfig.
Tools
editor
View, search, and edit files line-by-line — supports insert, replace, pattern matching, and undo for safe in-place changes
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
EDITOR_DISABLE_BACKUP | optional | unset | Set to true to skip backup files |
EDITOR_DIR_TREE_MAX_DEPTH | optional | 2 | How deep directory trees go when listing folders |
Also respects BYPASS_TOOL_CONSENT (see Tool consent).
file_read
Read local files and parse common formats (JSON, CSV, PDF, code, and more) into text the agent can reason over
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
FILE_READ_RECURSIVE_DEFAULT | optional | true | Search subfolders by default |
FILE_READ_CONTEXT_LINES_DEFAULT | optional | 2 | Extra lines shown around matches |
FILE_READ_START_LINE_DEFAULT | optional | 0 | Starting line for reads |
FILE_READ_CHUNK_OFFSET_DEFAULT | optional | 0 | Offset when reading in chunks |
FILE_READ_DIFF_TYPE_DEFAULT | optional | unified | Diff format |
FILE_READ_USE_GIT_DEFAULT | optional | true | Use git history when available |
FILE_READ_NUM_REVISIONS_DEFAULT | optional | 5 | How many revisions to include |
file_write
Create new files or overwrite existing ones with agent-generated content; prompts for consent unless bypassed
Environment variables
No dedicated environment variables beyond:
- Consent:
BYPASS_TOOL_CONSENT(see Tool consent)
Examples
Requires OPENAI_API_KEY. Sensitive tools prompt for consent — for demos set BYPASS_TOOL_CONSENT=true (see Tool consent).
bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ elsai-agents==0.3.1
pip install --extra-index-url https://core-packages.elsai.ai/root/ "elsai-model[openai]==2.1.0"
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ elsai-agents-tools==0.3.0python
import os
from elsai import Agent
from elsai.agent import AgentConfig
from elsai_model.openai import OpenAIModel
from elsai_tools.editor import editor
from elsai_tools.file_read import file_read
from elsai_tools.file_write import file_write
agent = Agent(
model=OpenAIModel(
model_id="gpt-4o-mini",
client_args={"api_key": os.environ["OPENAI_API_KEY"]},
),
tools=[editor, file_read, file_write],
system_prompt=(
"Use file_read, file_write, and editor to work with local files. "
"After using tools, answer the user clearly in plain text."
),
config=AgentConfig(name="file_assistant"),
)
result = agent(
"Create ./output/hello.txt with the text 'Hello from elsai', "
"then read it back and confirm the contents."
)
print(result)Parameter reference: File operations API.