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

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.9.2
File Size Uploaded Provenance Actions
nexura_guardrails-0.9.2.tar.gz 113.8 kB Without provenance Details for nexura_guardrails-0.9.2.tar.gz

Built distribution (wheel)

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

Total release size: 247.9 kB

Release files / nexura_guardrails-0.9.2.tar.gz

Download URL nexura_guardrails-0.9.2.tar.gz
Size 113.8 kB
Tags Source
SHA-256 checksum
How to use checksums
59ea0744c5feecdc9cb7432096a62ccf68dd0c3d4c5b2de9054923760590da98
BLAKE2b-256 checksum
How to use checksums
36151fb952aa1a070432a2153208ebf6011c49d21814943678167f1190dad94a
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.9.2-py3-none-any.whl

Download URL nexura_guardrails-0.9.2-py3-none-any.whl
Size 134.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66ab4360e4f584ec971b2ce82f07c53ea505196d7969c993858e9e93508a7df4
BLAKE2b-256 checksum
How to use checksums
629032018096ce5978922a91b7274a09fb1e3f256aa0baa1eb2a1736cd35c467
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.9.2

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