Guards plugin for Axio TUI
Project description
axio-tui-guards
Permission guard plugins for axio-tui.
Guards intercept tool calls before execution and can allow, modify, or deny them. Ships two guards: a path-access guard that asks the user before touching filesystem locations, and an LLM-based guard that reviews tool calls for safety.
Features
- PathGuard — intercepts tools that touch the filesystem; prompts the user once per directory and remembers the decision for the session
- LLMGuard — runs a secondary LLM call to review each tool invocation before allowing it
- PermissionGuard protocol — both guards implement
axio.PermissionGuardand compose cleanly - TUI-aware — prompts appear as native
axio-tuidialogs, not blocking stdin reads
Installation
pip install axio-tui-guards
Or install as part of the TUI bundle:
pip install "axio-tui[guards]"
Guards
PathGuard
Intercepts tool calls that contain filesystem paths (file_path, filename, directory, path, cwd). On the first access to a new directory it asks the user to allow, allow all (subtree), or deny.
from axio_tui_guards.guards import PathGuard
from axio.tool import Tool
guard = PathGuard() # uses TUI prompt_fn by default
tool = Tool(
name="write_file",
description="Write a file",
handler=WriteFile,
guards=(guard,),
)
Decision caching:
- Allow — grants access to the parent directory for the current session
- Allow all — grants access to the directory and all subdirectories
- Deny — blocks this path; raises
GuardErrorimmediately on retry
LLMGuard
Uses a secondary LLM call to review the tool handler arguments before execution. If the reviewer deems the call unsafe it raises GuardError with the reason.
from axio_tui_guards.guards import LLMGuard
from axio_transport_openai import OpenAITransport
reviewer = OpenAITransport(api_key="sk-...", model="gpt-4o-mini")
guard = LLMGuard(transport=reviewer)
Composing guards
Guards are applied in order — attach both for layered protection:
tool = Tool(
name="shell",
description="Run shell commands",
handler=Shell,
guards=(PathGuard(), LLMGuard(transport=reviewer)),
)
Custom guards
Implement the PermissionGuard protocol to write your own:
from axio.permission import PermissionGuard
from axio.exceptions import GuardError
class MyGuard(PermissionGuard):
async def check(self, handler):
if "rm -rf" in getattr(handler, "command", ""):
raise GuardError("Refusing to run rm -rf")
return handler
Plugin registration
[project.entry-points."axio.guards"]
path = "axio_tui_guards.guards:PathGuard"
llm = "axio_tui_guards.guards:LLMGuard"
Part of the axio ecosystem
axio · axio-tui · axio-tui-rag
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file axio_tui_guards-0.2.2.tar.gz.
File metadata
- Download URL: axio_tui_guards-0.2.2.tar.gz
- Upload date:
- Size: 86.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ba212a07780c6fad628564a75f2b6684a0acf559bd3b5e671499c1ef18e811
|
|
| MD5 |
9023c8a728f93d3816f61e852683704e
|
|
| BLAKE2b-256 |
e0e9870cc6f3fb7898130b59ebbc5b393931d90cb9c6f3ea373431d949324151
|
Provenance
The following attestation bundles were made for axio_tui_guards-0.2.2.tar.gz:
Publisher:
publish.yml on axio-agent/axio-tui-guards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axio_tui_guards-0.2.2.tar.gz -
Subject digest:
44ba212a07780c6fad628564a75f2b6684a0acf559bd3b5e671499c1ef18e811 - Sigstore transparency entry: 1155395101
- Sigstore integration time:
-
Permalink:
axio-agent/axio-tui-guards@324e469f66469c97f5cc702802491789c7d44373 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/axio-agent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@324e469f66469c97f5cc702802491789c7d44373 -
Trigger Event:
release
-
Statement type:
File details
Details for the file axio_tui_guards-0.2.2-py3-none-any.whl.
File metadata
- Download URL: axio_tui_guards-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c4c142a0452664ba1f7ead2a931ba2b3d0f111fb77162fd0ad0536926f010c0
|
|
| MD5 |
76e06515b1dd87eec2eaa0e10d65c990
|
|
| BLAKE2b-256 |
c4674a268953907856de2f7471e7c586253eba6570d60a038438edbe02e0c838
|
Provenance
The following attestation bundles were made for axio_tui_guards-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on axio-agent/axio-tui-guards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axio_tui_guards-0.2.2-py3-none-any.whl -
Subject digest:
5c4c142a0452664ba1f7ead2a931ba2b3d0f111fb77162fd0ad0536926f010c0 - Sigstore transparency entry: 1155395103
- Sigstore integration time:
-
Permalink:
axio-agent/axio-tui-guards@324e469f66469c97f5cc702802491789c7d44373 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/axio-agent
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@324e469f66469c97f5cc702802491789c7d44373 -
Trigger Event:
release
-
Statement type: