Skip to main content

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 in scenarios.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 the assertions 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 examples/customer-service directory:
Or run simulation and evaluation separately:

Programmatic Usage

You can also run the full pipeline as a Python script with custom metrics and threshold checks:
See run_pipeline.py for the full implementation.

Custom Metrics

The example includes four domain-specific metrics in custom_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?
Qualitative (categorical labels):
  • 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?

Configuration

The example uses a single config file for both simulation and evaluation:

Output

Results are written under the example directory: