Thanks for your interest in improving KernelAgent! We aim to make contributions straightforward, transparent, and welcoming.
By participating, you agree to abide by our Code of Conduct. See CODE_OF_CONDUCT.md.
- Report bugs and performance issues
- Propose features and improvements
- Improve documentation and examples
- Add tests and fix bugs
- Optimize kernels or refine prompts/templates
Supported Python: 3.8–3.12. A CUDA‑enabled GPU and an API key are only required for end‑to‑end runs; basic tests do not require them.
- Clone and install (choose one):
git clone https://github.com/pytorch-labs/KernelAgent.git
cd KernelAgent
# Using pip
python -m venv .venv && source .venv/bin/activate
pip install -e .
pip install -e ".[dev]"
# Or using uv (matches CI)
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"- Optional: set environment for e2e runs (LLM + GPU):
cp .env.example .env # then edit with your API key(s)Unit tests:
uv run pytest tests/ -vCoverage (optional):
uv run pytest tests/ -v --cov=triton_kernel_agentEnd‑to‑end example (requires network + GPU):
uv run python e2e_test.pyWe follow PEP 8 with type hints and docstrings.
- Indentation: 4 spaces
- Line length: aim for ~100 chars where practical
- Imports: standard library, third‑party, then local
- Logging: prefer
loggingoverprint - Types: use annotations for public APIs
Ruff configuration is included in pyproject.toml. If you have ruff installed, run:
ruff check .We actively welcome your pull requests. Small, focused PRs are easier to review.
- Fork the repo and branch from
main. - Make your change with tests where appropriate.
- Update docs/README/examples if behavior or APIs change.
- Run tests locally and ensure CI passes.
- Optionally run
ruff check .and address issues. - Submit a clear PR description with context and rationale.
- Tests added or updated when behavior changes
- Docs/examples updated when user‑facing behavior changes
- No unrelated formatting or drive‑by refactors
- CI green (see
.github/workflows/ci.yml)
Use GitHub Issues for bugs and feature requests.
When reporting a bug, please include:
- What you did (minimal reproducible example)
- What you expected to happen
- What actually happened (full error, logs, screenshots as relevant)
- Environment details (OS, Python, GPU/CUDA, package versions)
If you believe you’ve found a security vulnerability, do not open a public issue. Please follow the process described in Meta’s bug bounty program.
Some contributions may require signing a CLA before they can be merged. If prompted by the bot during your PR, please complete the form here: https://code.facebook.com/cla
By contributing to KernelAgent, you agree that your contributions will be
licensed under the LICENSE file in the root of this repository.
- Changes to Jinja2 templates in
triton_kernel_agent/templates/should be validated with an end‑to‑end run (see e2e section) since they affect generation behavior. - For GPU kernels or performance‑sensitive code, include a short note about observed correctness and performance if available.