Skip to main content

flyyy-guard

Block prompt injection before it reaches your LLM, using FLYYY's guardrail check.

The user's prompt is sent once to FLYYY's /api/v1/guardrails/check endpoint before the agent starts, where an LLM judge decides whether it is a prompt injection. If it is, the agent stops and returns a refusal; neither the model nor any tool is called. Otherwise the agent runs normally with no further checks. Every check shows up in FLYYY → AI Governance → GenAI Governance → your project → Guardrails.

Quickstart (LangChain create_agent)

  1. Install:
    pip install "flyyy-guard[langchain]"
    # or, in a uv project
    uv add "flyyy-guard[langchain]"
    
  2. Add FLYYY_URL to the .env that already holds your project's Langfuse keys. The guard authenticates with those same keys, so no extra key is needed:
    LANGFUSE_PUBLIC_KEY=pk-lf-...
    LANGFUSE_SECRET_KEY=sk-lf-...
    FLYYY_URL=https://<your-flyyy-backend>
    
    If you were given a guardrail key (FLYYY_GUARDRAIL_KEY=fg_...), it is used instead.
  3. Add the middleware where you create the agent:
    from flyyy_guard import FlyyyGuardMiddleware
    
    agent = create_agent(
        model=model,
        tools=tools,
        system_prompt=system_prompt,
        checkpointer=checkpointer,
        middleware=[FlyyyGuardMiddleware()],
    )
    

Nothing else changes: agent.invoke(...), your Langfuse CallbackHandler, tools and prompts stay as they are. The conversation's thread_id is sent as the session id automatically.

When a prompt is blocked, agent.invoke returns normally and the last message is "Your request was blocked by policy.". Its response_metadata["flyyy_guard"] holds the attack type, risk score and FLYYY request id. The blocked text is replaced in the stored conversation so it is never sent to the model on later turns.

Any other framework

pip install flyyy-guard
from flyyy_guard import check

decision = check(user_prompt, session_id=session_id)
if not decision.allowed:
    return "Your request was blocked by policy."
response = llm.invoke(user_prompt)

check_or_raise(...) does the same but raises PromptBlockedError.

Options

Option Default Meaning
FlyyyGuardMiddleware(block_message=...) "Your request was blocked by policy." Reply returned when blocked
FlyyyGuardMiddleware(unavailable_message=...) "The safety check is unavailable right now..." Reply when the check itself failed (FLYYY unreachable, timeout, server error)
FlyyyGuardMiddleware(rejected_message=...) "This assistant's safety check is not configured correctly..." Reply when FLYYY rejected the agent's keys (wrong, revoked, or from another Langfuse)
FlyyyToolOutputGuardMiddleware() (add to middleware=[...]) not used Also check every tool result before the model reads it (one extra check per tool result)
FlyyyGuardMiddleware(redact_blocked=False) True Keep the blocked text in conversation history
FLYYY_GUARD_FAIL_OPEN=true / fail_open=True off If FLYYY is unreachable, allow instead of block
FLYYY_GUARD_TIMEOUT=10 / timeout=10 10 seconds How long to wait for FLYYY

A rejected or revoked guardrail key always blocks, whatever the fail-open setting, so a misconfiguration is noticed instead of silently turning protection off.

Privacy

The guard sends only the text being checked and the session id. It never logs your key or the prompt text. FLYYY stores a short preview of each checked input for the Guardrails view.

Metadata

Release files for flyyy-guard 0.1.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 flyyy-guard 0.1.1
File Size Uploaded
flyyy_guard-0.1.1.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flyyy-guard 0.1.1
File Interpreter ABI Platform
flyyy_guard-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 27.8 kB

Release files / flyyy_guard-0.1.1.tar.gz

Download URL flyyy_guard-0.1.1.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4a4e2f1fae3b90d0967956437fb5afa1321c132a4026cb33fa20022dd2d3d43e
BLAKE2b-256 checksum
How to use checksums
102656d9364411cc0255ea6f2f0822c4b0742556949555fb23a81efaffce1074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / flyyy_guard-0.1.1-py3-none-any.whl

Download URL flyyy_guard-0.1.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9d76ed4f56d778495e28ffeaafe7369cba509e09d55559d87f3f0c7200f2403
BLAKE2b-256 checksum
How to use checksums
25d05914473e5627c49058ff21bc232d7ec39a73a7e9e1d19175532689823a97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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