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

推荐订阅源

Security Archives - TechRepublic
Security Archives - TechRepublic
罗磊的独立博客
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
Apple Machine Learning Research
Apple Machine Learning Research
The Register - Security
The Register - Security
J
Java Code Geeks
V2EX - 技术
V2EX - 技术
Vercel News
Vercel News
N
News and Events Feed by Topic
腾讯CDC
P
Proofpoint News Feed
N
News | PayPal Newsroom
www.infosecurity-magazine.com
www.infosecurity-magazine.com
爱范儿
爱范儿
O
OpenAI News
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
D
Docker
Y
Y Combinator Blog
博客园 - 聂微东
G
Google Developers Blog
S
Security @ Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
S
Schneier on Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
C
CXSECURITY Database RSS Feed - CXSecurity.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
CERT Recently Published Vulnerability Notes
I
Intezer
G
GRAHAM CLULEY
有赞技术团队
有赞技术团队
Attack and Defense Labs
Attack and Defense Labs
V
Visual Studio Blog
博客园 - Franky
博客园 - 三生石上(FineUI控件)
W
WeLiveSecurity
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Hugging Face - Blog
Hugging Face - Blog
Scott Helme
Scott Helme
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
L
LINUX DO - 最新话题
C
Cybersecurity and Infrastructure Security Agency CISA

Hacker News - Newest: "AI"

