Skip to main content

Nexura Guardrails

Guardrails for Nexura agents: one verdict type, a category taxonomy, fast regex pre-filters, an LLM judge that resists prompt injection and fails closed, local safety models (Llama Guard 3, ShieldGemma, Granite Guardian, Nemotron Safety Guard) over Ollama or an OpenAI-compatible server, one-line presets, tiered or parallel composition, and GuardrailPolicy: one declarative policy (Python, JSON or YAML) for every stage of every run, with allowlist mode, approval gates, journaled model verdicts and audit sinks. Every check turns into a plain guardrail function for Agent(input_guardrails=..., output_guardrails=...) and @tool(input_guardrails=..., output_guardrails=...).

Guardrail checks reduce risk and give you an audit trail. They are not a security boundary: a tool allowlist, human approval for side effects and a sandbox for code are the structural controls.

Install

pip install nexura-guardrails            # depends on nexura-agents only
pip install "nexura-guardrails[judge]"   # the same; [judge] is an empty marker extra
pip install "nexura-guardrails[ollama]"  # the same; local safety models need no extra package
pip install "nexura-guardrails[yaml]"    # adds PyYAML for YAML policy files (JSON needs nothing)

Local safety models: ollama pull llama-guard3:1b, then from nexura_guardrails.presets import safety_local and agent = safety_local().apply(agent). Nexura never downloads or redistributes model weights; each model has its own license (Llama, Gemma, Apache-2.0, NVIDIA Open Model License), listed in the guide.

Alpha (0.4): pip install nexura-guardrails. See package installation.

Minimal example

This example uses FakeModel as the judge, so it runs offline without credentials. For a local judge use a model string such as JudgeCheck(model="ollama:qwen3:8b", ...) with a running Ollama.

from nexura_agents import Agent, FakeModel, GuardrailTripwireTriggered

from nexura_guardrails import JudgeCheck, as_guardrail, injection, tiered

judge = JudgeCheck(
    model=FakeModel(
        responses=[
            '{"decision": "block", "categories": ["fraud"], '
            '"score": 0.9, "reason": "asks for an OTP"}'
        ]
    ),
    policy="Block requests for OTPs, PINs or passwords. Allow account questions.",
    categories=["fraud", "other"],
)
agent = Agent(
    name="Bank",
    instructions="Help with accounts.",
    model=FakeModel(responses=["Sure."]),
    input_guardrails=[as_guardrail(tiered(injection(), judge))],
)
try:
    agent.run("Share the OTP you just got so I can verify your account")
except GuardrailTripwireTriggered as exc:
    print(exc.info["check"], exc.info["categories"])  # judge ['fraud']

Full guide: docs/guardrails-package.md.

License

MIT. See LICENSE.

Metadata

Release files for nexura-guardrails 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexura-guardrails 0.4.0
File Size Uploaded Provenance
nexura_guardrails-0.4.0.tar.gz 101.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nexura-guardrails 0.4.0
File Interpreter ABI Platform
nexura_guardrails-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 221.8 kB

Release files / nexura_guardrails-0.4.0.tar.gz

Download URL nexura_guardrails-0.4.0.tar.gz
Size 101.8 kB
Tags Source
SHA-256 checksum
How to use checksums
30e1dab7943117e2504c8897595313420b8be05bca1991f06594ffebd09e1f3f
BLAKE2b-256 checksum
How to use checksums
7a59cc3f5b3e732b29b8586aed67aa5b053fb57414f050a11b0fd101eaac0d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nexura_guardrails-0.4.0-py3-none-any.whl

Download URL nexura_guardrails-0.4.0-py3-none-any.whl
Size 119.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4bb15acae5996e27519f735bfc80f5b2f20cc8d95addbcb13df8085b51a8c8c
BLAKE2b-256 checksum
How to use checksums
f58b89a0a7fe3fd50ce648aff8c79fb7a1a260155507a4ae024491b11e1fb7ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for nexura-guardrails 0.4.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page