agentleFS
locustiolocustio/locust/AGENTS.md

locust

AGENTS.md28k starsChanged 6 months agoMITView on GitHub

Locust is a developer-friendly, open-source load testing framework. This guide helps AI agents understand Locust's structure, conventions, and development practices. This file in itself was initially generated by Copilot. For full API and usage docs, see https://docs.locust.io/en/stable/llms-full.txt (or the lighter index at https://docs.locust.io/en/stable/llms.txt). Run checks locally: See docs/developing-locust.rst for detailed contribution instructions.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about locustio/locust

The biggest 5 of 86 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 86

Talked about on GitHub, Stack Overflow, YouTube and Hacker News (86 times).

On GitHub · 50

45 more on GitHub

On Stack Overflow · 30

25 more on Stack Overflow

On YouTube · 4

On Hacker News · 2

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

15 rules. About 0 are common, 5 are distinctive, and 10 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Contributing docs: Add documentation for new features if they are user-facing

    line 74
  2. Very specific:

    Examples: Add example scripts in examples/

    line 75
  3. Very specific:

    Events: Use event.request, event.test_start, event.test_stop, etc.

    line 89
  4. Distinctive:

    Pytest: All tests use pytest (not unittest)

    line 93
  5. Distinctive:

    Mocking: Use pytest fixtures; mock external services

    line 95
  6. Very specific:

    Monkey patching: Always import from locust import ...

    line 99
  7. Distinctive:

    Async patterns: Use gevent for concurrency, not asyncio

    line 101
  8. Very specific:

    Create a module in locust/contrib/<protocol>/

    line 123
  9. Very specific:

    Add tests in locust/test/test_<protocol>.py

    line 125
  10. Very specific:

    Add example in examples/<protocol>/

    line 127
  11. Very specific:

    Update documentation in docs/

    line 132
  12. Very specific:

    Run full test suite: uv run pytest locust/test

    line 133
  13. Very specific:

    Run with -v (verbose) or --loglevel=DEBUG for debug output

    line 136
  14. Distinctive:

    Use modern Python syntax; avoid deprecated patterns

    line 143
  15. Very specific:

    If installed, pre-commit automatically runs ruff and mypy checks before commits

    line 147

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Locust Project Guidelines for AI Agents

Locust is a developer-friendly, open-source load testing framework. This guide helps AI agents understand Locust's structure, conventions, and development practices. This file in itself was initially generated by Copilot.

For full API and usage docs, see https://docs.locust.io/en/stable/llms-full.txt (or the lighter index at https://docs.locust.io/en/stable/llms.txt).

Code Style & Formatting

  • Language: Python 3.11+
  • Line length: 120 characters (enforced by ruff)
  • Linter: ruff (handles linting, import sorting, and upgrades)
  • Type checking: mypy with ignore_missing_imports = true
  • Import order: Locust imports come first (for gevent monkey patching), then stdlib, third-party, and local imports
  • Ignored rules: E402, E501, E713, E731, E741, UP031, PERF203 (see pyproject.toml for details)

Run checks locally:

uv run ruff check locust/
uv run mypy locust/

Architecture

Core Components

  • locust/: Main package
    • user/: User classes (HttpUser, User)
    • runners.py: Test execution and distributed coordination
    • stats.py: Request/response statistics
    • web.py, webui/: Web UI (Flask-based)
    • clients.py: HTTP client implementations
    • rpc/: Remote procedure calls for distributed testing
    • contrib/: Optional protocol/database clients
  • locust/test/: Unit and integration tests (pytest)
  • examples/: Example locustfiles demonstrating various patterns
  • docs/: Sphinx documentation (.rst format)

Key Patterns

  • Event-driven: Uses gevent for concurrency; events for messaging (event.py)
  • Pluggable: Can test multiple protocols (HTTP, gRPC, MQTT, MQTT, etc.)

Build and Test

Setup Development Environment

# Install uv (build system)
# Clone and enter the repo
uv sync                    # Install dependencies with hatch groups

Running Tests

uv run pytest locust/test                 # Run all tests
uv run pytest locust/test/test_main.py    # Run specific test file
hatch test                                # Test across multiple Python versions

Running Linting and Type Checks

uv run pre-commit run --all-files  # Auto-fix formatting issues
uv run ruff check locust/          # Check linting rules
uv run mypy locust/                # Type checking

Building and Installing Locally

uv run locust               # Run your modified code

Documentation

  • Format: reStructuredText (.rst) in docs/
  • Generate locally: make build_docs
  • Contributing docs: Add documentation for new features if they are user-facing
  • Examples: Add example scripts in examples/

See docs/developing-locust.rst for detailed contribution instructions.

Conventions

File Organization

  • Community contributed User classes: Go in locust/contrib/ (e.g., grpc/, mqtt/)
  • Core User classes: HttpUser and FastHttpUser
  • Tests: Mirror source structure in locust/test/

Naming and Patterns

  • User classes: Inherit from User or HttpUser; define @task methods for test scenarios
  • Statistics: Custom stats reporters hook into stats_* events
  • Events: Use event.request, event.test_start, event.test_stop, etc.
  • Load shapes: Implement LoadShape for custom load profiles

Testing Conventions

  • Pytest: All tests use pytest (not unittest)
  • Test discovery: Files named test_*.py or *_test.py
  • Mocking: Use pytest fixtures; mock external services
  • Example files: May be excluded from strict linting (see pyproject.toml)

Gevent and Concurrency

  • Monkey patching: Always import from locust import ... before other imports
  • Greenlets: Users run in separate greenlets; use normal blocking code
  • Async patterns: Use gevent for concurrency, not asyncio

Key Dependencies

  • gevent: Green threads for concurrency
  • Flask: Web UI backend
  • requests: HTTP client (with geventhttpclient option)
  • msgpack: Message serialization for distributed testing
  • pyzmq: Distributed communication
  • pytest: Test framework
  • ruff: Code quality and formatting

Distributed Testing

  • Master-worker architecture: locust/runners.py, locust/rpc/
  • Coordination: Uses ZMQ for inter-process communication
  • Event propagation: Custom events sync across distributed nodes
  • Refer to docs/running-distributed.rst for patterns

Common Tasks

Adding a New Protocol Client

  1. Create a module in locust/contrib/<protocol>/
  2. Implement a user class inheriting from User
  3. Add tests in locust/test/test_<protocol>.py
  4. Document in docs/testing-other-systems.rst
  5. Add example in examples/<protocol>/

Adding a Feature to Core

  1. Modify relevant file (e.g., locust/runners.py for test execution)
  2. Add comprehensive tests
  3. Update documentation in docs/
  4. Run full test suite: uv run pytest locust/test

Debugging

  • Run with -v (verbose) or --loglevel=DEBUG for debug output
  • See docs/running-in-debugger.rst for IDE debugging

Python Version Support

  • Minimum: Python 3.11
  • Tested versions: 3.11, 3.12, 3.13, 3.14, 3.15 (via hatch environments)
  • Use modern Python syntax; avoid deprecated patterns

Pre-commit and CI/CD

  • If installed, pre-commit automatically runs ruff and mypy checks before commits
  • See .pre-commit-config.yaml for hook configuration
  • GitHub Actions runs full test suite on PRs

Links

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.