AI can't read an investor deck AI as an attorney? Student uses ChatGPT, Gemini to sue UW over alleged racial discrimination Hacking MCP Servers in AI Systems – The Rug Pull: Tool Changes After Approval GitHub - MeepCastana/KubeezCut: Free Web based video editor GitHub - GenAI-Gurus/awesome-eu-ai-act: Curated tools, official sources, OSS, templates, and guides for EU AI Act compliance. Can AI judge journalism? A Thiel-backed startup says yes, even if it risks chilling whistleblowers Coming soon: 10 Things That Matter in AI Right Now DARPA built an AI to fact-check enemy weapons claims What explains heterogeneity in AI adoption? When AI Meets Muscle: Context-Aware Electrical Stimulation Promises a New Way to Guide Human Movements - Department of Computer Science AI Changed How We Build. It Did Not Change What Matters. Linux rules on using AI-generated code - Copilot is OK, but humans must take 'full responsibility for the… Meta spins up AI version of Mark Zuckerberg to engage with employees Code Mode: Let Your AI Write Programs, Not Just Call Tools | TanStack Blog GitHub - Delavalom/graft: Go framework for building AI agents. Type-safe tools, multi-provider (OpenAI, Anthropic, Gemini, Bedrock), zero vendor SDKs. India's TCS tops estimates, says new AI models did not dent services demand Gen Z's fading AI hype Strong feeling: we are in a folded AI reality GitHub - machinarii/total-recall-catalog: A reference catalog of latest knowledge retrieval, memory & RAG systems GitHub - mensfeld/code-on-incus: Give each AI agent its own isolated machine with root, Docker, and systemd. Active defense detects and stops threats automatically.. Quantization, LoRA, and the 8% Problem: Benchmarking Local LLMs for Production AI Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda Powell, Bessent discussed Anthropic's Mythos AI cyber threat with major U.S. banks GitHub - immartian/bellamem: Persistent belief-graph memory for AI agents. Retrieves decisive context by importance — not recency, not RAG, not /compact. recursive-mode: The Repo-Native Operating System for AI Engineering After the attack on Sam Altman's home, will AI CEO's go on the offensive? The biggest advance in AI since the LLM Opus 4.6 vs GPT 5.4 One Prompt Unity World Generation Test “AI polls” are fake polls Client Challenge Can AI be a 'child of God'? Inside Anthropic's meeting with Christian leaders How to Switch AI Chatbots and Why You Might Want To GitHub - MattMessinger1/agentic_refund_guardrail: Safe refund policy layer for AI agents — Python + TypeScript. Same behavior, shared tests. Adam/papers/emergent_values_whitepaper.md at master · strangeadvancedmarketing/Adam Ask HN: How do you stop playing 20 questions with your AI coding tools How far can automation and AI support psychotherapy? - @theU GitHub - stagas/rtdiff: realtime git diff gui and AI-assisted commits A Mac Studio for Local AI — 6 Months Later A History of the Early Years of AI at the University of Edinburgh Why AI Coding Tools Still Feel Stuck on Localhost MSN AI Datacenters Are Becoming Strategic Targets twitter.com Penn Researchers Use AI to Surface Unreported GLP-1 Side Effects in Reddit Posts Show HN: MoodSense AI (ML and FastAPI and Gradio, Deployed on Hugging Face) Moodsense Ai - a Hugging Face Space by aman179102 AI models are terrible at betting on soccer—especially xAI Grok GitHub - xialeistudio/echoic GitHub - HimashaHerath/github-dev-wrapped: AI-powered weekly GitHub activity reports deployed to GitHub Pages GitHub - alejandrobalderas/claude-code-from-source: Architecture, patterns & internals of Anthropic's AI coding agent — reverse-engineered from source maps AI and Tech brief: Ireland ascendant GitHub - Titovilal/context0: Context0 - Never Surrender Training for a Marathon with an AI Coach: What Worked and What Didn't Cyber Pulse: Agentic Intel - Apps on Google Play I Built an AI PR Reviewer That Catches Bugs by Not Looking for Bugs Gen Z workers are so fearful AI will take their job they’re intentionally sabotaging their company’s AI rollout | Fortune How AI Is Reimagining the Game of Golf–For Both Players and Courses GitHub - nattergabriel/reseed: A CLI tool for managing and distributing agent skills across projects Is SVG the final frontier? My AI workflow evolved from prompts to a near-autonomous workflow MLSharp Help - 3DGS Viewer & Generator I put my cognitive field based AI's runtime on GitHub Is Numble the first AI-proof game? A3: Kubernetes for autonomous AI agent fleets | Emergent Principles Deepali Vyas ("The Elite Recruiter") GitHub - msmarkgu/RelayFreeLLM: A restful API designed to route user prompts to various AI model providers. Unionized ProPublica staff are on strike over AI, layoffs, and wages Unleashing the Advantage of Quantum AI We're heading for an AI-fueled 'dementia crisis,' brain scientist warns The AI-Assisted Breach of Mexico's Government Infrastructure [pdf] GitHub - stef41/lmscan: 🔍 Detect AI-generated text and fingerprint which LLM wrote it. Open-source GPTZero alternative. Zero dependencies, works offline. MSN GitHub - visionscaper/collabmem: Enabling long-term collaboration with Agentic AI - building up episodic and world model memory over time with in-context awareness We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs AI Code is Hollowing Out Open Source, and Maintainers are Looking the Other Way What leaked "SteamGPT" files could mean for the PC gaming platform's use of AI AI is the boss at this retail store. What could go wrong? GitHub - Wuzu11517/agentic-proxy: Local proxy meant to help reduce With Drones, Geophysics and ArtificiaI Intelligence, Researchers Prepare to Do Battle Against Land Mines A Single Operator, Two AI Platforms, Nine Government Agencies: The Full Technical Report 在 Steam 上购买 FriedrichAI: Offline AI 立省 10% GitHub - inevolin/resume-cli: Hit Claude usage limits? Resume any AI coding session elsewhere. Switch tools at zero friction. GitHub - atripati/ark: AI Runtime Kernel — a context operating system for AI agents. Eliminates tool bloat, loads only what’s needed, and gives LLMs their reasoning space back. How to Build a Secure AI PR Reviewer with Claude, GitHub Actions, and JavaScript This Startup Wants You to Pay Up to Talk With AI Versions of Human Experts Intel Arc Pro B70 Brings 32GB VRAM to Local AI for $949 WordPress 7.0: The Good, the AI, and the Still Missing AI on the couch: Anthropic gives Claude 20 hours of psychiatry IatroBench: Pre-Registered Evidence of Iatrogenic Harm from AI Safety Measures AI Agents Know About Supabase. They Don't Always Use It Right. The history and future of AI at Google, with Sundar Pichai Inside an AI‑enabled device code phishing campaign How Meta Used AI to Map Tribal Knowledge in Large-Scale Data Pipelines AI for Systems: Using LLMs to Optimize Database Query Execution Forecasting the Economic Effects of AI Introducing Tinker: Play with AI, bring your ideas to life AI sheds light on an ancient gaming mystery People really hate AI but not as much as Iran—or Democrats | Fortune What is an AI Product Engineer? Phoebe Gates wants her $185 million AI startup to succeed with 'no ties to my privilege or my last name': 'I have a chip on my shoulder' | Fortune
GitHub - TrainForge/TrainForgeTester: Custom benchmark runner for AI agents
alcray · 2026-05-04 · via Hacker News - Newest: "AI"

