CodeAgent is an AI-powered intelligent programming assistant that integrates directly into your GitHub workflow. Simply mention the bot account in Issues or PRs, or use simple commands to get code analysis, automated programming, and code review services.
⚠️ Important Note:@bot-name
in this documentation is an example. Replace it with your configured assistant account name in actual use.
CodeAgent supports two interaction modes to flexibly meet different use cases:
Use @bot-name
+ natural language, suitable for complex requirements and flexible expression
In Issues:
@bot-name Help me analyze the root cause of this issue
- Deep problem analysis@bot-name Help me implement this feature
- Complete feature implementation and PR creation@bot-name Design a solution
- Architecture design suggestions
In PRs:
@bot-name Help me analyze this implementation
- Code implementation analysis@bot-name Optimize the performance
- Performance optimization improvements@bot-name Add error handling logic
- Code improvement and commit submission@bot-name Refactor this function
- Code refactoring
Use predefined commands for concise and efficient completion of common tasks
Command | Use Case | Function Description |
---|---|---|
/code |
Issue comments | Quick requirement analysis, code implementation and PR creation |
/continue [instruction] |
PR comments/Reviews | Continue development based on existing code, submit commits |
/review |
PR comments | Perform complete code review again |
- Automatic Code Review: Every PR receives intelligent code review
- Fork Repository Support: Support for PR interactions from fork repositories (comment mode only)
- Smart Filtering: Automatically exclude PRs from specific assistant accounts
- Multi-model Support: Specify different AI models via parameters (e.g.,
-claude
,-gemini
)
CodeAgent is a backend service that receives GitHub Webhook events and responds intelligently.
Step 1: Environment Setup
# Clone the code
git clone https://github.com/qiniu/codeagent.git
cd codeagent
# Install dependencies
go mod download
Step 2: Configure Environment Variables
# Set required environment variables
export GITHUB_TOKEN="your-GitHub-Token"
export CLAUDE_API_KEY="your-Claude-API-Key" # or other AI provider key
export WEBHOOK_SECRET="your-Webhook-Secret"
Step 3: Start Service
# Run directly
go run ./cmd/server --port 8888
# Check service status
curl http://localhost:8888/health
Step 4: Configure GitHub Webhook
Add a Webhook in your repository settings:
- URL:
https://your-domain.com/hook
- Content type:
application/json
- Secret: Same as
WEBHOOK_SECRET
- Events: Check
Issue comments
,Pull request reviews
,Pull requests
🎉 Done! Now you can use @bot-name
in Issues or PRs
# Build image
docker build -t codeagent .
# Run container
docker run -d \
-p 8888:8888 \
-e GITHUB_TOKEN="your-token" \
-e CLAUDE_API_KEY="your-key" \
-e WEBHOOK_SECRET="your-secret" \
codeagent
# Build
make build
# Run tests
make test
# Test webhook events
curl -X POST http://localhost:8888/hook \
-H "Content-Type: application/json" \
-H "X-GitHub-Event: issue_comment" \
-d @test-data/issue-comment.json
Welcome to contribute! Please read CONTRIBUTING.md for detailed development process.
This project is licensed under the Apache License 2.0.
Need help? Check documentation or open an issue