kaggle-benchmarks
AGENTS.md204 starsChanged 10 days agoApache-2.0View on GitHub
kaggle-benchmarks is a Python library for rigorously evaluating LLMs on custom tasks using decorators, assertions, and tool-augmented interactions. Tech Stack: Python 3.11+, uv (package manager), pytest, ruff, mypy, Protocol Buffers. This is a library-first codebase organized by functional concerns: Mental Model: Users write decorated functions (@kbench.task) that prompt LLMs and assert outputs. The library handles orchestration, caching, serialization, and UI rendering.
- Reads credentials
- Installs packages
In this repository2 other files it gives its agents.
The file
Files
AGENTS.md - AI Assistant Guide for kaggle-benchmarks
Project Context
kaggle-benchmarks is a Python library for rigorously evaluating LLMs on custom tasks using decorators, assertions, and tool-augmented interactions. Tech Stack: Python 3.11+, uv (package manager), pytest, ruff, mypy, Protocol Buffers.
High-Level Architecture
This is a library-first codebase organized by functional concerns:
src/kaggle_benchmarks/- Core library implementing the benchmark framework- Top-level modules define primitives: tasks, assertions, clients, messages, results, runs
- Subdirectories provide specialized subsystems:
actors/(LLM interaction),tools/(Python interpreter, web search),envs/(execution environments),kaggle/(platform integration),ui/(Panel-based interfaces)
tests/- Pytest test suite mirroringsrc/structureresearch_benchmarks/- Reference implementations of academic benchmarks (MathVista, SimpleQA)documentation/- Quarto-based docs with executable examples inexamples/protos/- Protocol Buffer schemas for serializationcicd/- Docker and CI/CD scripts
Mental Model: Users write decorated functions (@kbench.task) that prompt LLMs and assert outputs. The library handles orchestration, caching, serialization, and UI rendering.
Sources of Truth (The Map)
Configuration & Environment
- Environment variables → Read
.envfile format inREADME.md - Execution modes →
src/kaggle_benchmarks/_config.pydefinesExecutionModeenum andConfigdataclass - Package metadata →
pyproject.toml(dependencies, version, tool configs)
Core API Surface
- Public exports →
src/kaggle_benchmarks/__init__.pydefines what users import - Task/benchmark decorators →
src/kaggle_benchmarks/tasks.py(@task,@benchmark) - Assertions →
src/kaggle_benchmarks/assertions.py(allassert_*functions) - LLM clients →
src/kaggle_benchmarks/clients.py(client abstraction and resolution)
Subsystems
- Actor system →
src/kaggle_benchmarks/actors/(baseLLMChatandActorinllms.py/base.py; theOpenAIandGoogleGenAIbackends inproxy_openai.py/proxy_genai.py, re-exported fromllms.py) - Tools →
src/kaggle_benchmarks/tools/(Python interpreter, web search) - Execution environments →
src/kaggle_benchmarks/envs/(local, docker) - Kaggle integration →
src/kaggle_benchmarks/kaggle/(model loading, serialization) - UI components →
src/kaggle_benchmarks/ui/(Panel-based rendering)
Testing & Quality
- Test fixtures →
tests/conftest.py - Pre-commit hooks →
.pre-commit-config.yaml(ruff, addlicense) - Type checking config →
pyproject.toml[tool.mypy]section
Documentation
- User-facing guides →
documentation/quick_start.qmd,documentation/user_guide.qmd - Example code →
documentation/examples/*.py - run.json → ATIF mapping →
atif_mapping.md(rules forsrc/kaggle_benchmarks/kaggle/atif.py)
Critical Implementation Rules
- Never manually edit generated files - Files matching
**/*_pb2.pyare auto-generated fromprotos/. Runcd protos && ./build.shto regenerate. - Use
uvfor all dependency operations - Notpip. Commands:uv pip install,uv run --group <group> <command>. Dependency groups defined inpyproject.tomllines 29-72.
Operational Commands
Setup
# Create virtual environment and install
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -e .
# Install dev dependencies
uv pip install -e ".[dev]"Testing
# Run all tests
uv run --group test pytest tests
# Run specific test file
uv run --group test pytest tests/test_assertions.py
# Run with verbose output
uv run --group test pytest tests -vCode Quality
# Format code
ruff format .
# Lint and auto-fix
ruff check --fix .
# Type check
mypy src/
# Run all pre-commit hooks
pre-commit run --all-filesProtocol Buffers
# Rebuild protobuf definitions (required after editing protos/)
cd protos && ./build.shDocker
# Build, run, or start Jupyter
cd cicd
./build.sh # Build image
./run.sh # Run container
./jupyter.sh # Start Jupyter serverAgent Skills
- Writing Benchmarks: See
skills/kaggle-benchmarks/SKILL.mdfor detailed patterns and examples on writing benchmark tasks using thekaggle_benchmarkslibrary.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

