Trae Agent is a command-line interface (CLI) powered by Large Language Models (LLMs) designed to automate general software engineering tasks. By providing instructions in plain English, you can delegate complex development workflows to the agent. It supports multiple model providers—including OpenAI and Anthropic—and features a versatile toolkit for file creation, text editing, Bash command execution, and structured, sequential reasoning.
To keep users informed, Trae Agent generates concise step-by-step summaries (via a feature called Lakeview), supports interactive development for iterative tasks, and maintains detailed execution traces for debugging and auditing. Configuration is handled easily through JSON files and environment variables.
🌊 Lakeview: Provides clear, human-readable summaries for every action the agent takes.
🤖 Multi-Model Support: Integrates directly with official OpenAI and Anthropic APIs.
🛠️ Comprehensive Toolkit: Capabilities include file manipulation, shell command execution, and sequential logic.
🎯 Interactive Mode: An ongoing conversation loop for real-time, iterative development.
📊 Trajectory Logging: Maintains a full record of agent actions for post-task analysis and debugging.
⚙️ Flexible Configuration: Setup is managed via JSON with support for environment variable overrides.
🚀 Streamlined Installation: Available via Pip, with UV recommended for efficient environment management.
We recommend using UV to set up the project environment.
git clone <repository-url>
cd trae-agent
uv sync
You can configure Trae Agent using a configuration file or by exporting your keys as environment variables:
# For OpenAI
export OPENAI_API_KEY="your-openai-api-key"
# For Anthropic
export ANTHROPIC_API_KEY="your-anthropic-api-key"
To execute a simple task, use the following command:
trae-cli run "create a hello world Python script"
The primary entry point is the trae command, which includes several specialized subcommands.
trae run — Execute a TaskUse this command to initiate a specific engineering task:
# Basic execution
trae-cli run "write a Python script that calculates Fibonacci numbers"
# Specify a provider and model
trae-cli run "fix the bug in main.py" --provider anthropic --model claude-sonnet-4-20250514
# Define a custom working directory
trae-cli run "add unit tests for the utils module" --working-dir /path/to/project
# Export the trajectory for review
trae-cli run "refactor the database module" --trajectory-file debug_session.json
# Force the agent to generate patches
trae-cli run "update the API endpoints" --must-patch
trae interactive — Interactive ModeFor ongoing tasks that require back-and-forth communication, use interactive mode:
# Start a session
trae-cli interactive
# Start with a specific configuration
trae-cli interactive --provider openai --model gpt-4o --max-steps 30
While in interactive mode, you can:
• Enter any task description to trigger the agent.
• Type status to view the agent's current configuration.
• Type help for a full list of available commands.
• Type clear to refresh the terminal screen.
• Type exit or quit to end the session.
trae show-config — View ConfigurationCheck your current settings with:
trae-cli show-config
# View a specific configuration file
trae-cli show-config --config-file my_config.json
Trae Agent stores settings in a JSON file (trae_config.json). Below is an example structure:
{
"default_provider": "anthropic",
"max_steps": 20,
"model_providers": {
"openai": {
"api_key": "your_openai_api_key",
"model": "gpt-4o",
"max_tokens": 128000,
"temperature": 0.5,
"top_p": 1
},
"anthropic": {
"api_key": "your_anthropic_api_key",
"model": "claude-sonnet-4-20250514",
"max_tokens": 4096,
"temperature": 0.5,
"top_p": 1,
"top_k": 0
}
}
}
Settings are applied according to the following priority:
• OPENAI_API_KEY: Your OpenAI API key.
• ANTHROPIC_API_KEY: Your Anthropic API key.
Trae Agent comes equipped with several built-in tools to handle diverse tasks:
str_replace_based_edit_tool: For file system management and text editing.
• view: Displays file content or lists directory structures.
• create: Generates new files.
• str_replace: Performs string replacement within existing files.
• insert: Adds text at a specified line number.
bash: For running shell commands and scripts.
• Executes shell commands with a persistent state across steps.
• Manages background or long-running processes.
• Captures and returns standard output (stdout) and error messages (stderr).
sequential_thinking: For structured problem-solving.
• Deconstructs complex requirements into manageable steps.
• Allows the agent to revise its strategy based on new information.
• Facilitates hypothesis generation and testing.
task_done: To signal completion.
• Formally marks a task as finished.
• Returns the final summary and results to the user.
Trae Agent automatically records detailed execution logs, known as trajectories.
# This command generates an automatic trajectory file
trae-cli run "debug the auth module"
# The output will look like: trajectory_20250612_220546.json
# You can also manually name the file
trae-cli run "optimize the database queries" --trajectory-file optimization_debug.json
Every trajectory file contains:
• LLM Interactions: A full history of messages, model responses, and tool calls.
• Agent Steps: A record of state transitions and internal reasoning.
• Tool Usage: Details on which tools were invoked and their specific outputs.
• Metadata: Execution metrics including timestamps and token consumption.
For further details on log analysis, refer to TRAJECTORY_RECORDING.md.
Import Errors:
If the CLI cannot find the project modules, try setting the PYTHONPATH:
PYTHONPATH=. trae-cli run "your task"
API Key Problems: Ensure your keys are correctly exported and recognized:
# Check if keys are active in the environment
echo $OPENAI_API_KEY
echo $ANTHROPIC_API_KEY
# Review the agent's active configuration
trae show-config
Permission Errors: If the agent cannot modify files, verify directory permissions:
# Grant necessary permissions to your project directory
chmod +x /path/to/your/project
Tencent HunyuanVideo-1.5: 8.3B Video Model Runs on 14GB GPUs
DeepSeek-OCR WebUI: Batch OCR with Markdown Tables and Visual Bounding Boxes
Tongyi DeepResearch: 30B Agent Model Beats GPT and Claude on Search Benchmarks
Smart-Admin Setup Guide: Environment, Backend, Frontend, and Mobile Deployment
BuildAdmin: Vue3 ThinkPHP8 Panel With Visual CRUD Builder
Claude Code for Windows: Run Natively Without WSL or Docker
Memos Self-Hosted Note App: Lightweight Markdown and API-First
Memvid: Store Millions of Text Chunks in a Single MP4 File
Ventoy USB Tool: Boot Multiple ISOs Without Reformatting
ACI.dev: 600+ Tools for AI Agents with Built-In Auth and MCP Support
Wasteland SLG Guide: Survival Tips & Alliance Strategy
IOPaint: Free Open-Source Image Inpainting and Object Removal