Spaces:
Sleeping
Sleeping
File size: 4,949 Bytes
2eef9ea | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | # Contributing Guide
## Welcome π
Thank you for your interest in contributing to the Multi-Agent System! This guide will help you get started.
## Code of Conduct
- Be respectful and inclusive
- No harassment, discrimination, or offensive language
- Constructive feedback only
## Getting Started
### 1. Fork and Clone
```bash
# Fork the repo on GitHub
git clone https://github.com/your-username/multi-agent-system.git
cd multi-agent-system
git remote add upstream https://github.com/jatingyass/multi-agent-system.git
```
### 2. Create a Branch
```bash
git checkout -b feature/my-feature
# or for fixes:
git checkout -b fix/issue-description
```
### 3. Set Up Development Environment
```bash
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate.bat
pip install -r requirements-dev.txt
```
## Making Changes
### Code Style
- Use [Black](https://github.com/psf/black) for formatting
- Follow [PEP 8](https://pep8.org/) guidelines
- Type hints are encouraged
```bash
# Format code
black backend/
# Check linting
ruff check backend/
# Type checking
mypy backend/
```
### Writing Tests
- Add tests for new features
- Update tests for bug fixes
- Aim for >80% coverage
```bash
# Run tests
pytest
# With coverage
pytest --cov=backend
```
### Documentation
- Update docstrings for functions/classes
- Add/update documentation in [docs/](docs/) folder
- Update README if appropriate
```python
def process_task(task: str) -> dict:
"""
Process a task through the multi-agent system.
Args:
task: The task description
Returns:
dict: Task result with status and output
Raises:
ValueError: If task is empty
"""
...
```
## Commit Guidelines
Use clear, descriptive commit messages:
```
feat: Add new memory retrieval strategy
fix: Correct agent routing in edge case
docs: Update API documentation
style: Format code with black
test: Add tests for memory agent
refactor: Simplify executor logic
chore: Update dependencies
```
```bash
git add .
git commit -m "feat: Add new memory retrieval strategy"
```
## Pull Request Process
1. **Update your branch**
```bash
git fetch upstream
git rebase upstream/main
```
2. **Push to your fork**
```bash
git push origin feature/my-feature
```
3. **Open PR on GitHub**
- Clear title and description
- Reference any related issues (#123)
- Include screenshots for UI changes
4. **Respond to feedback**
- Make requested changes
- Push updates (auto-updates PR)
- Re-request review
## Types of Contributions
### π Bug Reports
1. Check if issue already exists
2. Create detailed bug report:
- Steps to reproduce
- Expected behavior
- Actual behavior
- System info
### β¨ Features
1. Open an issue to discuss first
2. Wait for maintainer feedback
3. Implement following guidelines
4. Submit PR
### π Documentation
1. Fix typos or clarify explanations
2. Add examples or guides
3. Update API documentation
4. Submit PR
### π Code Review
1. Review open PRs
2. Provide constructive feedback
3. Suggest improvements
4. Test changes locally if possible
## Development Tips
### Running Locally with Docker
```bash
docker-compose up --build
```
### Testing Agent Logic
```python
# In tests/test_agents.py
from backend.agents.planner import plan_task
from backend.state.graph_state import create_initial_state
def test_planner_decomposition():
state = create_initial_state("Test task")
result = plan_task(state)
assert "plan" in result
assert len(result["plan"]) > 0
```
### Debugging
```python
# Use logging
from backend.core.logger import get_logger
log = get_logger(__name__)
log.debug("Debug message")
log.info("Info message")
log.error("Error message")
```
## Project Structure
- `backend/` β Python backend code
- `agents/` β Agent implementations
- `api/` β FastAPI application
- `core/` β Core utilities
- `memory/` β Memory management
- `tests/` β Unit tests
- `frontend/` β React frontend
- `docs/` β Documentation
- `scripts/` β Setup and run scripts
## Common Issues
### Tests Failing
```bash
# Clear cache
pytest --cache-clear
# Verbose output
pytest -vv
# Stop on first failure
pytest -x
```
### Import Errors
```bash
# Reinstall in development mode
pip install -e .
# Rebuild cache
python -m py_compile backend/
```
### Environment Issues
```bash
# Recreate virtual environment
rm -rf venv
python -m venv venv
source venv/bin/activate
pip install -r requirements-dev.txt
```
## Review Process
1. Maintainers will review your PR
2. Changes may be requested
3. Once approved, PR will be merged
4. Your contribution will be acknowledged!
## Questions?
- Check existing issues and discussions
- Ask in PR comments
- Open a new discussion
## License
By contributing, you agree your code will be licensed under the MIT License.
Thank you for contributing! π
|