Repository navigation
Direct MCP vs Tool Search Tool vs Programmatic Tool Calling
- 일자: 2026-08-01
-
브랜치:
dev/inki-dae/code_run_tiered_bench -
run id:
run-8cf44c7a3d534c5ca9ef962d40436d7d(원본:bench-results/아래records.jsonl810행 +summary.md/summary.csv) -
모델:
gemini-3.6-flash(전 턴 동일, 레코드model_used로 확인) - 규모: 90미션 × 3모드 × 3반복 = 810턴, 에러 0 / capped 0
- 비용 주의: flash 단가가 데몬 과금표에 없어 비용($)은 미기록 — 비교는 토큰·속도 기준
MCP 서버의 툴을 어떤 방식으로 호출하게 해야 토큰을 적게 쓰고 빠른가를
프롬프트 복잡도별로 실측 비교한다. agent 턴 1회의 비용은
LLM 왕복 수 × 왕복당 재주입되는 컨텍스트로 결정되므로(LLM API는 무상태 —
매 왕복마다 시스템 프롬프트+툴 정의+누적 대화 전체가 재입력), 세 방식의
차이는 결국 "왕복 수를 어떻게 구성하느냐"의 차이다.
| 모드 | 동작 방식 | 왕복 구성 (툴 N회 호출 시) | 특징 |
|---|---|---|---|
| A. gateway search (현재 기본) |
mcp_bench_search 툴로 서버 툴을 검색(action="search")해 스키마를 받은 뒤 호출(action="call") |
1 (search) + N (call) + 1 (답변) | 툴 스키마를 런타임에 발견; search 결과가 컨텍스트에 쌓임 |
| B. code_run | 모델이 JavaScript 스크립트 작성 → QuickJS 샌드박스가 스크립트 안에서 툴 N회 호출 | 1 (스크립트) + 1 (답변) — N에 무관 | 툴 호출이 LLM 왕복을 소비하지 않음; 스크립트 작성 = 출력 토큰 |
| C. gateway direct | 툴 카탈로그 전체(90개 스키마)를 프롬프트에 선지급, search 생략하고 action="call" 직행 |
N (call) + 1 (답변) | search 왕복 제거; 카탈로그가 매 왕복 재주입됨 |
공정성 장치: 동일 argot 바이너리(--features code-harness), 모드별 격리
데몬, 차이는 [tools.code_run] enabled 한 줄과 프롬프트뿐. 프롬프트에
"MCP 서버만 사용" 제약을 주입하고 레코드로 감사(로컬 툴 우회 0건, C의
search 사용 위반 0건). B의 code_run 발화율 97.4%(263/270턴).
측정 서버는 인리포 stdio MCP 서버 bench-mcp
(crates/argot-e2e/src/bin/bench_mcp.rs) — 외부 의존 없음, 모든 데이터가
결정적 인메모리 시드 테이블(카운터 10·코드 체인 12·플래그 8·제품 24·주문
18·로그 60·그래프 10노드·설정 스냅샷 v1/v2·노드 리딩 25토픽×4노드).
각 계층 앞 5개가 코어 툴, 뒤 25개가 확장 툴이다. 아래 표는 서버의 실제
tools/list 응답에서 자동 생성했다.
| # | 툴 이름 | 입력 인자 (*=필수) | 설명 |
|---|---|---|---|
| 1 |
counter_get (코어)
|
name* |
Return the integer value of a named counter. |
| 2 |
code_lookup (코어)
|
code* |
Return the label registered for a code. |
| 3 |
flag_get (코어)
|
name* |
Return 'true' or 'false' for a named feature flag. |
| 4 |
next_code (코어)
|
code* |
Return the successor of a code in the code chain ('END' terminates). |
| 5 |
add (코어)
|
a, b
|
Add two numbers and return the sum. |
| 6 | cpu_load_get |
name* |
Return the cpu_load reading for a named node (node-a..node-d). |
| 7 | mem_free_get |
name* |
Return the mem_free reading for a named node (node-a..node-d). |
| 8 | disk_free_get |
name* |
Return the disk_free reading for a named node (node-a..node-d). |
| 9 | net_rx_get |
name* |
Return the net_rx reading for a named node (node-a..node-d). |
| 10 | net_tx_get |
name* |
Return the net_tx reading for a named node (node-a..node-d). |
| 11 | uptime_days_get |
name* |
Return the uptime_days reading for a named node (node-a..node-d). |
| 12 | temp_c_get |
name* |
Return the temp_c reading for a named node (node-a..node-d). |
| 13 | fan_rpm_get |
name* |
Return the fan_rpm reading for a named node (node-a..node-d). |
| 14 | battery_pct_get |
name* |
Return the battery_pct reading for a named node (node-a..node-d). |
| 15 | signal_dbm_get |
name* |
Return the signal_dbm reading for a named node (node-a..node-d). |
| 16 | task_count_get |
name* |
Return the task_count reading for a named node (node-a..node-d). |
| 17 | queue_len_get |
name* |
Return the queue_len reading for a named node (node-a..node-d). |
| 18 | cache_hits_get |
name* |
Return the cache_hits reading for a named node (node-a..node-d). |
| 19 | cache_misses_get |
name* |
Return the cache_misses reading for a named node (node-a..node-d). |
| 20 | err_total_get |
name* |
Return the err_total reading for a named node (node-a..node-d). |
| 21 | warn_total_get |
name* |
Return the warn_total reading for a named node (node-a..node-d). |
| 22 | req_rate_get |
name* |
Return the req_rate reading for a named node (node-a..node-d). |
| 23 | latency_ms_get |
name* |
Return the latency_ms reading for a named node (node-a..node-d). |
| 24 | jitter_ms_get |
name* |
Return the jitter_ms reading for a named node (node-a..node-d). |
| 25 | loss_pct_get |
name* |
Return the loss_pct reading for a named node (node-a..node-d). |
| 26 | fps_get |
name* |
Return the fps reading for a named node (node-a..node-d). |
| 27 | brightness_get |
name* |
Return the brightness reading for a named node (node-a..node-d). |
| 28 | volume_get |
name* |
Return the volume reading for a named node (node-a..node-d). |
| 29 | channel_get |
name* |
Return the channel reading for a named node (node-a..node-d). |
| 30 | zoom_get |
name* |
Return the zoom reading for a named node (node-a..node-d). |
| # | 툴 이름 | 입력 인자 (*=필수) | 설명 |
|---|---|---|---|
| 1 |
list_ids (코어)
|
dataset* |
List all record ids in a dataset. Datasets: 'products'. |
| 2 |
record_get (코어)
|
dataset, id
|
Fetch one record by id from a dataset. Datasets: 'products'. |
| 3 |
record_filter (코어)
|
dataset, field, op, value
|
Return records whose field matches (op: eq, ne, lt, gt, contains). Datasets: 'products'. |
| 4 |
record_sort (코어)
|
dataset, field, order, limit
|
Return records sorted by a numeric field ('asc'|'desc'), truncated to 'limit'. Datasets: 'products'. |
| 5 |
stats (코어)
|
dataset, field, where
|
Min/max/mean/sum/count of a numeric field, optionally over a filtered subset ('where': {field, op, value}). Datasets: 'products'. |
| 6 | products_price_above |
value* |
Products whose price matches (gt) the given value. |
| 7 | products_price_below |
value* |
Products whose price matches (lt) the given value. |
| 8 | products_stock_above |
value* |
Products whose stock matches (gt) the given value. |
| 9 | products_stock_below |
value* |
Products whose stock matches (lt) the given value. |
| 10 | products_price_equals |
value* |
Products whose price matches (eq) the given value. |
| 11 | products_stock_equals |
value* |
Products whose stock matches (eq) the given value. |
| 12 | products_in_region |
value* |
Products whose region matches (eq) the given value. |
| 13 | products_in_category |
value* |
Products whose category matches (eq) the given value. |
| 14 | products_name_contains |
value* |
Products whose name matches (contains) the given value. |
| 15 | products_id_is |
value* |
Products whose id matches (eq) the given value. |
| 16 | sum_price_in_category |
value* |
sum of product price within one category. |
| 17 | sum_stock_in_category |
value* |
sum of product stock within one category. |
| 18 | min_price_in_category |
value* |
min of product price within one category. |
| 19 | max_price_in_category |
value* |
max of product price within one category. |
| 20 | avg_price_in_category |
value* |
avg of product price within one category. |
| 21 | sum_price_in_region |
value* |
sum of product price within one region. |
| 22 | sum_stock_in_region |
value* |
sum of product stock within one region. |
| 23 | min_price_in_region |
value* |
min of product price within one region. |
| 24 | max_price_in_region |
value* |
max of product price within one region. |
| 25 | avg_price_in_region |
value* |
avg of product price within one region. |
| 26 | names_in_category |
value* |
List product name values within one category. |
| 27 | names_in_region |
value* |
List product name values within one region. |
| 28 | ids_in_category |
value* |
List product id values within one category. |
| 29 | ids_in_region |
value* |
List product id values within one region. |
| 30 | count_in_category |
value* |
List product count values within one category. |
| # | 툴 이름 | 입력 인자 (*=필수) | 설명 |
|---|---|---|---|
| 1 |
orders_query (코어)
|
region, status, customer
|
Return full orders (items and per-order revenue included), optionally filtered by region, status, or customer. |
| 2 |
sales_aggregate (코어)
|
group_by, metric
|
Aggregate orders: group_by 'region'|'customer'|'status', metric 'revenue'|'count'. Returns {group: value}. |
| 3 |
log_search (코어)
|
level, service, contains, limit
|
Search log entries by level, service, and/or message substring; 'limit' caps returned rows (matched count always reported). |
| 4 |
graph_query (코어)
|
op, from, to
|
Graph ops over nodes n1..n10: op 'neighbors' (from) or op 'path' (from, to; BFS shortest). |
| 5 |
snapshot_diff (코어)
|
a, b
|
Diff two config snapshots ('v1', 'v2'): added/removed keys and changed values. |
| 6 | orders_shipped |
(없음) | Full nested dump: orders_status = shipped. |
| 7 | orders_pending |
(없음) | Full nested dump: orders_status = pending. |
| 8 | orders_cancelled |
(없음) | Full nested dump: orders_status = cancelled. |
| 9 | orders_region_north |
(없음) | Full nested dump: orders_region = north. |
| 10 | orders_region_south |
(없음) | Full nested dump: orders_region = south. |
| 11 | orders_region_east |
(없음) | Full nested dump: orders_region = east. |
| 12 | orders_region_west |
(없음) | Full nested dump: orders_region = west. |
| 13 | orders_customer_mira |
(없음) | Full nested dump: orders_customer = mira. |
| 14 | orders_customer_jun |
(없음) | Full nested dump: orders_customer = jun. |
| 15 | orders_customer_sofia |
(없음) | Full nested dump: orders_customer = sofia. |
| 16 | orders_customer_ravi |
(없음) | Full nested dump: orders_customer = ravi. |
| 17 | orders_customer_elena |
(없음) | Full nested dump: orders_customer = elena. |
| 18 | orders_customer_kwan |
(없음) | Full nested dump: orders_customer = kwan. |
| 19 | logs_level_error |
(없음) | Full nested dump: logs_level = error. |
| 20 | logs_level_warn |
(없음) | Full nested dump: logs_level = warn. |
| 21 | logs_level_info |
(없음) | Full nested dump: logs_level = info. |
| 22 | logs_service_auth |
(없음) | Full nested dump: logs_service = auth. |
| 23 | logs_service_api |
(없음) | Full nested dump: logs_service = api. |
| 24 | logs_service_db |
(없음) | Full nested dump: logs_service = db. |
| 25 | logs_service_cache |
(없음) | Full nested dump: logs_service = cache. |
| 26 | graph_dump_nodes |
(없음) | Full nested dump: graph = nodes. |
| 27 | graph_dump_edges |
(없음) | Full nested dump: graph = edges. |
| 28 | graph_degrees |
(없음) | Full nested dump: graph = degrees. |
| 29 | snapshot_dump_v1 |
(없음) | Full nested dump: snapshot = v1. |
| 30 | snapshot_dump_v2 |
(없음) | Full nested dump: snapshot = v2. |
복잡도 = 수행에 필요한 툴 호출 수로 정의하며, 단위 테스트가 대역을
강제한다: simple 1–2콜 / medium 3–5콜 / complex 6콜 이상(반복·체인·교차
조인). complex 미션은 단일 툴로 우회할 수 없게 설계했다(예: 체인 걷기는 한
번에 한 홉만 조회 가능). 기대 정답은 서버와 같은 시드 테이블에서
프로그램으로 계산되어 드리프트가 불가능하고(파리티 테스트), 채점은 기계식
3종(정확일치/숫자/집합)이다. 프롬프트는 code_run·스크립트를 언급하지
않는다 — 방식 선택 자체가 측정 대상이다. 아래 표는 checked-in
missions.jsonl에서 자동 생성했다.
| ID | 프롬프트 (채점 형식 지시문 제외) | 필요 콜 | 채점 | 기대 정답 |
|---|---|---|---|---|
| s-001 | What is the value of the counter named alpha? | 1 | 숫자 | 17 |
| s-002 | What is the value of the counter named delta? | 1 | 숫자 | 95 |
| s-003 | What is the value of the counter named zeta? | 1 | 숫자 | 61 |
| s-004 | What is the value of the counter named theta? | 1 | 숫자 | 79 |
| s-005 | What is the value of the counter named kappa? | 1 | 숫자 | 50 |
| s-006 | What is the label of the code K-100? | 1 | 정확일치 | anchor |
| s-007 | What is the label of the code K-312? | 1 | 정확일치 | ember |
| s-008 | What is the label of the code K-247? | 1 | 정확일치 | lumen |
| s-009 | Is the feature flag telemetry enabled? Answer yes or no. | 1 | 정확일치 | yes |
| s-010 | Is the feature flag tracing enabled? Answer yes or no. | 1 | 정확일치 | no |
| s-011 | Which code directly follows K-057 in the code chain? | 1 | 정확일치 | K-448 |
| s-012 | Which code directly follows K-126 in the code chain? | 1 | 정확일치 | K-803 |
| s-013 | In the products dataset, what is the price of the product named photo-a? | 1 | 숫자 | 210 |
| s-014 | In the products dataset, what is the price of the product named pack-24v? | 1 | 숫자 | 390 |
| s-015 | In the products dataset, what is the price of the product named ai-npu? | 1 | 숫자 | 540 |
| s-016 | In the products dataset, what is the stock of the product P-14? | 1 | 숫자 | 80 |
| s-017 | In the products dataset, what is the stock of the product P-22? | 1 | 숫자 | 20 |
| s-018 | In the orders data, what is the revenue of the order O-104? | 1 | 숫자 | 1025 |
| s-019 | In the orders data, what is the revenue of the order O-115? | 1 | 숫자 | 1020 |
| s-020 | In the logs, how many entries have the level error? | 1 | 숫자 | 10 |
| s-021 | In the logs, how many entries have the level warn? | 1 | 숫자 | 13 |
| s-022 | In the graph, which nodes are direct neighbors of node n5? | 1 | 집합 | n4,n6,n7 |
| s-023 | In the graph, which nodes are direct neighbors of node n1? | 1 | 집합 | n2,n3 |
| s-024 | In the config snapshot v2, what is the value of retries? | 1 | 정확일치 | 6 |
| s-025 | In the config snapshot v2, what is the value of region? | 1 | 정확일치 | west |
| s-026 | What is the cpu_load reading of node-b? | 1 | 숫자 | 17 |
| s-027 | What is the temp_c reading of node-c? | 1 | 숫자 | 42 |
| s-028 | What is the fps reading of node-a? | 1 | 숫자 | 70 |
| s-029 | In the products dataset, how many products are in the category display? | 1 | 숫자 | 6 |
| s-030 | In the graph, how many hops is the shortest path from node n1 to node n10? | 1 | 숫자 | 4 |
| ID | 프롬프트 (채점 형식 지시문 제외) | 필요 콜 | 채점 | 기대 정답 |
|---|---|---|---|---|
| m-001 | Sum the values of the counters named alpha, beta, and gamma. | 3 | 숫자 | 67 |
| m-002 | Sum the values of the counters named delta, epsilon, and zeta. | 3 | 숫자 | 179 |
| m-003 | Sum the values of the counters named eta, theta, and iota. | 3 | 숫자 | 125 |
| m-004 | Sum the values of the counters named kappa, alpha, and iota. | 3 | 숫자 | 79 |
| m-005 | Sum the values of the counters named beta, delta, and theta. | 3 | 숫자 | 216 |
| m-006 | Starting from code K-100, follow the code chain for exactly 3 steps and report the code you land on. | 3 | 정확일치 | K-448 |
| m-007 | Starting from code K-231, follow the code chain for exactly 4 steps and report the code you land on. | 4 | 정확일치 | K-775 |
| m-008 | Starting from code K-448, follow the code chain for exactly 5 steps and report the code you land on. | 5 | 정확일치 | K-126 |
| m-009 | Look up the labels of the codes K-231, K-775, and K-919. | 3 | 집합 | breeze,frost,opal |
| m-010 | Look up the labels of the codes K-057, K-590, and K-803. | 3 | 집합 | cliff,harbor,jungle |
| m-011 | Look up the labels of the codes K-448, K-064, and K-126. | 3 | 집합 | dawn,glade,iris |
| m-012 | How many of the feature flags telemetry, cache, debug, and sandbox are enabled? | 4 | 숫자 | 2 |
| m-013 | How many of the feature flags metrics, failover, beta_ui, and tracing are enabled? | 4 | 숫자 | 2 |
| m-014 | Among the counters alpha, gamma, epsilon, and iota, what is the largest value? | 4 | 숫자 | 23 |
| m-015 | Among the counters zeta, eta, kappa, and beta, what is the largest value? | 4 | 숫자 | 61 |
| m-016 | Sum the mem_free readings of node-a, node-b, and node-c. | 3 | 숫자 | 60 |
| m-017 | Sum the net_rx readings of node-a, node-b, and node-d. | 3 | 숫자 | 85 |
| m-018 | Sum the queue_len readings of node-b, node-c, and node-d. | 3 | 숫자 | 171 |
| m-019 | In the orders data, which of the customers mira, jun, and sofia has the highest total revenue across their orders? | 3 | 정확일치 | jun |
| m-020 | In the orders data, which of the customers ravi, elena, and kwan has the highest total revenue across their orders? | 3 | 정확일치 | kwan |
| m-021 | In the logs, sum the counts of error, warn, and info entries. | 3 | 숫자 | 60 |
| m-022 | In the logs, how many error entries come from the services auth, api, and db combined? | 3 | 숫자 | 9 |
| m-023 | In the products dataset, what is the total stock across the categories battery, module, and sensor combined? | 3 | 숫자 | 651 |
| m-024 | In the products dataset, what is the sum of the prices of all products in the categories display and module combined? | 3 | 숫자 | 3465 |
| m-025 | Starting from code K-100, follow the code chain for exactly 2 steps and report the label of the code you land on. | 3 | 정확일치 | cliff |
| m-026 | Starting from code K-590, follow the code chain for exactly 2 steps and report the label of the code you land on. | 3 | 정확일치 | jungle |
| m-027 | In the orders data, sum the revenues of the orders O-101, O-105, and O-113. | 3 | 숫자 | 1650 |
| m-028 | In the orders data, sum the revenues of the orders O-102, O-106, and O-110. | 3 | 숫자 | 2540 |
| m-029 | In the graph, sum the numbers of direct neighbors of the nodes n1, n4, and n10. | 3 | 숫자 | 7 |
| m-030 | In the graph, sum the numbers of direct neighbors of the nodes n2, n5, and n9. | 3 | 숫자 | 8 |
| ID | 프롬프트 (채점 형식 지시문 제외) | 필요 콜 | 채점 | 기대 정답 |
|---|---|---|---|---|
| c-001 | Starting from code K-100, follow the code chain until you reach END. How many steps does it take? | 12 | 숫자 | 12 |
| c-002 | Starting from code K-448, follow the code chain until you reach END. How many steps does it take? | 9 | 숫자 | 9 |
| c-003 | Starting from code K-100, follow the code chain and report the last code you visit before END. | 11 | 정확일치 | K-919 |
| c-004 | Sum the values of the counters named alpha, beta, gamma, delta, epsilon, zeta. | 6 | 숫자 | 246 |
| c-005 | Sum the values of the counters named alpha, beta, gamma, delta, epsilon, zeta, eta, theta. | 8 | 숫자 | 359 |
| c-006 | Sum the values of the counters named epsilon, zeta, eta, theta, iota, kappa. | 6 | 숫자 | 259 |
| c-007 | Sum the values of all ten counters (alpha through kappa). | 10 | 숫자 | 421 |
| c-008 | Across all ten counters (alpha through kappa), what is the largest value? | 10 | 숫자 | 95 |
| c-009 | Across all ten counters (alpha through kappa), which counter holds the largest value? | 10 | 정확일치 | delta |
| c-010 | Which of the eight feature flags (telemetry, beta_ui, cache, debug, failover, metrics, tracing, sandbox) are enabled? | 8 | 집합 | telemetry,cache,failover,metrics |
| c-011 | How many of the eight feature flags (telemetry, beta_ui, cache, debug, failover, metrics, tracing, sandbox) are disabled? | 8 | 숫자 | 4 |
| c-012 | Sum the cpu_load and mem_free readings across all four nodes (node-a, node-b, node-c, node-d). | 8 | 숫자 | 176 |
| c-013 | Sum the net_rx and net_tx readings across all four nodes (node-a, node-b, node-c, node-d). | 8 | 숫자 | 248 |
| c-014 | Sum the latency_ms and jitter_ms readings across all four nodes (node-a, node-b, node-c, node-d). | 8 | 숫자 | 584 |
| c-015 | Which node has the larger sum of its cpu_load, temp_c, and fps readings: node-a or node-d? | 6 | 정확일치 | node-d |
| c-016 | Which node has the larger sum of its mem_free, fan_rpm, and volume readings: node-b or node-c? | 6 | 정확일치 | node-c |
| c-017 | Read the value of the counter gamma, then starting from code K-100 follow the code chain for exactly that many steps and report the code you land on. | 9 | 정확일치 | K-126 |
| c-018 | Read the value of the counter iota, then starting from code K-100 follow the code chain for exactly that many steps and report the code you land on. | 13 | 정확일치 | END |
| c-019 | Starting from code K-100, follow the code chain for 6 steps and report the labels of all six codes you visit, in any order. | 12 | 집합 | breeze,cliff,dawn,ember,frost,glade |
| c-020 | In the logs, which service has the most entries that are not level info? | 8 | 정확일치 | api |
| c-021 | In the orders data, what is the total revenue of all orders that contain at least one product from the battery category? | 6 | 숫자 | 7295 |
| c-022 | In the products dataset, sum the prices of the 5 products with the largest stock. | 6 | 숫자 | 490 |
| c-023 | On node-d, which of these readings is the largest: signal_dbm, task_count, cache_hits, err_total, req_rate, brightness? | 6 | 정확일치 | brightness |
| c-024 | On node-a, which of these readings is the largest: disk_free, uptime_days, battery_pct, queue_len, cache_misses, loss_pct? | 6 | 정확일치 | loss_pct |
| c-025 | In the orders data, consider every distinct product that appears in the orders of the customer jun. Sum those products' stock values from the products dataset. | 8 | 숫자 | 308 |
| c-026 | Starting from code K-231, follow the code chain for exactly 7 steps and report the label of the code you land on. | 8 | 정확일치 | iris |
| c-027 | Starting from code K-100, follow the code chain to END, looking up the label of every code you visit including K-100 itself. How many of those labels end with the letter e? | 23 | 숫자 | 3 |
| c-028 | Sum the values of all counters (alpha through kappa) whose value is greater than 40. | 10 | 숫자 | 327 |
| c-029 | In the graph, how many of the nodes n1 through n10 have exactly 2 direct neighbors? | 10 | 숫자 | 6 |
| c-030 | Sum the err_total and warn_total readings across all four nodes (node-a, node-b, node-c, node-d). | 8 | 숫자 | 512 |
| 모드 | 정확도 | 평균 총 토큰 | LLM 왕복 | 툴 콜 | 턴당 속도 |
|---|---|---|---|---|---|
| A. gateway search | 90.4% | 53,346 | 3.69 | 4.7 | 10.6초 |
| B. code_run | 95.9% | 40,890 (−23%) | 2.41 (−35%) | 1.4 | 7.9초 (−25%) |
| C. gateway direct | 92.6% | 49,347 (−7%) | 2.97 (−20%) | 4.0 | 26.2초 (+148%) |
B의 툴 콜 1.4회 = 스크립트 1~2개가 내부에서 툴 수 회를 대신 호출(내부 호출은 왕복을 소비하지 않음). C의 26.2초는 complex 구간 폭락(44.8초)이 평균을 끌어올린 것(7장에서 분해).
| 복잡도 | 모드 | 정확도 | 총 토큰 | LLM 왕복 | 속도 |
|---|---|---|---|---|---|
| simple (1–2콜) | A | 100% | 37,149 | 2.83 | 6.5초 (최속) |
| B | 100% | 42,208 | 2.53 | 8.0초 | |
| C | 100% | 32,046 (최소) | 2.00 | 10.1초 | |
| medium (3–5콜) | A | 98.9% | 45,431 | 3.26 | 8.5초 |
| B | 100% | 38,185 | 2.26 | 7.2초 | |
| C | 100% | 40,049 | 2.43 | 23.7초 | |
| complex (6+콜) | A | 72.2% | 77,459 | 4.98 | 16.6초 |
| B | 87.8% | 42,277 (−45%) | 2.46 (−51%) | 8.6초 (−48%) | |
| C | 77.8% | 75,947 | 4.49 | 44.8초 |
핵심 패턴: 복잡도가 올라갈수록 code_run의 우위가 커진다. simple은 A 최속·C 최소 토큰, medium부터 B가 전 지표 우위, complex에서는 B 압승.
- complex에서 A 4.98왕복 vs B 2.46왕복(−51%). A는 search 1회 + 툴 호출 평균 8.5회를 왕복으로 지불하고, 왕복마다 커진 컨텍스트를 다시 프리필한다 → 16.6초, 77,459 토큰. B는 "스크립트 작성 1왕복 + 답변 1왕복"이 기본형 — 툴 호출은 QuickJS 안에서 LLM 없이 수행 → 8.6초, 42,277 토큰.
- 왕복 감소가 토큰에 증폭되는 이유: 왕복 1회마다 (시스템 프롬프트 + 툴 정의 + 누적 대화)가 재입력된다. complex 캐시 읽기 A 51,684 vs B 22,214 (2.3배) — 재주입량 차이가 그대로 토큰 차이다.
- 왕복은 오류원이기도 하다: A 전용 실패 미션 5종(c-001 체인 12홉 완주, c-015·c-016 노드 비교, c-019 라벨 전수 조회, c-021 그래프 전수 조회)은 전부 다수 왕복 중 중간 결과를 잃은 케이스다. B는 같은 미션을 루프로 처리해 통과했다.
왕복 수를 2회로 통제한 턴(세 모드 모두 존재)만 비교하면 고정비가 그대로 드러난다:
| 모드 | 고정비의 정체 | 실측 근거 (810턴) | 손해 보는 구간 |
|---|---|---|---|
| B. code_run | 스크립트 본문(출력 토큰) + 스크립트·실행결과의 입력 재주입 | 출력 토큰 A 167 vs B 319 (1.9배); 왕복 2회 통제 시 턴당 비캐시 입력 A 8,355 vs B 16,114 (+7.8k) | simple(1–2콜): 왕복 절감분(2.83→2.53)이 작아 미회수 → 토큰 +14%, 속도 +23% |
| C. direct | 90툴 카탈로그(~4–5k 토큰)를 매 왕복 선지급 → 프리필 시간 증가 | 왕복당 지연: simple A 2.3초 vs C 5.0초, complex A 3.3초 vs C 10.0초 (3배); 왕복 2회 통제 시 비캐시 입력 16,452 (+8.1k) | 호출 많은 미션 전부 — complex 44.8초(A의 2.7배). 툴 수에 비례해 악화 |
| A. search | 발견용 search 왕복 1회 + search 결과(스키마)가 컨텍스트에 쌓여 재청구 | 왕복 3.69회(최다), 툴 콜 4.7회 중 search 포함; complex 캐시 읽기 51,684 (B의 2.3배) | 3콜 이상 전부 — complex에서 토큰·정확도 동반 악화 |
요약: 세 방식 모두 왕복당 고정비가 있고, 승부는 왕복 수를 줄여 그 고정비를 회수하느냐로 결정된다. B만이 왕복 수를 툴 호출 수와 분리한다.
A(search)는 C(direct)보다 총 토큰이 많고(53,346 vs 49,347) LLM 왕복도 많은데(3.69 vs 2.97) 턴당 속도는 2.5배 빠르다(10.6초 vs 26.2초). 역설처럼 보이지만, "총 토큰"과 "속도"가 서로 다른 것을 세기 때문이다.
- 총 토큰 = 비캐시 입력 + 출력 + 캐시 읽기의 합 — 청구량 관점.
- 속도 ≈ 왕복 수 × 왕복당 비캐시 입력의 프리필 시간 — 계산량 관점. 캐시에서 읽힌 토큰은 서버가 KV 캐시를 재사용하므로 과금은 되지만 프리필 계산은 거의 하지 않는다.
실측 분해 (810턴):
| 왕복 수 | 왕복당 지연 | 왕복당 비캐시 입력 | 왕복당 캐시 읽기 | |
|---|---|---|---|---|
| A | 3.69 | simple 2.3초 / medium 2.6초 / complex 3.3초 | 5,226 | 9,190 |
| C | 2.97 | simple 5.0초 / medium 9.7초 / complex 10.0초 | 8,332 | 8,208 |
- C는 왕복을 20
30% 덜 돌지만 **왕복 하나가 24배 비싸다**. 왕복 수 −20%로 왕복당 지연 +200%를 이길 수 없다. - 왕복당 지연 차이의 정체는 비캐시 입력이다. 왕복 2회로 통제한 턴에서 비캐시 입력 A 8,355 vs C 16,452(+8.1k) — 정확히 90툴 카탈로그(~4–5k 토큰) + 그 여파. C는 카탈로그를 유저 메시지 안에 선지급하는데, 미션마다 새 대화가 시작되어 프리픽스 연속성이 끊기므로 암시적 캐시에 잡히지 않고 매번 콜드 프리필된다(왕복 2회 통제 시 cache_read가 세 모드 모두 ~16.2k로 동일 = 캐시에 잡힌 것은 시스템 프롬프트·툴 정의뿐 이라는 증거).
- 반대로 A의 토큰이 많은 이유는 "싼 토큰"이 많아서다. search 왕복과 스키마 누적 재읽기 때문에 왕복 수가 가장 많고, 왕복이 많으면 같은 프리픽스를 반복해 읽어 cache_read가 커진다(complex 51.7k). 이는 청구량을 부풀리지만 KV 재사용이라 시간은 거의 들지 않는다. A는 "필요한 스키마만 search로 가져오는 대신 왕복 수를 지불"하고, C는 "왕복을 아끼는 대신 안 쓸 90개 스키마까지 매번 프리필"하는 방식이다.
| A. gateway search | C. direct | |
|---|---|---|
| 지불하는 것 | 왕복 수 (search + 스키마 누적 재읽기) | 왕복당 프리필 (카탈로그 콜드 재주입) |
| 부풀리는 지표 | 총 토큰 (싼 cache_read) | 속도 (비싼 비캐시 프리필) |
| 비용의 성격 | 청구량↑, 시간 영향 작음 | 계산량↑, 시간 직격 |
시사점: 총 토큰만으로 방식을 고르면 안 된다 — 토큰을 비캐시/캐시 버킷으로 나눠 봐야 지연을 예측할 수 있다. C를 쓰려면 카탈로그가 캐시 프리픽스에 들어가도록(시스템 프롬프트 영역 이동, 명시적 컨텍스트 캐싱) 설계해야 하며, 그게 안 되는 조건에서 카탈로그 선지급은 곧 지연 폭탄이다.
| 구분 | 미션 | 건수 | 성격 |
|---|---|---|---|
| 세 모드 공통 실패 | c-009(최대 카운터 이름), c-023·c-024(6개 리딩 중 최대 이름) | A 9 / B 6~9 / C 9 | "최대값의 이름 찾기" 계열 — 방식이 아닌 모델 추론 한계. 방식 비교에는 중립 |
| A 전용 실패 | c-001, c-015, c-016, c-019, c-021 (+m-026, c-018 일부) | 17 | 다수 왕복 중 중간 결과 손실·조기 종료 — 왕복이 오류원임을 보여주는 직접 증거 |
| C 전용 실패 | c-015, c-019, c-021, c-027, c-029 일부 | 11 | A와 같은 다수-왕복 손실 패턴 (search만 없을 뿐) |
| B 전용 실패 | c-021, c-026 각 1건 | 2 | 스크립트 로직 오류 |
- 방식 선택의 결정 변수는 "태스크가 요구하는 툴 호출 수"다. 툴 자체의 입출력 복잡도보다 호출 횟수가 토큰·속도를 지배한다.
- 1–2콜 태스크는 직접 호출이 최적. code_run은 고정비만 낸다(A 최속 6.5초, C 최소 토큰 32k).
- 3콜부터 code_run 우위, 6콜 이상에서 압도적. complex: 토큰 −45%, 왕복 −51%, 속도 −48%, 정확도 +15.6%p — 네 지표가 같은 방향.
- code_run만이 "왕복 수 ∝ 툴 호출 수"의 사슬을 끊는다. A·C는 호출 1회 = 왕복 1회라 태스크 복잡도에 선형으로 악화되지만, B는 왕복이 2회 근처에 고정된다(2.26~2.53).
- 왕복은 비용이자 오류원이다. 왕복이 5회에 근접하면 정확도가 90% 아래로 무너진다(A complex 72.2%).
| # | 액션 | 근거 수치 (810턴) | 기대 효과 |
|---|---|---|---|
| 1 | 복잡도 기반 라우팅: 예상 1–2콜은 gateway 직행, 3콜 이상은 code_run 유도 (툴 설명 정책 조정) | simple: A 6.5초 vs B 8.0초 / medium부터 B 전 지표 우위 / complex: B 속도 −48% | 구간별 최적 방식 자동 선택 |
| 2 | code_run 고정비 절감: 스크립트·결과 재주입 축소, 툴 정의 압축 | 왕복 2회 통제 시 B 비캐시 입력 +7.8k/턴, 출력 1.9배 | simple 구간 패널티 완화 |
| 3 | "최대값 이름 찾기" 계열 추론 실패 대응: 스크립트에 중간 검증(정렬·재확인) 유도 | c-009·c-023·c-024는 세 방식 공통 실패(27턴) | B complex 정확도 87.8% → 95%+ |
| 4 | direct 방식은 소형 툴 표면 전용으로 한정 (카탈로그 캐싱 없이는 확장 금지) | C 왕복당 지연이 A의 2~3배, 비캐시 입력 +8.1k/턴 | C 오용으로 인한 지연 폭주 방지 |
1번이 최우선 — 프롬프트/툴 설명 정책 변경만으로 적용 가능하고, 본 하네스로 효과를 회귀 측정할 수 있다.
cargo build --release --features code-harness
cargo build -p argot-e2e --bin bench-mcp
ARGOT_BIN=target/release/argot cargo run -p argot-e2e -- bench \
--modes a,b,c --reps 3 --out bench-results- 레코드 필드(턴당 1행): 미션 ID·모드·상태·토큰 4버킷·LLM 왕복·툴 콜· code_run 발화·search 사용·wall-clock — 본 문서의 모든 수치를 재검증 가능.
- 상세 실행법·플래그:
project/docs/code-run-benchmark.md. - 측정 한계: gemini-3.6-flash 단일 모델 실측 — 타 모델은 code_run 스크립트 1회 성공률에 따라 손익분기점이 이동하므로 동일 하네스로 재측정 필요. 미션은 결정적 조회 태스크로 한정(쓰기·부작용 툴 미포함). flash 단가 부재로 비용($) 미기록.