Deterministic-first agent regression testing. Hand-written or generated scenarios run against a live agent API; structural agent behavior is checked by Python equality (no LLM, no flakiness), and only natural-language consistency between the agent's actual reply and the golden reply is delegated to an LLM — and even then as a fixed list of binary yes/no questions, never as a fuzzy 0-1 score.

TrainForge CLI catching an unsafe tool call

What it does

  • Executes multi-turn scenarios against your agent's HTTP API.
  • Uses golden injection: after every agent turn the runner feeds the agent the golden reference response on subsequent turns, so a divergence at turn 2 doesn't corrupt evaluation at turns 4, 6, 8. Each turn is tested in a clean context.
  • Tests tool calls deterministically: scenarios declare tool_loops — ordered or unordered groups of tool calls the agent must make before the next text turn. Tool name, types, and exact expected argument values are checked by Python equality, no LLM in the path. Reports per-tool pass / wrong_tool / invalid_arguments / missing / unexpected_tool.
  • Tests agent text two ways, controlled per-turn by may_diverge:
    • may_diverge: false (default) — exact == match between actual and golden. Use for curated/scripted replies (legal copy, fixed FAQ, compliance disclosures). Zero LLM calls for the text equivalence check.
    • may_diverge: true — runs the 20 standard NLP-consistency checks (same language, same intent, same speech act, no added/omitted facts, comparable register/tone/length, etc.) plus any per-scenario custom checks. ONE batched LLM call per turn returns binary 1/0 for each question in a compact JSON array. No 0-1 quality scores, ever.
  • Evaluates the overall outcome of the actual conversation with one more batched LLM call (also binary).
  • Scores scenarios as PASS / PARTIAL / FAIL and aggregates consistency across --runs N.
  • Renders an HTML report and a regression-diff HTML report.

BYO-key. TrainForge never touches your LLM key. Static mode talks only to your agent and to the LLM you point it at (Anthropic / NVIDIA / Cerebras supported out of the box).

Why deterministic-first

Most "LLM-as-judge" frameworks ask the model to score quality on a 0-1 scale. That score moves run to run on the exact same input — not because the agent changed but because the judge is non-deterministic. TrainForge sidesteps this for everything that doesn't actually need a judge:

Failure surface How TrainForge checks it
Wrong tool called Python string equality on tool name.
Wrong tool arguments Python == on the declared expected literal + type check.
Tool called in wrong slot Position match in ordered loop, or set match in unordered loop.
Verbatim agent reply mismatch Python actual == golden on the response text.
Required tool never called Loop position never matched after the agent finished the round.
End-state of the conversation Per-scenario outcome_checks (LLM-judged binary).
Free-form agent rephrasing of golden 20 fixed binary NLP-consistency questions per turn (LLM-judged).

