Thank you for your interest in contributing to FlagScale-Agent! This document provides guidelines for contributing to the project.
# Fork the repo on GitHub, then:
git clone https://github.com/YOUR_USERNAME/FlagScale-Agent.git
cd FlagScale-Agent# Install in editable mode with dev dependencies
pip install -e ".[dev]"
# Verify installation
pytest tests/ -vgit checkout -b feature/your-feature-name
# or
git checkout -b fix/issue-number-descriptionWe use Ruff for linting and formatting.
ruff check flagscale_agent/ruff check --fix flagscale_agent/See pyproject.toml for Ruff settings:
- Line length: 100
- Selected rules: E (errors), F (pyflakes), UP (pyupgrade), I (isort), B (bugbear)
- Ignored: E402, E501, E722, E731, E741, F403, F405
# Standard library
import os
import sys
# Third-party
import yaml
from anthropic import Anthropic
# Local
from flagscale_agent.react.agent import WorkerAgent
from flagscale_agent.react.tools.base import BaseToolpytest tests/ -vpytest tests/test_kernel.py -vpytest tests/ --cov=flagscale_agent --cov-report=html
# Open htmlcov/index.html to view coverage report- New features must include tests
- Bug fixes should include regression tests
- Maintain or improve coverage (currently >90%)
tests/mirrorsflagscale_agent/structure- Use pytest fixtures for common setup
- Mock external dependencies (LLM calls, file I/O)
Follow Conventional Commits:
feat: add support for custom tool plugins
fix: resolve memory leak in history compaction
docs: update README with new examples
test: add tests for CircuitBreakerGuard
refactor: simplify Guard registry lifecycle
-
Before submitting:
- Run tests:
pytest tests/ -v - Run linter:
ruff check flagscale_agent/ - Update docs if adding new features
- Add entries to
CHANGELOG.md(if exists)
- Run tests:
-
PR Title:
- Use conventional commit format
- Example:
feat: add vLLM backend support for inference
-
PR Description:
- Describe the problem and solution
- Reference related issues:
Fixes #123 - List breaking changes (if any)
- Include screenshots for UI changes
-
Review Process:
- Address reviewer feedback promptly
- Keep commits clean (squash if needed)
- Ensure CI passes
- 🐛 Bug fixes (check Issues)
- 📚 Documentation improvements
- 🧪 Test coverage for under-tested modules
- 🔧 New domain-specific tools (e.g., profiling, benchmarking)
- 📖 New skills for common workflows
- 🌐 Multi-language support (translations)
- Tools: Add tools for tensorboard, W&B, or other training infrastructure
- Skills: Create skills for specific frameworks (DeepSpeed, FSDP)
- Guards: Implement new safety/quality checks
- Providers: Add support for more LLM providers (Gemini, Cohere, etc.)
- Chip Support: Extend chip capability model for new accelerators
- Examples: Add example workflows for common use cases
- Public classes/functions must have docstrings
- Follow Google-style docstrings:
def my_function(arg1: str, arg2: int) -> bool: """Brief description. Longer description if needed. Args: arg1: Description of arg1 arg2: Description of arg2 Returns: Description of return value Raises: ValueError: When arg2 is negative """
- Keep README.md concise (quick start + overview)
- Detailed guides go in
docs/ - Update skill READMEs when modifying skills
# From source (editable install)
python -m flagscale_agent.cli
# With custom config
FLAGSCALE_AGENT_CONFIG=./my_config.yaml python -m flagscale_agent.cli# Enable verbose logging
export FLAGSCALE_AGENT_LOG_LEVEL=DEBUG
# Or in code
import logging
logging.getLogger("flagscale_agent").setLevel(logging.DEBUG)-
Create
flagscale_agent/react/tools/my_tool.py:from .base import BaseTool, ToolResult class MyTool(BaseTool): name = "my_tool" description = "What this tool does" parameters = { "arg1": {"type": "string", "required": True, "description": "..."} } def execute(self, arg1: str, **kwargs) -> ToolResult: # Implementation return ToolResult( output="Success message", success=True )
-
Register in
flagscale_agent/react/tools/__init__.py:from .my_tool import MyTool BUILTIN_TOOLS = [..., MyTool]
-
Add tests in
tests/test_my_tool.py
- Create
flagscale_agent/skills/my-skill/SKILL.md - Follow the skill template format (see existing skills)
- Test by loading:
/skill my-skill
- GitHub Issues: Bug reports, feature requests
- GitHub Discussions: Questions, ideas, general discussion
- Pull Requests: Code contributions
- Be respectful and inclusive
- Provide constructive feedback
- Help newcomers
- Focus on the technical merit of contributions
Contributors will be:
- Listed in
CONTRIBUTORS.md(if you create one) - Mentioned in release notes for significant contributions
- Acknowledged in the README for major features
If you're unsure about anything:
- Check existing Issues and Discussions
- Open a new Discussion for questions
- Reach out via email: caozhou.1995@gmail.com
Thank you for contributing to FlagScale-Agent! 🎉