|
| 1 | +# Contributing to TinyAgent |
| 2 | + |
| 3 | +Thank you for helping. Bug reports, questions, documentation fixes and code are |
| 4 | +all welcome. |
| 5 | + |
| 6 | +## Reporting a bug or asking for a feature |
| 7 | + |
| 8 | +Open an issue using one of the templates. For a bug, include the TinyAgent |
| 9 | +version, Python version, runtime (Ollama or llama.cpp, with its version), the |
| 10 | +model, and the smallest code that reproduces the problem. If it is a routing |
| 11 | +problem, run the CLI with `--verbose` and paste the printed prompt and raw model |
| 12 | +output. |
| 13 | + |
| 14 | +Security problems must not be reported in public issues. See |
| 15 | +[SECURITY.md](SECURITY.md). |
| 16 | + |
| 17 | +## Development setup |
| 18 | + |
| 19 | +TinyAgent has no runtime dependencies and no development dependencies beyond |
| 20 | +Python 3.10 or newer. |
| 21 | + |
| 22 | +```bash |
| 23 | +git clone https://github.com/LLM-project-Team/TinyAgent-SLM.git |
| 24 | +cd TinyAgent-SLM |
| 25 | +python -m venv .venv && source .venv/bin/activate |
| 26 | +pip install -e . |
| 27 | +``` |
| 28 | + |
| 29 | +Run the same checks CI runs: |
| 30 | + |
| 31 | +```bash |
| 32 | +python -m unittest discover -s tests -t . # all tests |
| 33 | +python -m eval.run_eval --mode sim # simulated evaluation, exits 1 on failure |
| 34 | +python -m bench.bench_parser # parser latency benchmark |
| 35 | +``` |
| 36 | + |
| 37 | +No model is needed for any of these. To try a live model, install |
| 38 | +[Ollama](https://ollama.com), run `ollama pull llama3:8b`, then |
| 39 | +`python -m tinyagent --backend ollama "What is 2+3?" --verbose`. |
| 40 | + |
| 41 | +## Rules every change must follow |
| 42 | + |
| 43 | +These are design guarantees, and CI enforces most of them. A pull request that |
| 44 | +breaks one will not be merged. |
| 45 | + |
| 46 | +- **No runtime dependencies.** Standard library only (`tests/test_no_deps.py`). |
| 47 | +- **Model text never becomes code.** No `eval`, `exec`, `compile`, |
| 48 | + `__import__`, `ast.literal_eval`, `pickle` or `importlib` in `tinyagent/` |
| 49 | + (`tests/test_static_gate.py`). |
| 50 | +- **Bounded model calls.** A query uses at most `1 + max_repairs` model calls. |
| 51 | +- **Fail closed.** Ambiguous model output is rejected with an error code, never |
| 52 | + guessed. |
| 53 | +- **Tools are never retried** after they raise or time out. |
| 54 | +- The public signatures and the contracts in `tinyagent/types.py` and |
| 55 | + `tinyagent/errors.py` are listed in Section 8 of |
| 56 | + [ARCHITECTURE.md](ARCHITECTURE.md). Changing them needs agreement from all |
| 57 | + maintainers (Section 12). Open an issue to discuss first. |
| 58 | +- Changes to the prompt template need a live evaluation run showing no |
| 59 | + regression (`python -m eval.run_eval --mode live ...`). |
| 60 | + |
| 61 | +## Pull requests |
| 62 | + |
| 63 | +1. Fork the repository and create a branch from `main`. |
| 64 | +2. Keep the change focused on one thing, and match the style of the |
| 65 | + surrounding code. |
| 66 | +3. Add or update tests. Bug fixes should include a test that fails without the |
| 67 | + fix. |
| 68 | +4. Update `README.md` if behaviour visible to users changes, and add a line |
| 69 | + under "Unreleased" in [CHANGELOG.md](CHANGELOG.md). |
| 70 | +5. Make sure all three checks above pass, then open the pull request and fill |
| 71 | + in the template. |
| 72 | + |
| 73 | +## Releasing (maintainers) |
| 74 | + |
| 75 | +1. Move the "Unreleased" entries in `CHANGELOG.md` under the new version. |
| 76 | +2. Set the same version in `pyproject.toml` and `tinyagent/__init__.py`. |
| 77 | +3. Merge to `main`, then tag and push: `git tag v0.2.0 && git push origin v0.2.0`. |
| 78 | + |
| 79 | +The `Release` workflow checks that the tag matches the version, runs the tests, |
| 80 | +publishes to PyPI and creates a GitHub release. |
| 81 | + |
| 82 | +## License |
| 83 | + |
| 84 | +By contributing, you agree that your contributions are licensed under the |
| 85 | +[MIT License](LICENSE). |
0 commit comments