Agent run

An agent doing a job on the device, step by step: each tool call with its time, approval before anything risky runs, and the answer at the end.

Mock· scripted answersNo model runs in a browser, so every answer here is scripted. On a phone it comes from the model.
  • Apple Foundation Models: supported
  • Gemini Nano: not supported
  • Llama (not yet supported): not supported
  • A cloud model: supported
  • Tool calling runs on Apple's model or a cloud model. Gemini Nano's tool calling is still an alpha preview, so Ondai does not route tools to it yet.

Install

npx ondai add agent-run

Usage

import { AgentRun } from '@/components/ondai/agent-run'
import { tool } from '@ondai/core'
import { z } from 'zod'

<AgentRun
  goal="Find a quiet dinner spot near Priya’s office on Friday and invite her"
  tools={{ searchPlaces, checkCalendar, createEvent }}
  meta={{ createEvent: { title: 'Create the event and invite Priya', policy: 'ask', risk: 'medium' } }}
/>
  • Tools with policy: 'ask' stop at an approval card before they run.
  • Built on useToolAgent(); Apple and Gemini Nano run the tool loop on device.

Customize

Every AI component takes the same look and customization props, so it fits your app rather than ours.

<AgentRun
  variant="pop"
  tint="#FF5A5F"
  size="lg"
  radius={12}
  icons={{ run: Search, again: null }}
  labels={{ run: '…', cancel: '…' }}
/>
PropWhat it does
variantThe look of the whole component: clean, minimal, glass, pop, candy, metal, shine
sizesm, md, lg; type, rows, icons and keys scale together
tintAny colour; the variant paints its keys, tiles and glow in it
radiusCorner radius of the container
iconsReplace any icon (a lucide component, an element, or null to hide it): run, again, stepDone, stepRunning, stepError, stepCancelled, answer
labelsEvery visible and spoken string; defaults are exported as agentRunLabels: run, cancel, runAgain, idle, planning, nextStep, refusal, stopped
SlotsDraw a part yourself: renderStep, renderConfirm, renderAnswer, renderIdle, renderActions
stylesStyle any named part

Variants

PropOptions
variantclean, minimal, glass, pop, candy, metal, shine
presentationcard, plain
sizesm, md, lg

Fallback

When no provider is ready the component renders the unavailable state (AvailabilityGate copy) and, where a deterministic path exists, keeps working without the model.

Eval score

No model-driven fixtures for this component.

Files

Registry dependencies: button, on-device-badge, shimmer-text, surface, tool-confirm-card

npm dependencies: @ondai/core, @ondai/tokens, lucide-react-native, react-native-reanimated

On this page