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, rejected keys)
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.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 flyyy-guard 0.1.0
File Size Uploaded
flyyy_guard-0.1.0.tar.gz 17.1 kB Details

Built distribution (wheel)

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

Total release size: 26.9 kB

Release files / flyyy_guard-0.1.0.tar.gz

Download URL flyyy_guard-0.1.0.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0480307b342882d0da4783e730ffa1abcfec25588f4d320e9a4938bbb6c81111
BLAKE2b-256 checksum
How to use checksums
91fb77582248e12e44f767b13f1b59e44ba8d688e7533ddb4265df28552d5b5b
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 8, 2026.

Transparency log

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

Download URL flyyy_guard-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c664980d59c1a4c87364f9f9a15eab785529123455167121536f860b652a8941
BLAKE2b-256 checksum
How to use checksums
810de1cae0e9ff69a0af109a8185f9c87e2744f902e5f706894396075de58b48
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 8, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

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