Thank you for your interest in contributing to BaseAgent! This document provides guidelines and instructions for contributing.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/BinglanLi/BaseAgent.git cd BaseAgent - Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install development dependencies:
pip install -e ".[dev]"
Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bugfix-name- Write clean, readable code
- Follow the existing code style
- Add docstrings to functions and classes
- Update tests as needed
- Update documentation if you're changing functionality
Before submitting, make sure all tests pass:
# Run all tests
pytest
# Run with coverage
pytest --cov=BaseAgent --cov-report=html
# Run specific test file
pytest BaseAgent/tests/test_integration.pyRun code quality tools:
# Format code
black BaseAgent/
# Check linting
ruff check BaseAgent/
# Type checking
mypy BaseAgent/Write clear, descriptive commit messages:
git add .
git commit -m "Add feature: description of your changes"Good commit message examples:
Add support for custom LLM providersFix bug in tool retrieval when no tools matchUpdate documentation for resource managerRefactor llm.py for better error handling
git push origin feature/your-feature-nameThen open a Pull Request on GitHub with:
- Clear title describing the change
- Description of what changed and why
- Reference to any related issues
- Screenshots if relevant (for UI changes)
- Follow PEP 8
- Use type hints where possible
- Maximum line length: 100 characters
- Use meaningful variable names
- Add docstrings to all public functions/classes
Example:
def add_tool(
self,
name: str,
function: Callable,
description: str,
required_parameters: list[dict] | None = None,
optional_parameters: list[dict] | None = None,
) -> None:
"""
Add a custom tool to the agent.
Args:
name: Unique name for the tool
function: The callable function to execute
description: Description of what the tool does
required_parameters: List of required parameter definitions
optional_parameters: List of optional parameter definitions
Raises:
ValueError: If a tool with this name already exists
"""
# Implementation- Write tests for new features
- Maintain or improve code coverage
- Use descriptive test names
- Test edge cases and error conditions
Example:
def test_add_tool_with_custom_function():
"""Test that custom functions can be added as tools."""
agent = BaseAgent()
def custom_func(x: int) -> int:
return x * 2
agent.add_tool(
name="double",
function=custom_func,
description="Doubles a number",
required_parameters=[{"name": "x", "type": "int"}]
)
tool = agent.resource_manager.find_tool_by_name("double")
assert tool is not None
assert tool.name == "double"- Check if the bug is already reported in Issues
- If not, create an issue describing the bug
- Reference the issue in your PR
- Discuss major features in an issue first
- Ensure the feature fits with the project goals
- Update documentation
- Add tests
- Fix typos or clarify existing docs
- Add examples
- Improve README or guides
- Add missing test coverage
- Improve existing tests
- Add integration tests
- Automated checks will run (tests, linting)
- Maintainer review - a project maintainer will review your code
- Feedback - address any requested changes
- Approval - once approved, your PR will be merged
- Open an issue with your question
- Tag it with the "question" label
- Be specific about what you need help with
- Be respectful and inclusive
- Welcome newcomers
- Focus on constructive feedback
- Assume good intentions
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to BaseAgent! 🚀