affectUI › Screens › App screens

Agent / Tool Calls

One agent and the tools it can call, as an org chart – see which one it calls right now, solve what failed, pause or connect tools, and every call below with what went in and came back.

Part of affectUI Pro. Install: npx shadcn@latest add https://www.affectui.com/r/agent-tool-calls.json · Import from @/components/ui/agent-tool-calls

When to use

  • Showing what one agent can do and what it did – its tools under it as an org chart, and every call it made with its input and output
  • Debugging an agent's tool use: which tool is slow, which one fails, what it was called with and what came back
  • Letting people decide per tool whether the agent may call it on its own, has to ask first, or not at all

When not to use

  • Many agents handing work to each other – use Agent / Orchestration
  • One run as bars on a time axis – use Trace Waterfall
  • Permissions for a whole workspace – use Agent / Permissions

Usage

import { AgentToolCallsScreen } from "@/components/ui/agent-tool-calls";

export default function Page() {
  return (
    <AgentToolCallsScreen
      agent={agent}
      tools={agent.tools}
      calls={calls}
      now={Date.now()}
      onResolve={(call, answer) => api.answer(call.id, answer)}
      onModeChange={(tool, mode) => api.setMode(agent.id, tool.id, mode)}
      onNavigate={(label) => router.push(routes[label])}
    />
  );
}

Props

NameTypeDefaultDescription
onNavigate(label: string) => voidCalled with the label of a sidebar item
workspacestring"Northwind"The workspace in the sidebar
agent{ id; name; task; model; maker? }The agent in the middle – its pixel mark comes from its id; maker (anthropic, openai, google) picks the model's mark
tools{ id; name; fn; logo?; icon?; source; description; mode?: "auto" | "ask" | "off"; params?: { name; type; required? }[] }[]Its tools – logo is the app's own mark (any node; the sample has Chrome, a macOS folder, Notion, Stripe, Linear, Slack and Gmail), icon a Hugeicons glyph for tools without one. source is the small tag (Built-in, MCP · Notion), fn the function the model calls; mode is how it may run: on its own, after someone approves each call, or not at all
calls{ id; tool; at; ms?; status: "running" | "waiting" | "done" | "failed" | "rejected"; input; output?; error?; tokens?; run? }[]Every call, in any order – at is a timestamp in ms, input the arguments as an object, tokens what the result added to the agent's context. A running call counts up; a waiting one can be approved or rejected in its panel
nownumberToday, 09:41What now is when the screen opens – times, "today" and the time range are counted from it
livebooleantrueWhether the clock runs on – running calls count up; with the sample data the agent keeps making calls
defaultRange"today" | "7d" | "30d""today"The time range in the path – cards, numbers and the table count the calls in it
onSelect(selection: { kind: "agent" | "tool" | "call"; id } | null) => voidCalled when the agent, a tool or a call opens on the right, and with null when it closes
onResolve(call, answer: "approve" | "reject") => voidAn answer to a call that waits for you
onModeChange(tool, mode: "auto" | "ask" | "off") => voidA tool's access changed in its panel – Allowed (auto), Ask first (ask) or Paused (off)
onDisconnect(tool) => voidDisconnect at the foot of a tool's panel, after a second click to confirm – the card and its line go, its calls stay in the table
onAddTool() => voidConnect tool – at the top right, in the agent's panel and in the empty state
onPause(paused: boolean) => voidPause agent and Resume
loadingbooleanGray cards where the agent and its tools land, the lines gray and still, gray rows in the table and no figures
emptybooleanAn agent without tools: its card alone with a dashed place for the first tool, and an empty table that offers Connect tool
layout"canvas" | "compact" | "org""org"org: the agent on top, its tools in two rows below it on one line, like an org chart. compact: small cards left and right of the agent. canvas: a dotted canvas to pan and zoom with full cards
classNamestringExtra class on the root

Keyboard

  • Tab: Into the chart – it's one Tab stop: the agent's card, or the card you were on
  • ← / → / ↑ / ↓: To the nearest card that way – from the agent down to its tools, along a row and between the rows
  • Home / End: To the agent, or the last tool
  • Enter: Open the card's panel, or close it again – on a call row, the call's
  • ↑ / ↓: In the table: from call to call – the table is one Tab stop; on its top edge, make it taller or shorter
  • Esc: Close the picker or the panel – the focus goes back where it came from
  • Alt / ←: layout="canvas" only: pan with Alt and the arrows, + and - to zoom, ⇧1 to fit

Accessibility

  • Cards are a list with their name, source, state, mode and numbers read out; the table names every call with its time, tool, status, duration and input
  • Tabs, the mode switch and the time range menu follow their ARIA patterns; the panel is a region, on a phone a modal sheet that keeps the focus inside
  • Rings show for the keyboard only – rows and options inside the panels get them inside their edge

Responsive

  • The tools sit in two rows; when the room runs short they wrap, and the line runs down between two cards to the next row
  • The table takes up to half the screen – drag its top edge like a sidebar; the chart keeps the rest and stays centred in it
  • Narrower screens drop the run column, then the tokens; on phones the table keeps time, tool, status and duration, the buttons turn into icons and the panel becomes a sheet from the bottom
  • Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"

Requirements

  • React 19
  • @hugeicons/react
  • @hugeicons/core-free-icons
  • App Shell (installed with it)

Related

  • Agent / Orchestration – A live multi-agent run as a tree on a canvas – watch work flow to the running agents, follow every call in the trace below and open an agent for its tasks, context and cost
  • AI Chat / Run – One autonomous agent run: the plan ticking through its steps, the tool calls, an approval it waits on and the draft it wrote
  • Agent / Permissions – What your agent may do without asking – one choice on top (Careful, Balanced, Hands-off) said in plain words, the apps it works in, the red lines that always ask, and each app with its actions grouped Reads, Changes, Needs care
  • Agent / Agents – Your team of agents in one place – calm cards with each agent's pixel mark, role, status tag and the apps it may use, its model, runs and spend; an agent opens on the right with its runs, instructions, skills, apps and recent tasks, and New agent draws the mark as you type