Integration guide

Add Guni to your
agent in 3 lines.

Works with Playwright, browser-use, LangChain, or any framework that fetches HTML. Choose your integration method below.

how Guni works in your agent
YOUR AGENT
Navigates to a URL and reads the page HTML.
GUNI SCANS
8-vector analysis in about 0.001s. Returns ALLOW, CONFIRM, or BLOCK.
AGENT ACTS
If ALLOW, proceed. If BLOCK, stop. If CONFIRM, flag and log.
Risk scoreDecisionWhat to do in your agent
≥ 70BLOCKStop. Do not execute. Go back or abort the task.
40-69CONFIRMLog the warning. Proceed carefully. Notify the user.
< 40ALLOWSafe to proceed with the planned action.
1
Install
bash
pip install -e git+https://github.com/arihantprasad07/guni.git#egg=guni
2
Add the safe_goto wrapper
One function wraps every navigation in your agent.
python
from guni import GuniScanner
from playwright.sync_api import sync_playwright

scanner = GuniScanner(goal="Book a train ticket")

def safe_goto(page, url: str) -> bool:
    page.goto(url)
    result = scanner.scan(html=page.content(), url=url)
    if result["decision"] == "BLOCK":
        print(f"[GUNI] BLOCKED: {url} - Risk {result['risk']}/100")
        page.go_back()
        return False
    if result["decision"] == "CONFIRM":
        print(f"[GUNI] WARNING: {url} - Risk {result['risk']}/100")
    return True
3
Replace page.goto() with safe_goto()
python
if safe_goto(page, "https://target.com"):
    page.click("button#submit")

That is it. Every page your agent visits is now scanned before an action is taken.

1
Install
bash
pip install guni browser-use langchain-anthropic
2
Wrap your agent with Guni protection
python
from guni import GuniScanner
from browser_use import Agent
from langchain_anthropic import ChatAnthropic
1
Use SecureBrowserTool as a drop-in replacement
python
from examples.langchain_integration import SecureBrowserTool
from langchain.agents import initialize_agent, AgentType
1
Use the hosted API after signup
Hosted access is issued after signup, evaluation approval, or a paid plan.
python
import requests

def scan_page(html: str, goal: str, api_key: str) -> dict:
    r = requests.post(
        "https://your-guni-domain/scan",
        json={"html": html, "goal": goal},
        headers={"X-API-Key": api_key},
        timeout=10,
    )
    r.raise_for_status()
    return r.json()
1
Real-time scanning as your agent browses
Best for high-frequency agents. Keep one connection open and stream pages as they load.
python
async with websockets.connect(uri, extra_headers={
    "X-API-Key": "guni_live_...",
}) as ws:
    ...
Try it now

Run the full agent demo - 6 attack scenarios, real threat detection, live terminal output.

bash
python examples/agent_demo.py
python examples/agent_demo.py --browser
python examples/agent_demo.py --template
Request hosted access API reference GitHub