• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
drewmcdonald

drewmcdonald

promptCompare

Public
Like
promptCompare
Home
Code
7
.claude
3
backend
2
docs
1
frontend
4
shared
.mcp.json
deno.json
Environment variables
2
Branches
1
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
.claude
/
skills
/
ai-elements
/
references
/
agent.md
Code
/
.claude
/
skills
/
ai-elements
/
references
/
agent.md
Search
…
Viewing readonly version of main branch: v137
View latest version
agent.md

Agent

A composable component for displaying AI agent configuration with model, instructions, tools, and output schema.

The Agent component displays an interface for showing AI agent configuration details. It's designed to represent a configured agent from the AI SDK, showing the agent's model, system instructions, available tools (with expandable input schemas), and output schema.

See scripts/agent.tsx for this example.

Installation

npx ai-elements@latest add agent

Usage with AI SDK

Display an agent's configuration alongside your chat interface. Tools are displayed in an accordion where clicking the description expands to show the input schema.

Create val
"use client"; import { tool } from "ai"; import { z } from "zod"; import { Agent, AgentContent, AgentHeader, AgentInstructions, AgentOutput, AgentTool, AgentTools, } from "@/components/ai-elements/agent"; const webSearch = tool({ description: "Search the web for information", inputSchema: z.object({ query: z.string().describe("The search query"), }), }); const readUrl = tool({ description: "Read and parse content from a URL", inputSchema: z.object({ url: z.string().url().describe("The URL to read"), }), }); const outputSchema = `z.object({ sentiment: z.enum(['positive', 'negative', 'neutral']), score: z.number(), summary: z.string(), })`; export default function Page() { return ( <Agent> <AgentHeader name="Sentiment Analyzer" model="anthropic/claude-sonnet-4-5" /> <AgentContent> <AgentInstructions> Analyze the sentiment of the provided text and return a structured analysis with sentiment classification, confidence score, and summary. </AgentInstructions> <AgentTools> <AgentTool tool={webSearch} value="web_search" /> <AgentTool tool={readUrl} value="read_url" /> </AgentTools> <AgentOutput schema={outputSchema} /> </AgentContent> </Agent> ); }

Features

  • Model badge in header
  • Instructions rendered as markdown
  • Tools displayed as accordion items with expandable input schemas
  • Output schema display with syntax highlighting
  • Composable structure for flexible layouts
  • Works with AI SDK Tool type

Props

<Agent />

PropTypeDefaultDescription
...propsReact.ComponentProps<-Any props are spread to the root div.

<AgentHeader />

PropTypeDefaultDescription
namestringRequiredThe name of the agent.
modelstring-The model identifier (e.g.
...propsReact.ComponentProps<-Any other props are spread to the container div.

<AgentContent />

PropTypeDefaultDescription
...propsReact.ComponentProps<-Any other props are spread to the container div.

<AgentInstructions />

PropTypeDefaultDescription
childrenstringRequiredThe instruction text.
...propsReact.ComponentProps<-Any other props are spread to the container div.

<AgentTools />

PropTypeDefaultDescription
...propsReact.ComponentProps<typeof Accordion>-Any other props are spread to the Accordion component.

<AgentTool />

PropTypeDefaultDescription
toolToolRequiredThe tool object from the AI SDK containing description and inputSchema.
valuestringRequiredUnique identifier for the accordion item.
...propsReact.ComponentProps<typeof AccordionItem>-Any other props are spread to the AccordionItem component.

<AgentOutput />

PropTypeDefaultDescription
schemastringRequiredThe output schema as a string (displayed with syntax highlighting).
...propsReact.ComponentProps<-Any other props are spread to the container div.
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.