Score Agent Tool Calls Against Expected Trajectory With Alignment

Last updated: November 29, 2026

Quick Overview

Given an expected list of tool calls and the actual calls an agent made, each a (tool_name, args) pair, compute the minimum-cost alignment using costs for missing calls, extra calls, and argument mismatches on same-name calls, and return the alignment itself.

Sierra
Coding & Algorithms
Machine Learning Engineer
Sierra
November 29, 2026
Machine Learning Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given an expected list of tool calls and the actual calls an agent made, each a (tool_name, args) pair, compute the minimum-cost alignment using costs for missing calls, extra calls, and argument mismatches on same-name calls, and return the alignment itself.

Sierra evaluates agents with simulated conversations and checks whether the agent took the right actions, in the spirit of its published tau-bench work. This question tests whether you can adapt edit distance to structured items, choose sensible costs, and reconstruct the path for debugging.

What the Interviewer Expects
  • Map the problem to weighted edit distance
  • Define a substitution cost only for same-name tools, based on argument differences
  • Fill a 2D DP table with correct base cases
  • Backtrack to produce a human-readable alignment
  • Discuss whether order should matter at all for independent calls
Key Topics to Cover
2D dynamic programming
edit distance
backtracking reconstruction
agent evaluation
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you score when some expected calls can occur in any order?
  • How would you compare argument values that are semantically equal but formatted differently, like dates?
  • How would you turn this into a single pass or fail metric for a release gate?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Operations: missing (expected call never made, cost 2), extra (agent made an unexpected call, cost 1), and match (same tool name, cost equals the fraction of argument keys whose values differ). ...

High-Level Design

Let dp[i][j] be the minimum cost to align the first i expected calls with the first j actual calls. Transitions come from dp[i-1][j] plus missing, dp[i][j-1] plus extra, and dp[i-1][j-1] plus ...


Submit Your Answer
Markdown supported

Related Questions