Мазмұнға өту
Мақала Kazakh тілінде әлі жарияланбаған. English нұсқасы көрсетілуде.

Evaluating Tool-Calling Agents: Trajectory Scoring, Tool Accuracy, and Argument Fidelity

2 мин оқу

Evaluating an agent only by reading its final text answer misses critical bugs: the agent might have called three unnecessary expensive tools, passed a wrong date range and guessed the rest, or triggered a mutating tool when it should have asked for confirmation. Trajectory evaluation inspects the full sequence of tool calls alongside the final outcome.

Four Dimensions of Trajectory Evaluation

DimensionQuestion AnsweredScoring Approach
Tool Selection AccuracyDid the agent invoke the required tools (and avoid forbidden ones)?Set / sequence assertion against expected tool list
Argument FidelityWere dates, IDs, filters, and units grounded in user input?Deterministic predicate check on tool arguments
EfficiencyDid it finish within an acceptable step and token budget?Step count & cost threshold assertions
Outcome GroundednessDoes the final answer match the actual tool outputs?Claim check against observed tool payloads

Deterministic Mock Sandboxes for CI

Never run CI agent evaluations against live production third-party APIs. Build a deterministic mock tool harness that returns realistic fixtures (including empty results, partial pagination, and transient errors) so you can verify how the agent behaves under both happy paths and failure modes.

ts
export interface AgentTrajectoryAssertion {
  requiredTools: string[];
  forbiddenTools?: string[];
  maxSteps: number;
  verifyArgs?: (calls: RecordedToolCall[]) => boolean;
}

export function scoreTrajectory(
  calls: RecordedToolCall[],
  spec: AgentTrajectoryAssertion
): { passed: boolean; failures: string[] } {
  const failures: string[] = [];
  const calledNames = new Set(calls.map(c => c.name));

  for (const req of spec.requiredTools) {
    if (!calledNames.has(req)) failures.push(`Missing required tool: ${req}`);
  }
  for (const bad of spec.forbiddenTools ?? []) {
    if (calledNames.has(bad)) failures.push(`Called forbidden tool: ${bad}`);
  }
  if (calls.length > spec.maxSteps) {
    failures.push(`Exceeded maxSteps (${calls.length} > ${spec.maxSteps})`);
  }
  if (spec.verifyArgs && !spec.verifyArgs(calls)) {
    failures.push("Tool argument predicate failed");
  }
  return { passed: failures.length === 0, failures };
}

Next: see how latency and turn-taking change when agents speak in real time in Voice and Multimodal AI Pipelines.

Бұл пайдалы болды ма?