惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
M
MIT News - Artificial intelligence
罗磊的独立博客
博客园 - 【当耐特】
A
About on SuperTechFans
Last Week in AI
Last Week in AI
雷峰网
雷峰网
IT之家
IT之家
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
博客园 - 叶小钗
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - Franky
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
Recent Announcements
Recent Announcements

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - Diplomat-ai/diplomat-agent: What can your AI age...
jguarnelli · 2026-04-29 · via Hacker News: Show HN

PyPI version Python 3.9+ License: Apache 2.0 diplomat-agent: scanned CI

You deployed a Python AI agent. Do you know every function it can call that writes to a database, sends an email, charges a card, or deletes data — and which ones have zero checks?

diplomat-agent runs a static AST scan and tells you exactly that. Zero dependencies. 2 seconds on a 1,000-file repo.

pip install diplomat-agent
diplomat-agent scan .

What it looks like

diplomat-agent — governance scan

Scanned: ./my-agent
Tool calls with side effects: 12

⚠ process_refund(amount, customer_id)
  Write protection:       NONE
  Rate limit:             NONE
  → stripe.Refund.create() with no amount limit
  Governance: ❌ UNGUARDED

⚠ delete_user_data(user_id)
  Confirmation step:      NONE
  Batch protection:       NONE
  → session.delete() with no confirmation
  Governance: ❌ UNGUARDED

✓ update_order(order_id)
  Governance: ✅ GUARDED

────────────────────────────────────────────
RESULT: 8 unguarded · 3 partial · 1 guarded (12 total)

diplomat-agent before/after scan


Why this matters for AI agents

In a web app, a human clicks a button. The UI has validation, confirmation dialogs, rate limits per session.

In an agent, an LLM decides which functions to call, with what arguments, how many times. It doesn't know your business rules. It can loop, hallucinate arguments, or get prompt-injected.

Without guards in the code, there's nothing between the LLM's decision and the real-world consequence.

We scanned 16 open-source agent repos. 76% of tool calls had zero checks.


What it detects

40+ patterns across 8 categories:

Category Examples
Database writes session.commit(), .save(), .create(), .update()
Database deletes session.delete(), .remove(), DELETE FROM
HTTP writes requests.post(), httpx.put(), client.patch()
Payments stripe.Charge.create(), stripe.Refund.create()
Email / messaging smtp.sendmail(), ses.send_email(), slack.chat_postMessage()
Agent invocations graph.ainvoke(), agent.execute(), Runner.run_sync()
Destructive commands subprocess.run(), exec(), eval()
Publish / upload s3.put_object(), client.publish()

What counts as a guard: input validation, rate limiting, auth checks, confirmation steps, idempotency keys, retry bounds. Full list →


Integrate everywhere

CI — block unguarded PRs

- name: Diplomat governance scan
  run: |
    pip install diplomat-agent
    diplomat-agent scan . --fail-on-unchecked

IDE — review what the copilot wrote

Works in your IDE with zero extension to install:

IDE How Setup
Copilot Chat (VS Code, Cursor, Windsurf) Select "Diplomat Reviewer" in agent dropdown Copy .github/agents/diplomat-reviewer.agent.md
Claude Code Ask "scan for unguarded tool calls" AGENTS.md at repo root (included)
Cursor (native) Auto-activates on Python files Copy .cursor/rules/diplomat-reviewer.mdc

Pre-commit hook

repos:
  - repo: https://github.com/Diplomat-ai/diplomat-agent
    rev: v0.4.0
    hooks:
      - id: diplomat-agent

SARIF — native VS Code Problems panel

diplomat-agent scan . --format sarif --output results.sarif

Open with SARIF Viewer. Or upload to GitHub Code Scanning.

Scan only changed files

diplomat-agent scan . --diff-only

Generate your agent's SBOM

diplomat-agent scan . --format registry --output-registry toolcalls.yaml

toolcalls.yaml lifecycle

Like requirements.txt — but for what your agent can do, not what it depends on. Commit it. Diff it in PRs. When your agent gains a new capability, the change shows up in review.

What is a Behavioral BOM →


Benchmarks

Repo Files Tool calls Unguarded Time
Skyvern 595 452 345 (76%) ~2s
Dify 1,000+ 1,009 759 (75%) ~3s
PraisonAI 1,028 911 (89%) ~2s
CrewAI 348 273 (78%) ~1s

Full results on 16 repos →


Output formats

Format Flag Use case
Terminal (default) Human review
JSON --format json IDE agents, automation
SARIF 2.1.0 --format sarif VS Code, GitHub Code Scanning
CSAF 2.0 --format csaf Security teams, CERTs
Markdown --format markdown Documentation, reports
Registry --format registry toolcalls.yaml SBOM

Acknowledge a tool call

If a function is intentionally unguarded or protected elsewhere:

def send_alert(message):  # checked:ok — protected by API gateway
    requests.post(ALERT_URL, json={"msg": message})

From scanning to runtime

diplomat-agent finds what your agent can do. diplomat-gate stops it from doing the dangerous parts at runtime.

How diplomat-agent works

Tool Stage What it does
diplomat-agent Know Maps every tool call with side effects. Static. Pre-deploy.
diplomat-gate Decide Enforces CONTINUE / REVIEW / STOP at runtime. < 1ms. Zero deps.
diplomat.run Prove Immutable audit trail, dashboard, compliance export.
# Step 1 — find what your agent can do
pip install diplomat-agent
diplomat-agent scan .
# → 12 unguarded tool calls (8 payments, 4 emails)

# Step 2 — protect them at runtime
pip install "diplomat-gate[yaml]"
# → write gate.yaml, wrap your tools with @gate
from diplomat_gate import Gate

gate = Gate.from_yaml("gate.yaml")
verdict = gate.evaluate({"action": "charge_card", "amount": 15000})
# verdict.decision  → STOP
# verdict.violations → [{"policy": "amount_limit", "message": "Amount 15000 exceeds limit of 10000"}]

15+ pre-built policies (payments, emails, shell commands). CONTINUE / REVIEW / STOP in < 1ms. Zero dependencies.

diplomat-gate → · diplomat.run → (hosted control plane with hash-chained audit trail)


Standards alignment


Known limitations

  • Static analysis only — no runtime detection
  • Python only — TypeScript on the roadmap
  • Intra-procedural + same-package decorators — use # checked:ok for guards in external packages
  • Full limitations →

Roadmap

  • Python AST scanner (40+ patterns)
  • toolcalls.yaml behavioral SBOM
  • CSAF 2.0 + SARIF 2.1.0 output
  • CI integration (--fail-on-unchecked)
  • IDE agents (Copilot Chat, Claude Code, Cursor)
  • Pre-commit hook
  • --diff-only and --file modes
  • Inter-procedural decorator resolution
  • TypeScript support
  • MCP server scanning
  • VS Code extension (inline diagnostics on save)
  • PR comment integration

Requirements

  • Python 3.9+
  • Zero dependencies (stdlib ast only)
  • Optional: rich (colored output), pyyaml (registry)

License

Apache 2.0