Tool call

Shows one tool an agent called in a run.

Tool

    1. count
      1,204,880

    querydefault

    1. 12:04:01  Running transform 1.8.2
      12:04:03  1 of 1 START sql table model events_daily
      12:04:05  1 of 1 OK created sql table model events_daily
      12:04:05  Done. PASS=1 WARN=0 ERROR=0

    shell

    http

    1. Tag partitionwh_events.events_raw210msDoneDone

    any other tool

List

    1. Write partitionswh_events.events_rawWriting

    a run

States

    1. Write partitionswh_events.events_rawPreparing write

    pending

    1. Write partitionswh_events.events_rawWriting

    running

    1. Write partitionswh_events.events_raw3.2sDoneDone

    completed

    1. permission denied for schema wh_events
      role etl_writer lacks INSERT on events_raw

    failed

    1. Scale pool-a to 96 workers?

      Doubles the pool for the backfill. It costs about $14 an hour until it scales back.

      scale pool-a 48 -> 96 workers

    awaiting permission

    denied

    1. Write partitionswh_events.events_raw900msStoppedStopped

    stopped

    1. Unknown900msOrphaned resultOrphaned result

    orphaned

Usage

When to use it
Use
An agent calls tools inside a run and the person should see what each asked for and what came back.
Use
A call is paused for the person's approval, or was refused or stopped.
Not for
Steps you draw yourself, with no events behind them. Use Tool-call row.
Not for
One live line for the whole run. Use Activity.

Rules

8 rules
Must
Give every event a per-call seq and dispatch all of them through toolCallsReducer (useToolCalls). Because a plain setState applies a late running event over completed, so a finished call runs again.
Must
Send status: 'completed' or 'error' explicitly when a tool ends. Because the reducer reads a result with no status as an error, so a call that worked shows Failed.
Must
Dispatch {type: 'stop', gen} before the network cancel returns, and open the next turn with a newer gen. Because events that arrive while the cancel is awaited keep rows running, and reusing the stopped gen drops the next turn.
Must
Pass onReply for a waiting call and put what allowing does in permission.message. Because the row then shows the question, that sentence and the exact patterns over Deny and the one Allow; without the sentence the person decides blind.
Never
Make Deny a primary or a destructive in custom actions; Deny is variant="secondary" and Allow the primary. Because saying no loses nothing, and two slabs in one approval split the eye.
Must
Use status: 'denied' with the person's words as reason for a refused call; never status: 'error'. Because a refusal is the person's choice, and as an error it turns the row red and reads as a failed run.
Must
Put a run's calls in a ToolCallList, with hideCompleted to hide finished ones. Because the list is one stack with connectors, keeps waiting and failed calls in view and holds back an orphaned result.
Should
Call registerTool(name, words, aliases) once at module scope for a product tool, with its verb, -ing words and noun. Because every row, tab and approval reads its words from the registry, and a label per call site drifts.

Accessibility

4 checks
A call with a body has a button header with aria-expanded, named by its label, detail, state word and time.
Every status has a word; the pending mark is aria-hidden and a running call sets aria-busy.
The approval is a group named by its question; Deny comes before Allow in the tab order.
A result before its call waits 2s, then shows as Orphaned result, never Done.

Keyboard

1 key
Enter, Space
Opens or closes the body; in an approval, presses Deny or Allow.

Edge cases

5 edge cases
Failed or waiting call
Opens on its error or its question the moment it arrives.
Long output
A shell shows 24 lines, others 8, then Show all; 20,000 characters at most, with the cut said.
ANSI colours or a progress bar
Escapes are stripped, and a carriage return keeps the last frame.
Duplicate or late events
Dropped and counted; a stale stop never cancels the next turn.
Unknown tool
Its name in sentence case is the label and its first useful argument the detail.

API

9 props
call
ToolCallData default required
onReply
(reply: 'once' | 'reject') => void
actions
ReactNode
label, detail
string default from the registry
children
ReactNode
labels
ToolCallLabels default English
ToolCallList calls, hideCompleted, orphanTtl, onReply, actions
list props default orphanTtl: 2000
useToolCalls(initial)
[state, dispatch]
registerTool(name, words, aliases)
function

Tokens

18 tokens
--row
40px
--well
#f4f3ee
--line-faint
#efede6
--fail
#b3261e
--fail-text
#b3261e
--fail-tint
#fdecea
--warn
#c25e00
--warn-text
#a14b00
--warn-tint
#fdeee0
--selected
#fff4bf
--text-1
#161512
--text-2
#55524a
--text-3
#6b675e
--type-code-sm
400 12px/16px var(--font-mono)
--type-body-sm
400 14px/20px var(--font-sans)
--type-caption
400 13px/18px var(--font-sans)
--popup-max
320px
--measure-hint
60ch

Install

For your coding agent

GitHub

Please star me pookie

198

A new design system every week

Leave your email before you copy the prompt.