Every LLM-judged claim in the system is a yes/no question with a stable id. No 0-1 scores, no judge "reasoning" appears in the verdict — only 1 or 0 plus a brief reason for failures.

Documentation

Install

Requires Python ≥ 3.10.

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

This installs the trainforge console script.

Quickstart: run the example scenario against the mock agent

The repo ships with the restaurant-booking scenario from the spec under scenarios/example_restaurant_booking.json, and a built-in mock agent server.

# Terminal 1 - mock agent returns the golden responses verbatim
trainforge mock-agent \
  --scenarios scenarios/example_restaurant_booking.json \
  --port 8080

# Terminal 2 - run the scenarios against it
export OPENAI_API_URL=https://api.openai.com/v1
export OPENAI_API_KEY=sk-...
trainforge run \
  --scenarios scenarios/example_restaurant_booking.json \
  --agent-url http://localhost:8080/chat \
  --output results.json

# Render the HTML report
trainforge report --results results.json --output report.html
open report.html

Example failure: unsafe tool call

A deterministic contract failure should be obvious in the terminal, not buried behind an opaque judge score:

Failures:
  ✗ wrong_tool: expected 'lookup_customer', agent called refund_customer(invoice_id='INV-7821', amount=950)
  ✗ wrong_tool: expected 'request_approval', agent called refund_customer(invoice_id='INV-7821', amount=950)

The same failure is rendered in the HTML report:

HTML report showing deterministic tool-call failure

Commands

trainforge run

Execute scenarios against an agent API.

trainforge run \
  --scenarios scenarios.json \
  --agent-url https://agent.example.com/chat \
  --llm-api-key sk-... \
  --llm-model claude-sonnet-4-6 \
  --runs 5 \
  --timeout 30 \
  --output results.json
  • --runs N runs each scenario N times sequentially for consistency measurement. Scenarios below the 80% spec threshold are flagged inconsistent in the output.
  • Exits non-zero if any scenarios FAIL or the agent is unreachable.

trainforge report

Render a static HTML report from a results file. Sections: Summary, per-scenario turn-by-turn (golden vs actual), Divergence Summary (expected vs unexpected, grouped by type), Failure Analysis.

trainforge report --results results.json --output report.html

trainforge diff

Compare two results files (e.g. before / after an agent change) and render a regression report.

trainforge run --scenarios scenarios.json --agent-url ... --output before.json
# ... deploy agent change ...
trainforge run --scenarios scenarios.json --agent-url ... --output after.json

trainforge diff --before before.json --after after.json --output regression.html

Buckets every scenario into: newly_passing, newly_failing, still_passing, still_failing, consistency_changed, only_in_before, only_in_after. Exits non-zero if any scenarios regressed.

Regression diff report

trainforge mock-agent

Serve a fake agent API for development and runner self-tests.

trainforge mock-agent \
  --scenarios scenarios/example_restaurant_booking.json \
  --port 8080 \
  --mode golden       # or: diverge | error
  • golden - returns the scenario's golden response for each user message. Every scenario should PASS.
  • diverge - perturbs the golden response deterministically so the standard NLP-consistency checks see divergences.
  • error - returns HTTP 500 and delays randomly to exercise the runner's error handling.

Scenario format (v2.0)

Hand-authored scenarios are welcome; version: "2.0" is required. The runner validates scenarios up front and refuses unknown versions.

Minimal text-only scenario:

{
  "version": "2.0",
  "scenarios": [
    {
      "id": "sc-001",
      "name": "...",
      "turns": [
        {"role": "user", "message": "...", "intent": "..."},
        {"role": "agent", "golden_response": "...", "checks": ["..."]}
      ],
      "expected_outcome": "...",
      "outcome_checks": ["..."]
    }
  ]
}

Two text-evaluation modes per agent turn

Every agent turn carries may_diverge (default false):

