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

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

Built distribution (wheel)

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

Total release size: 247.9 kB

Release files / nexura_guardrails-0.9.1.tar.gz

Download URL nexura_guardrails-0.9.1.tar.gz
Size 113.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1511194d637b26e9b99d597b2c31f392aa91f6a52070b20fc3ed8406cd5f44c0
BLAKE2b-256 checksum
How to use checksums
0517d1f08e641b699694bf4be78e5cb4604754c4ad66976020db40961e99356f
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.1-py3-none-any.whl

Download URL nexura_guardrails-0.9.1-py3-none-any.whl
Size 134.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
647d5613db32bd8f571cc2f8aeffe45b5a41fe2322f445a20deda848ad7734b0
BLAKE2b-256 checksum
How to use checksums
dd0022fb9214f5d0e86bb16d39ab0f189f2c1607d5a95bc93c960c405f704adb
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.1

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