Agent Response

A comprehensive component for displaying AI agent responses with support for thinking process, tool usage, artifacts, and interactive actions.

Features

  • Rich Message Display: Full markdown support with syntax highlighting
  • Thinking Process: Collapsible view of the agent's reasoning
  • Tool Call Visualization: Shows function calls with inputs/outputs
  • Artifact Display: Renders generated code, files, and data
  • Streaming Support: Visual indicator for streaming responses
  • Interactive Actions: Regenerate and copy functionality
  • Responsive Design: Adapts to different screen sizes

Examples

Basic Response

A simple agent response with markdown formatting and action buttons.

I've analyzed your request and here's what I found:

Key Insights

  1. Performance Metrics: The system is performing well with an average response time of 250ms
  2. User Engagement: Active users have increased by 15% this month
  3. System Health: All services are operational with 99.9% uptime

Recommendations

Based on the analysis, I recommend:

  • Implementing caching to further reduce response times
  • Adding more interactive features to boost engagement
  • Setting up automated monitoring for critical services

Let me know if you need more detailed information on any of these points.

With Tool Usage

Agent response showing thinking process, tool calls, and generated artifacts.

Tool Usage:

I've successfully created the React component you requested. The component includes state management, event handlers, and proper TypeScript types.

The component is now ready to use in your application. You can import it and customize the styling as needed.

Generated Artifacts:

TodoList.tsx(2.3 KB)
import React, { useState } from 'react'

interface Todo {
  id: string
  text: string
  completed: boolean
}

export function TodoList() {
  const [todos, setTodos] = useState<Todo[]>([])
  const [input, setInput] = useState('')

  const addTodo = () => {
    if (input.trim()) {
      setTodos([...todos, {
        id: Date.now().toString(),
        text: input,
        completed: false
      }])
      setInput('')
    }
  }

  return (
    <div className="todo-list">
      <h2>My Todos</h2>
      <div className="add-todo">
        <input
          value={input}
          onChange={(e) => setInput(e.target.value)}
          placeholder="Add a new todo..."
        />
        <button onClick={addTodo}>Add</button>
      </div>
      <ul>
        {todos.map(todo => (
          <li key={todo.id}>
            {todo.text}
          </li>
        ))}
      </ul>
    </div>
  )
}

Streaming Response

Demonstrates real-time streaming with visual indicator.

Installation

npx shadcn add "https://agents-ui-kit.com/c/agent-response.json"

API Reference

AgentResponse

PropTypeDefaultDescription
messagestring-The main response message (supports markdown)
thinkingstring-Optional thinking process to display
toolCallsToolCall[][]Array of tool/function calls made
artifactsArtifact[][]Generated artifacts (code, files, etc.)
isStreamingbooleanfalseShows streaming indicator
classNamestring-Additional CSS classes
onRegenerate() => void-Callback for regenerate action
onCopy() => void-Callback for copy action

ToolCall

PropertyTypeRequiredDescription
idstringYesUnique identifier
namestringYesTool/function name
inputanyYesInput parameters
outputanyNoOutput/result data
status"pending" | "running" | "completed" | "failed"YesCurrent status
durationnumberNoExecution time in ms

Artifact

PropertyTypeRequiredDescription
idstringYesUnique identifier
type"code" | "file" | "image" | "data"YesArtifact type
namestringYesFile/artifact name
contentstringYesArtifact content
languagestringNoProgramming language (for code)
sizestringNoFile size display