ai newsMi., 25. Nov.
EilmeldungYale’s Sonnenfeld: Nvidia is a ‘detriment’ to U.S. industrial might — not a champion

KI-Agenten evaluieren: Schluss mit Bauchgefühl, her mit Messwerten

Viele Entwickler beurteilen ihre ersten Agenten nach Gefühl, weil die Ausgabe plausibel klingt. Bei echten Nutzern bricht diese Methode zusammen, weshalb strukturierte Evaluationen nötig werden.

dev.toDienstag 15:40 · 24.11.DE3 Min. Lesezeit
Bild: dev.to

Wenn Entwickler ihren ersten KI-Agenten bauen, sieht die Evaluation üblicherweise so aus: einen Prompt senden, die Ausgabe lesen, zustimmend nicken, weil sie kohärent klingt, und dann ausliefern.

Das ist "vibe-based development". Während Vibes für schnelle Demos gut funktionieren, brechen sie in dem Moment zusammen, in dem echte Nutzer mit dem System interagieren. Ein Agent kann außergewohnt klug klingen, während er die falsche API aufruft, halluzinierte Parameter übergibt oder sein eigentliches Ziel stillschweigend nicht erreicht.

Um zuverlässige KI-Agenten für Produktionsworkflows zu bauen, braucht man strukturierte, wiederholbare Metriken statt Intuition.

Anstatt Agenten anhand vager Vorstellungen von Intelligenz zu bewerten, sollte man die Leistung in Prüfungen auf Komponentenebene und eine End-to-End-Validierung der Aufgabe zerlegen. Verfolgen Sie diese vier Metriken:

Man braucht nicht immer komplexe externe Plattformen, um mit der Evaluation der Agenten zu beginnen. Man kann einfache deterministische Assertionsprüfungen für Tool-Aufrufe direkt in der eigenen Testing-Pipeline schreiben.

Hier ist ein Beispiel für die Evaluation von Tool-Auswahl und Parameter-Schemata mit Pydantic-Validierung:

from pydantic import BaseModel, Field, ValidationError class TransferFundsInput ( BaseModel ): account_id: str = Field ( pattern = r "^ACC-\d{5}$" ) amount: float = Field ( gt = 0 ) currency: str = Field ( pattern = r "^(USD|EUR|GBP)$" ) def evaluate_tool_call ( expected_tool: str, actual_tool: str, arguments: dict ) -> dict: if actual_tool!= expected_tool: return { "passed": False, "reason": f "Expected tool '{expected_tool}', got '{actual_tool}'" } try: # Validate argument payload against expected schema validated_args = TransferFundsInput ( ** arguments ) return { "passed": True, "data": validated_args. model_dump ( ) } except ValidationError as e: return { "passed": False, "reason": f "Schema mismatch: {e.errors()}" } # Example execution trace assertion agent_tool_choice = "transfer_funds" agent_args = { "account_id": "ACC-12345", "amount": 150.00, "currency": "USD" } eval_result = evaluate_tool_call ( "transfer_funds", agent_tool_choice, agent_args ) print ( eval_result ) # Output: {'passed': True, 'data': {'account_id': 'ACC-12345', 'amount': 150.0, 'currency': 'USD'}} Enter fullscreen mode Exit fullscreen mode Schritt 2: Traces statt LLM-Zusammenfassungen verfolgen Eine häufige Falle besteht darin, ein LLM die Ausführung eines anderen LLM anhand einer übergeordneten Zusammenfassung bewerten zu lassen. LLM-Evaluatoren leiden oft unter denselben Blindstellen wie der Agent selbst.

Stattdessen sollte man den rohen Trace inspizieren. Man sollte jeden Ausführungsschritt erfassen:

Hier ist ein einfaches Python-Muster, um Ausführungstraces der Schritte zur Inspektion zu erfassen:

import time from typing import Any, Callable, Dict, List class AgentTraceLogger: def __init__ ( self ): self. steps: List [ Dict [ str, Any ] ] = [ ] def record_step ( self, step_name: str, inputs: Dict, action: Callable, * args, ** kwargs ): start_time = time. time ( ) try: output = action ( * args, ** kwargs ) status = "SUCCESS" error = None except Exception as e: output = None status = "FAILED" error = str ( e ) self. steps. append ( { "step": step_name, "inputs": inputs, "output": output, "status": status, "error": error, "latency_ms": round ( ( time. time ( ) - start_time ) * 1000, 2 ) } ) return output # Usage in your pipeline: # logger = AgentTraceLogger() # logger.record_step("fetch_user", {"user_id": 42}, fetch_user_func, user_id=42) Enter fullscreen mode Exit fullscreen mode Durch die Betrachtung schrittweiser Traces findet man versteckte Fehler, etwa einen Agenten, der einen fehlgeschlagenen Tool-Aufruf fünfmal in einer Schleife wiederholt, bevor er dem Nutzer eine höfliche Entschuldigung generiert.

