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

Apache-2.0. See LICENSE and NOTICE.

Metadata

Release files for nexura-guardrails 0.5.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.5.0
File Size Uploaded Provenance Actions
nexura_guardrails-0.5.0.tar.gz 110.8 kB Without provenance Details for nexura_guardrails-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 240.4 kB

Release files / nexura_guardrails-0.5.0.tar.gz

Download URL nexura_guardrails-0.5.0.tar.gz
Size 110.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6fd3d39d797aa6a0393fd0245e8e98a5ee056805023e745183e8eb22588427ec
BLAKE2b-256 checksum
How to use checksums
b884e34672d6be43352bd0b35014fe26f5312581fc20faf733814f95868d30b8
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.5.0-py3-none-any.whl

Download URL nexura_guardrails-0.5.0-py3-none-any.whl
Size 129.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b88fc41349aff39551d1549fd28c556dbbb86bad1cbbe0201bf85ec25123bb0b
BLAKE2b-256 checksum
How to use checksums
604e711666487ae231fb1606f05e2ce2bbfbcd3a2ede848678195c30fa506e09
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.5.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.

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