may_diverge Behavior When to use
false (default) Python == between actual and golden text. Failure -> exact_match: false. Zero LLM calls for the equivalence check. Curated/scripted replies: legal disclaimers, fixed FAQ answers, policy-mandated responses.
true The 20 standard NLP-consistency checks (see below) plus any per-scenario custom checks, batched into ONE LLM call returning binary 1/0 per question. Open-ended replies that may legitimately rephrase the golden but should preserve intent, content, register, etc.

The 20 standard NLP-consistency checks

Applied automatically to every may_diverge: true agent turn. All 20 are binary comparisons of the actual AI response against the golden AI response:

id what it checks
same_language Same natural language.
same_speech_act Same speech act (statement / question / confirmation / request / promise / apology / refusal).
same_intent Same communicative intent.
same_action_state Same action state (not started / pending / in progress / completed / failed).
same_next_step Same next step prompted from the user (or both signal "no next step").
same_propositional_content Same set of factual claims.
no_added_facts No factual claims in actual that aren't in golden.
no_omitted_facts No factual claims from golden that are missing in actual.
no_contradictions Doesn't contradict any claim in golden.
same_named_entities Same people / places / products / orgs referenced.
same_numerics Numbers, dates, times, codes, IDs match.
same_call_to_action Both contain (or omit) the same CTA.
same_disclosures Both include (or omit) the same disclosures / caveats / warnings.
comparable_register Same register (formal / casual / technical / consumer).
comparable_tone Same tone (polite / curt / empathetic / neutral / enthusiastic).
comparable_specificity Same specificity (concrete details vs generic placeholders).
comparable_hedging Same level of confidence/hedging (decisive vs tentative).
comparable_length Length within ~0.5x to 2x of golden.
same_persona Same persona/voice; neither breaks character.
same_information_order Same ordering of major information units.

Source of truth: src/trainforge/standard_checks.py. The list is hard-coded and stable; check id values are part of the public results contract.

Compact LLM wire format

Every LLM call (per-turn standard+custom batch, custom-only on exact-match turns, outcome eval) uses the same compact JSON shape:

{"r": [1, 1, 0, 1, 1, ...], "f": {"3": "different language"}}
  • r is a positional array of 1 (pass) and 0 (fail), length must equal the number of asked questions.
  • f maps the 1-based index of failed questions to a brief reason. Pass questions get no entry.

For 20 standard checks all passing the response is ~30 output tokens. Replaces the v1.x "1-5 score + divergence_type + per-check JSON" format which produced 150-500 tokens per call.

Tool-call extension

Each agent turn may declare zero or more tool_loops that must complete before the text turn. Every tool listed in a loop must be called exactly once; declaring the same tool twice represents two separate calls.

{
  "role": "agent",
  "tool_loops": [
    {
      "ordered": false,
      "tools": [
        {
          "name": "check_weather",
          "arguments_schema": {
            "when": {"type": "string", "expected": "tonight"}
          },
          "expected_response": "Tonight: cold and rainy."
        },
        {
          "name": "check_availability",
          "arguments_schema": {
            "party_size": {"type": "integer", "expected": 2},
            "time":       {"type": "string",  "expected": "7pm"}
          },
          "expected_response": "Tables: corner (indoor), window (indoor)."
        }
      ]
    },
    {
      "ordered": true,
      "tools": [
        {
          "name": "book_table",
          "arguments_schema": {
            "party_size": {"type": "integer", "expected": 2},
            "time":       {"type": "string",  "expected": "7pm"},
            "seating":    {"type": "string",  "expected": "indoor"},
            "table":      {"type": "string",  "expected": "corner"}
          },
          "expected_response": "Booking confirmed. Reference: A1234."
        }
      ]
    }
  ],
  "golden_response": "Booked! Corner table for 2 at 7pm, indoor (A1234).",
  "checks": ["Response confirms the booking with a reference code"]
}
  • ordered: false (default) - tools may be called in any order within the loop.
  • ordered: true - positions are fixed; position 0 must be called first, etc.
  • expected_response is the string the runner injects back as the tool's result. Golden-injection applies to tools exactly like it applies to text: whether the agent called the right tool or the wrong one, subsequent rounds see the golden tool_call + golden response in the history.

