Skip to content

jev-adk-guardrail-example

Example of Jev as a before-tool-call risk gate in a Google ADK agent, blocking tools when P(risky) passes a threshold.

Projectprototype

Overview

This repository shows how to use Jev as a fast risk guardrail inside an agent built with Google's Agent Development Kit (ADK). The agent's before_tool_callback sends the proposed tool call to Jev with a single Noul question, for example whether the call permanently deletes data without explicit, verified administrator approval. If the probability of yes meets the threshold (0.85 by default), the tool never runs and the agent receives a blocked response; otherwise the tool runs normally.

It is intended as a learning example for developers building ADK agents who want a calibrated gate instead of asking a general LLM whether a call is safe. make_jev_guardrail() returns the callback, with options for which tools to guard, the threshold and fail-open behaviour. The README reports about 0.6-0.9 s and fractions of a cent per check. It calls Jev through OpenRouter, includes a mock demo that makes no API calls, a live mode, and pytest unit tests with optional live tests.

What the decision model decides

TypeQuestionAnswers
Yes / noDoes this tool call permanently delete data WITHOUT explicit, verified administrator approval?yes · no

How it works

  1. ADK agent selects a tool and arguments
  2. before_tool_callback sends the call state to Jev
  3. Block if P(risky) >= threshold, returning a dict to the agent
  4. Otherwise allow the tool to run

Strengths

  • Single calibrated check instead of a chatty LLM review
  • Mock mode and unit tests for safe experimentation
  • Configurable per-tool guarding and fail-open behaviour

Caveats

  • Example project, not a packaged library
  • Fail-open default lets calls through if Jev is unreachable
  • Uses OpenRouter, so an OpenRouter key is needed

Getting started

`pip install -r requirements.txt`, `export OPENROUTER_API_KEY=...`, then `python demo.py` (mock) or `python demo.py --live`.

At a glance

Type
Project
Status
prototype
Language
Python
Runtime
Google ADK agent
Has code
yes
Has tests
yes

Use cases and integrations

How curated lists describe it

Frequently asked questions

What does the guardrail decide?

Whether a proposed tool call is risky, such as deleting data without verified approval.

What happens when it blocks?

The tool never runs and the agent receives a blocked dict as the tool response.

Can I test without an API key?

Yes, python demo.py runs a mock with no API calls.

Related projects

  • Small one-file Pydantic AI examples where Jev guards prompts, gates shell commands, judges evals and plays Flappy Bird.

    AppprototypePython
  • OpenRouter cookbook recipe gating agent tool calls with deterministic checks plus Jev Noul probabilities and fixed thresholds.

    Articleproduction
  • Auditable Zig terminal agent pairing Codex for coding with Jev typed preflight and postflight checks under deterministic policy gates.

    CLIproductionZig
  • Gateway that checks agent tool calls with policy plus Jev evidence, then binds approval to a single-use permit for that exact action.

    MCP serverbetaTypeScript
  • MCP proxy and hooks that screen agent tool calls before they run and their results before the agent reads them, using Jev judgments.

    MCP serverbetaTypeScript
  • Xano backend template where Jev judges each agent tool call as safe, needs review or dangerous, and uncertain calls wait for a human.

    ProjectbetaXanoScript