This release is a pre-release and may not be stable for production use.
django-reststroke
Agent actions rest until a human lets them play.
Human-in-the-loop approval for the tool calls of AI agents, in Django: an MCP gateway asks your Django project about each call, a rule or a person accepts or refuses it before it reaches its tool, and an append-only audit log keeps every decision.
What reststroke guarantees:
- Human-in-the-loop approval. A call that no rule decides waits for a person with the right to decide, who sees its exact arguments.
- Exfiltration mitigation. No rule accepts a call to a tool marked "sends data out" (the default) or to a tool whose current definition no person reviewed.
- Rules and requester rights. Rules answer routine calls at once; the strictest wins, and no rule accepts a call above the rights of the requester.
- The exact call, at most once. Before the forward, reststroke checks the fingerprint (SHA-256) of the call and the rights again; an accepted call reaches its tool at most once.
- Tool keys in the gate, fail closed. Only the gate holds the tool keys, and no call passes it while your Django project does not answer.
- Two-person activation, append-only audit. A new rule text acts only after a second person, or a superuser author, activates it. The models and the admin refuse to change or delete an audit entry.
Status: alpha. The API, the settings and the database schema can change between releases, and the changelog lists each breaking change. Not for production use yet.
What it does not do (all the limits):
- At most once: when the tool server does not answer, the gate does not send the call again, and its outcome becomes "unknown".
- Only
tools/listand the acceptedtools/callrequests reach a tool server; the gate refuses the requests for resources and prompts. - No detection of prompt injection: a call that a hidden instruction causes meets the same checks as any other call.
How a tool call passes
The agent sends each tool call to the gate, an MCP gateway that runs apart from Django and holds the keys of your tools. The gate asks your Django project if the call may pass, and sends only an accepted call to its tool (how it works).
Why the approval of an agent framework is not enough
An agent framework gives a pause and a yes or no. It does not check the rights of the requester again before the call goes out, and it keeps no audit trail. reststroke adds rules on each tool, a decision by a person who has the right to decide, a gate that holds the tool keys, and the audit trail. Each team would have to code these again in each tool. An automatic check does not replace a person.
Design decisions and checks
Read the security model, the design decisions and how reststroke is built and checked.
How it is built: the maintainer sets the plan and takes every design decision. The maintainer shapes each issue with an AI agent, which writes it, and reads each issue, and each pull request before its merge. AI agents write the code, the tests and the docs, in a workflow that the maintainer designed: one agent builds each issue, a separate agent checks each commit against its issue, and the CI runs the tests and the scans before each merge.
Try the demo
The demo runs in Docker: a Django project with reststroke, the gate, demo tools and a scripted agent that obeys an instruction hidden in a note. You need git and Docker; the tutorial gives the versions and the ports. The demo is in French.
git clone https://github.com/tryph0n/django-reststroke.git
cd django-reststroke
cp .env.example .env
docker compose up -d --wait
docker compose exec web python manage.py seed_demo
docker compose exec agent python -m scripted_agent --gate-url http://gate:8100/mcp
The last command then waits for a person. The tutorial shows how to refuse that call as bob in the inbox, and what the agent logs then.
Requirements
- Python 3.12 or later.
- Django 6.1.
- PostgreSQL: the demo and the CI tests run on it.
Quick start
In your Django project:
- Install the package:
pip install django-reststroke. On the machine where the gate runs:pip install "django-reststroke[gate]". - Add
"reststroke"toINSTALLED_APPS. - In the root URL configuration, include the interface of the gate and the inbox:
path("reststroke/", include("reststroke.urls"))andpath("inbox/", include("reststroke.inbox_urls")). - Create the tables:
python manage.py migrate. - Make the key of the gate with
python manage.py new_gate_key gate.key, and add the hash that it prints to the settingRESTSTROKE_GATE_KEY_HASHES.
Then follow Install in your project for the other steps, the cron line of expire_calls included, and Run the gate and add an agent.
Links
- Documentation: https://django-reststroke.readthedocs.io/
- Changelog: CHANGELOG.md
- Security policy: report a vulnerability privately, as SECURITY.md explains.
- Contributing: CONTRIBUTING.md, the developer guide.
- License: Apache-2.0, see LICENSE.
About the name
Named after the rest stroke, the gypsy jazz picking technique Django Reinhardt used: the pick comes to rest on the next string before the note moves on.
Metadata
Release files for django-reststroke 0.1.0a4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_reststroke-0.1.0a4.tar.gz | 110.5 kB | With provenance | Details for django_reststroke-0.1.0a4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_reststroke-0.1.0a4-py3-none-any.whl | Python 3 | none | any | Details for django_reststroke-0.1.0a4-py3-none-any.whl |
Total release size: 244.3 kB
Release files / django_reststroke-0.1.0a4.tar.gz
| Download URL | django_reststroke-0.1.0a4.tar.gz |
|---|---|
| Size | 110.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e00eab6b064ec60035a6287c8d227274b1e1a6288eb8dbd16f2c121dd08cab15
|
|
BLAKE2b-256 checksum How to use checksums |
3d64fdd361a703dd3226ea7bbba59592524744d9f37ddd9a7cc615b4125fbbfc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logRelease files / django_reststroke-0.1.0a4-py3-none-any.whl
| Download URL | django_reststroke-0.1.0a4-py3-none-any.whl |
|---|---|
| Size | 133.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57942e75e67323014fc29a359d229ba61a377f4b952a655a88f9c8e44473d006
|
|
BLAKE2b-256 checksum How to use checksums |
2db055e5877c3dce210c877414eb6ab87de00e58c4ba4817f78da9775bed05e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logSecurity for django-reststroke 0.1.0a4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for django_reststroke-0.1.0a4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.