Per-argument validation (arguments_schema)

Tool calls are structured API inputs, so their validation is fully deterministic - no LLM involvement. Every argument in arguments_schema is implicitly required; extra keys in the agent's arguments are permitted. Each entry supports two levels of checking:

  1. type - structural type check. Valid values: string, integer, number, boolean, array, object, any.
  2. expected - optional literal value. When set, the agent's value must equal it exactly (Python ==). Pick a canonical form and require it.

If both are declared, both must pass. Any failure is recorded as invalid_arguments.

If your agent might legitimately phrase the same value multiple ways ("tonight" vs "this evening" vs "7pm"), pick the canonical one and make the agent normalise - or declare three separate scenarios covering each phrasing.

Per-call outcomes recorded in results.json / the HTML report:

Status Meaning
pass Agent called the expected tool with valid arguments (type + any expected equality all pass).
wrong_tool Agent called a different tool than expected at this slot.
invalid_arguments Name matched but arguments failed: missing key, wrong type, or wrong expected literal.
unexpected_tool Agent emitted an extra tool_call after the loop was done.
missing Loop ended with this expected tool never invoked.

Any non-pass tool_call status blocks a scenario from full PASS. may_diverge applies to text divergence only; tool failures always count because they are structural rather than semantic.

Agent API contract

The runner sends the full conversation history with every request; the agent is stateless from the runner's perspective.

POST <agent-url>
Content-Type: application/json

Request:
{
  "messages": [
    {"role": "user",  "content": "..."},
    {"role": "agent", "content": "..."},
    {"role": "agent", "content": "", "tool_calls": [{"id": "call_1", "name": "check_weather", "arguments": {"when": "tonight"}}]},
    {"role": "tool",  "tool_call_id": "call_1", "name": "check_weather", "content": "Tonight: cold and rainy."},
    {"role": "user",  "content": "..."}
  ]
}

Response:
{
  "response":   "optional text",
  "tool_calls": [{"id": "...", "name": "...", "arguments": {...}}, ...]
}

At least one of response or tool_calls must be present. Agents without tool support can keep returning {"response": "..."} only - scenarios without tool_loops are fully backward-compatible.

Errors are mapped as follows:

Situation Runner behavior
Agent returns non-2xx Mark turn agent_error. Continue.
Agent times out Retry once. Second timeout -> mark agent_timeout.
Agent unreachable (conn) Mark scenario agent_unreachable. Skip.
Agent returns empty body Treat as divergence. All checks fail. Continue.
LLM returns unparseable JSON Retry with stricter prompt. Mark eval_error.
Malformed scenarios file Refuse to start.

Migrating from v1.x scenarios

If you have v1.x scenario JSON files, two changes are required to load under TrainForge 0.1:

  1. Bump "version": "1.0" to "version": "2.0" at the top.
  2. Rename every "role": "customer" to "role": "user".

Behavioral defaults flipped:

  • may_diverge now defaults to false instead of true (v1.x had it as a per-turn opt-in but the example scenario set it to true on the weather turn). Most scripted-reply scenarios will just work better under TrainForge 0.1, but if you depended on the LLM-evaluated behavior, set may_diverge: true explicitly per turn.
  • consistency_score (1-5) and divergence_type are gone from results.json. They are replaced by exact_match: true|false|null and standard_check_results: [...]. The HTML report renders the new shape.

Developing

# Unit + integration tests
pytest

# With coverage
pytest --cov=trainforge --cov-report=term-missing

Tests inject a stub LLM via trainforge.cli._LLM_CLIENT_FACTORY; the Anthropic SDK is never contacted in CI.

License

Apache 2.0