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.
Accept or refuse each tool call of an AI agent before it goes out, by a rule or by a person, in Django, and audit every decision.
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
An AI agent that calls tools can act on your systems: read data, send messages, change records. With reststroke, the agent sends each tool call to the gate, a separate process that holds the keys of your tools, and the gate asks your Django project if the call may pass. A rule that you write accepts or refuses the call at once, or the call waits until a person with the right to decide sees its exact arguments and accepts or refuses it. The gate sends only an accepted call to its tool. Each status change of a call gets an audit entry.
Use cases
- An instruction hidden in a document asks the agent to send your data out. The agent obeys: it asks a tool that sends messages to send your list of clients to an outside address. Mark that tool "sends data out", and no rule can accept a call to it: only a person can let it pass. The person sees the exact arguments next to the message of the user, as the agent passed it on, and refuses. The tool never gets the call.
- Routine calls do not wait for a person. A rule accepts at once the calls to a read tool that the requester has the right to use, up to the daily budget that you give it; past the budget, the next calls of the day wait for a person. When the tool list that the gate gets shows a changed definition of a tool, no rule accepts a call to that tool until a person reviews the new definition.
- What the person accepted is what goes out, once. reststroke keeps the fingerprint of the call that the person accepted. The gate sends that exact call to its tool once, and a call that changed after the acceptance does not go out: it waits again, and a person can only refuse it.
- Your agent holds no tool key. Only the gate holds the keys of the tools, and no tool key reaches the agent or reststroke. Django keeps only the hashes of the keys of the gate and of each agent. In the demo, the agent shares a network only with the gate, and a script checks that it reaches the gate and not the tools, the web app or the database.
- A second person activates each new rule text. A rule that a person adds or edits in the admin acts only after a second person activates it. A superuser may activate their own text, and the record of the activation marks it. Deleting a rule needs no second person; only a superuser deletes a "refuse" or "ask" rule in force. The models and the admin of reststroke refuse to change or delete the activation records and the audit entries.
How a tool call passes
The agent is your AI program. It runs outside Django and acts for a requester: the user of your Django project in whose name it makes the call, from the users and groups that the agent may act for. The agent sends each tool call to the gate, with its own key. The gate asks reststroke, which checks the keys, the call and the rights of the requester. A check or a rule answers at once. If not, the call waits for a person who decides: a user with the right to decide the calls to that tool, who accepts or refuses it before its deadline. Past the deadline, the call gets no. reststroke checks the call and the rights again before the gate sends an accepted call to its tool.
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.
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 admin, and what the agent logs then.
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.0a3
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.0a3.tar.gz | 110.3 kB | With provenance | Details for django_reststroke-0.1.0a3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_reststroke-0.1.0a3-py3-none-any.whl | Python 3 | none | any | Details for django_reststroke-0.1.0a3-py3-none-any.whl |
Total release size: 244.0 kB
Release files / django_reststroke-0.1.0a3.tar.gz
| Download URL | django_reststroke-0.1.0a3.tar.gz |
|---|---|
| Size | 110.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea626bf36334c011d5d5dbe81fbb28277f4125c3328f76f4f0735bfd0cec4d46
|
|
BLAKE2b-256 checksum How to use checksums |
ad2cdbca9d9791518e3757c423115d4d137e549d3349d4ebfc931e6f4f655ca7
|
| 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 2, 2026.
Transparency logRelease files / django_reststroke-0.1.0a3-py3-none-any.whl
| Download URL | django_reststroke-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 133.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
05be33046cff27b3e9440e50fcfc57d3a29a1f1e263a5fe737b2e533f9d79553
|
|
BLAKE2b-256 checksum How to use checksums |
1f0a4427d14c5e8f361f6b1675b0f23048ffbc2fee29dfcaf350740734042723
|
| 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 2, 2026.
Transparency logSecurity for django-reststroke 0.1.0a3
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.0a3.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 2, 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.