Man sollte sich nie auf eine einzige Metrik verlassen. Wählen Sie drei bis fünf Metriken, die Prüfungen auf Komponentenebene (Argument-Schemata, Handoff-Intention) mit einer End-to-End-Prüfung kombinieren (hat sich der Datenbankzustand wie gewünscht verändert?).

Ein Agent, der klug klingt, ist nicht dasselbe wie ein Agent, der zuverlässig funktioniert. Der Übergang von Vibe-Checks zu strukturierten Evaluationsmetriken ist der größte Unterschied zwischen einem Spielzeugprojekt und produktionsreifer Infrastruktur.

Tanmay baut KI-Agenten und Automatisierungen für Unternehmen und ist für Freelance-Projekte offen. Verbinden Sie sich gerne mit ihm auf LinkedIn.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

When developers build their first AI agent, evaluation usually looks like this: send a prompt, read the output, nod approvingly because it sounds coherent, and ship it.

This is "vibe-based development." While vibes work fine for quick demos, they fall apart the moment real users interact with your system. An agent can sound exceptionally smart while calling the wrong API, passing hallucinated parameters, or silently failing to complete its primary objective.

To build reliable AI agents for production workflows, you need structured, repeatable metrics instead of intuition.

Instead of evaluating agents on vague notions of intelligence, break down performance into component-level checks and end-to-end task validation. Track these four metrics:

You don't always need complex external platforms to start evaluating your agents. You can write simple deterministic assertion checks for tool calls right inside your testing pipeline.

Here is an example of evaluating tool choice and parameter schemas using Pydantic validation:

from pydantic import BaseModel, Field, ValidationError class TransferFundsInput ( BaseModel ): account_id: str = Field ( pattern = r "^ACC-\d{5}$" ) amount: float = Field ( gt = 0 ) currency: str = Field ( pattern = r "^(USD|EUR|GBP)$" ) def evaluate_tool_call ( expected_tool: str, actual_tool: str, arguments: dict ) -> dict: if actual_tool!= expected_tool: return { "passed": False, "reason": f "Expected tool '{expected_tool}', got '{actual_tool}'" } try: # Validate argument payload against expected schema validated_args = TransferFundsInput ( ** arguments ) return { "passed": True, "data": validated_args. model_dump ( ) } except ValidationError as e: return { "passed": False, "reason": f "Schema mismatch: {e.errors()}" } # Example execution trace assertion agent_tool_choice = "transfer_funds" agent_args = { "account_id": "ACC-12345", "amount": 150.00, "currency": "USD" } eval_result = evaluate_tool_call ( "transfer_funds", agent_tool_choice, agent_args ) print ( eval_result ) # Output: {'passed': True, 'data': {'account_id': 'ACC-12345', 'amount': 150.0, 'currency': 'USD'}} Enter fullscreen mode Exit fullscreen mode Step 2: Track Traces Over LLM Summaries A common trap is asking an LLM to evaluate another LLM by reading a high-level summary of what happened. LLM evaluators often suffer from the same blind spots as the agent itself.

Instead, inspect the raw trace. Capture every step of execution:

Here is a simple python pattern to capture step execution traces for inspection:

import time from typing import Any, Callable, Dict, List class AgentTraceLogger: def __init__ ( self ): self. steps: List [ Dict [ str, Any ] ] = [ ] def record_step ( self, step_name: str, inputs: Dict, action: Callable, * args, ** kwargs ): start_time = time. time ( ) try: output = action ( * args, ** kwargs ) status = "SUCCESS" error = None except Exception as e: output = None status = "FAILED" error = str ( e ) self. steps. append ( { "step": step_name, "inputs": inputs, "output": output, "status": status, "error": error, "latency_ms": round ( ( time. time ( ) - start_time ) * 1000, 2 ) } ) return output # Usage in your pipeline: # logger = AgentTraceLogger() # logger.record_step("fetch_user", {"user_id": 42}, fetch_user_func, user_id=42) Enter fullscreen mode Exit fullscreen mode By looking at step-by-step traces, you catch hidden bugs—like an agent retrying a failed tool call five times in a loop before generating a polite apology response to the user.

Never rely on a single metric. Pick 3 to 5 metrics that mix component-level checks (argument schemas, handoff intent) with one end-to-end check (did the database state change as requested?).

An agent that sounds smart isn't the same as an agent that works reliably. Moving from vibe checks to structured evaluation metrics is the single biggest difference between a toy project and production-ready infrastructure.

Tanmay builds AI agents and automation for businesses and is open to freelance projects. Feel free to connect with him on LinkedIn.

Originaltitel: How to Evaluate AI Agents: Stop Relying on Vibes and Start MeasuringQuelle: dev.to (dev.to). Original öffnen