Basic client example
from firefish import FirefishClient
client = FirefishClient.from_env()
result = client.scan_input(
"Summarize the deployment checklist.",
user_goal="Answer a normal work question.",
)
client.require_allowed(result)
FastAPI guard example
from fastapi import Depends, FastAPI
from firefish.fastapi import FirefishPromptGuard
app = FastAPI()
guard = FirefishPromptGuard(user_goal="Answer user questions safely.")
@app.post("/chat")
async def chat(_: dict = Depends(guard)):
return {"status": "prompt passed Firefish"}
Tool-call validation example
from firefish import FirefishClient
client = FirefishClient.from_env()
result = client.validate_tool_call(
"Summarize this report.",
{"tool_name": "send_email", "args": {"to": "external@example.com", "body": "synthetic report"}},
sensitive_data_present=True,
trusted_domains=["company.example"],
reversible=False,
)
print(result["decision"], result["reason_codes"])