| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /*
- * Derived from vercel/ai-elements (skills/ai-elements/scripts/agent.tsx).
- * Copyright 2023 Vercel, Inc. Licensed under Apache-2.0.
- * Modified by ZCode: local integration, formatting and adaptations.
- * See THIRD-PARTY-NOTICES.md in the repository root for license and provenance.
- */
- "use client";
- import {
- Agent,
- AgentContent,
- AgentHeader,
- AgentInstructions,
- AgentOutput,
- AgentTool,
- AgentTools,
- } from "@/components/ai-elements/agent";
- import { z } from "zod";
- const webSearchTool = {
- description: "Search the web for information",
- inputSchema: z.object({
- query: z.string().describe("The search query"),
- }),
- };
- const readUrlTool = {
- description: "Read and parse a URL",
- inputSchema: z.object({
- url: z.string().url().describe("The URL to read"),
- }),
- };
- const summarizeTool = {
- description: "Summarize text into key points",
- inputSchema: z.object({
- maxPoints: z.number().optional().describe("Maximum number of key points"),
- text: z.string().describe("The text to summarize"),
- }),
- };
- const outputSchema = `z.object({
- sentiment: z.enum(['positive', 'negative', 'neutral']),
- score: z.number(),
- summary: z.string(),
- })`;
- const Example = () => (
- <Agent>
- <AgentHeader model="openai/gpt-5.2-pro" name="Research Assistant" />
- <AgentContent>
- <AgentInstructions>
- You are a helpful research assistant. Your job is to search the web for information and
- summarize findings for the user. Always cite your sources and provide accurate, up-to-date
- information.
- </AgentInstructions>
- <AgentTools type="multiple">
- <AgentTool tool={webSearchTool} value="web_search" />
- <AgentTool tool={readUrlTool} value="read_url" />
- <AgentTool tool={summarizeTool} value="summarize" />
- </AgentTools>
- <AgentOutput schema={outputSchema} />
- </AgentContent>
- </Agent>
- );
- export default Example;
|