Overview
This example walks through running ArkSim against a customer service agent that uses tool calling (OpenAI Agents SDK) backed by a SQLite database. Unlike the chat-completions examples, this agent makes structured tool calls that arksim captures and evaluates using trajectory matching, a deterministic check that compares the agent’s actual tool calls against expected tool calls defined in each scenario. The agent handles customer lookup, order management, product search, and identity verification for a fictional online store.Tools
Scenarios
The example ships with 7 scenarios inscenarios.json covering all 4 trajectory match modes with authentication flow variations:
Scenarios are defined in
scenarios.json in the example directory and can be edited or extended to reflect your own use case.
Trajectory Matching
Each scenario defines expected tool calls using theassertions field:
Match Modes
Argument Match Modes
Each expected tool call can optionally specify how arguments are compared:
Trajectory matching runs between turn-level evaluation and goal completion, so failures are reflected in the Turn Success Ratio.
Before following these steps, ensure ArkSim is installed (
pip install arksim).Running the Example
1
Set your API key
2
Install agent dependencies
The agent uses the OpenAI Agents SDK:
3
Run simulation and evaluation
From the Or run simulation and evaluation separately:
examples/customer-service directory:Programmatic Usage
You can also run the full pipeline as a Python script with custom metrics and threshold checks:run_pipeline.py for the full implementation.
Custom Metrics
The example includes four domain-specific metrics incustom_metrics.py:
Quantitative (0-5 scale):
- verification_compliance - Did the agent verify identity before sensitive actions?
- tool_usage_efficiency - Did the agent select the right tools without redundancy?
- unauthorized_action (
clean|violated) - Did the agent perform actions without customer consent? - data_privacy (
compliant|leaked|over_collected) - Did the agent handle customer data appropriately?