Building Code Agents
This guide demonstrates how to build an intelligent code agent that can analyze and manipulate codebases.
The agent has access to powerful code viewing and manipulation tools powered by Codegen, including:
ViewFileTool
: View contents and metadata of filesSemanticSearchTool
: Search over code using natural language queriesSemanticEditTool
: Make intelligent edits to filesRevealSymbolTool
: Analyze symbol dependencies and usagesMoveSymbolTool
: Move symbols between files with import handling- And many moreā¦
Basic Usage
The following example shows how to create and run a CodeAgent
:
ANTHROPIC_API_KEY
must be set in your env.Available Tools
The agent comes with a comprehensive set of tools for code analysis and manipulation. Here are some key tools:
Each tool provides specific capabilities:
Extensions
GitHub Integration
The agent includes tools for GitHub operations like PR management. Set up GitHub access with:
Import the GitHub tools:
These tools enable:
- Creating pull requests
- Viewing PR contents and diffs
- Adding general PR comments
- Adding inline review comments
Linear Integration
The agent can interact with Linear for issue tracking and project management. To use Linear tools, set the following environment variables:
Import and use the Linear tools:
These tools allow the agent to:
- Create and search issues
- Get issue details and comments
- Add comments to issues
- View team information
Adding Custom Tools
You can extend the agent with custom tools:
Was this page helpful?