A sophisticated AI agent system built on LangGraph that provides web development assistance through natural language commands. This project combines the power of TRAE Agent's methodology with a web-friendly interface and enhanced tooling.
Web Agent is an AI assistant that helps developers with web development tasks through natural language commands. It can create files, run commands, edit code, and perform complex multi-step operations while maintaining proper working directory context.
- Natural Language Interface: Interact with your development environment using plain English
- Working Directory Awareness: Tools operate in the correct directory context
- TRAE-Inspired Reflection: Sophisticated reasoning and verification steps
- Real-time Streaming: Watch the agent work step-by-step
- Extensible Tool System: Easily add new capabilities
- Observability: Built-in Langfuse integration for detailed tracing
web-agent/
├── agent-py/ # Python backend agent
│ ├── src/
│ │ └── web_agent/
│ │ ├── agent.py # Agent creation and configuration
│ │ ├── state.py # Agent state definition (TraeWebState)
│ │ └── tools/ # Tool implementations
│ │ ├── bash_tool.py # Enhanced bash with injected state
│ │ ├── edit_tool.py # File editing operations
│ │ ├── sequential_thinking_tool.py # TRAE-style reasoning
│ │ └── task_done_tool.py # Task completion signaling
│ ├── tests/ # Test files
│ └── pyproject.toml # Python project configuration
└── ui/ # React frontend (future development)
└── (to be implemented)
This project builds upon the excellent work of the TRAE Agent from ByteDance, adapting its sophisticated reasoning and reflection capabilities for web development workflows.
- TraeWebState: Extended state management with working directory support
- Custom LangGraph Workflow: Implements TRAE-style reflection loops
- Enhanced Tools: Bash, file editing, and reasoning tools with proper context
- Observability: Langfuse integration for detailed tracing and debugging
- Python 3.10+
- UV package manager
- Ollama (for local model inference) or OpenAI API access
# Clone the repository
git clone <your-repo-url>
cd copilotkit-work/web-agent/agent-py
# Create virtual environment and install dependencies
python -m venv .venv
source .venv/bin/activate
uv sync
# Set up working directory
mkdir -p /home/$(whoami)/src/projects/copilotkit-work/test_workingdir
# Run tests to verify installation
uv run tests/custom_agent_test.pyCreate a .env file for configuration:
# Model configuration
LLM_BASE_URL=http://localhost:11434/v1
LLM_API_KEY=ollama
LLM_MODEL=qwen3:latest
# Working directory
DEFAULT_WORKING_DIR=/home/$(whoami)/src/projects/copilotkit-work/test_workingdir
# Observability (optional)
LANGFUSE_PUBLIC_KEY=your_key
LANGFUSE_SECRET_KEY=your_secretfrom web_agent.agent import create_web_agent
# Create the agent
agent = create_web_agent()
# Execute a task
result = await agent.ainvoke({
"messages": [HumanMessage(content="Create a React component called Button")],
"working_directory": "/path/to/your/project",
"remaining_steps": 20
})The agent can handle various web development tasks:
# Create and edit files
"Create a React component called Header with a navigation menu"
# Run development commands
"Start the development server with npm run dev"
# Complex multi-step operations
"Set up a new Next.js project with TypeScript and Tailwind CSS"
# File operations
"Rename components/Button.js to components/Button.tsx and add TypeScript types"- bash_tool: Execute shell commands with working directory context
- edit_tool: Create, view, and edit files with string replacement
- sequential_thinking_tool: TRAE-style reasoning and planning
- task_done_tool: Signal task completion
Tools are implemented using LangChain's tool decorator with state injection:
@tool
def custom_tool(
param: str,
working_directory: Annotated[DirectoryPath, InjectedState("working_directory")]
) -> str:
"""Tool description."""
# Implementation here
passRun the test suite to verify functionality:
# Run all tests
uv run pytest tests/ -v
# Run specific test files
uv run tests/custom_agent_test.py
uv run tests/bash_tool_test.pyThe project includes Langfuse integration for detailed tracing:
- Tool Calls: Track which tools are called with what parameters
- Agent Reasoning: See the agent's thought process
- Performance Metrics: Monitor token usage and latency
- Error Tracking: Identify and debug failures
We welcome contributions! Please see our contributing guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add tests for new functionality
- Update documentation for new features
- Use type hints throughout
- Ensure backward compatibility
This project builds upon the excellent work of:
- TRAE Agent by ByteDance - For the sophisticated reasoning and reflection methodology
- LangGraph - For the powerful agent framework
- LangChain - For tool integration and LLM abstraction
- Ollama - For local model inference
This project is licensed under the MIT License - see the LICENSE file for details.
Please use the GitHub Issues to report bugs or request features.
- Documentation: Read the Docs
- Discussions: GitHub Discussions
- Issues: GitHub Issues
Note: This project is under active development. Features and APIs may change as we continue to improve the system.