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
- Performance Metrics: The system is performing well with an average response time of 250ms
- User Engagement: Active users have increased by 15% this month
- 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:
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
Prop | Type | Default | Description |
---|---|---|---|
message | string | - | The main response message (supports markdown) |
thinking | string | - | Optional thinking process to display |
toolCalls | ToolCall[] | [] | Array of tool/function calls made |
artifacts | Artifact[] | [] | Generated artifacts (code, files, etc.) |
isStreaming | boolean | false | Shows streaming indicator |
className | string | - | Additional CSS classes |
onRegenerate | () => void | - | Callback for regenerate action |
onCopy | () => void | - | Callback for copy action |
ToolCall
Property | Type | Required | Description |
---|---|---|---|
id | string | Yes | Unique identifier |
name | string | Yes | Tool/function name |
input | any | Yes | Input parameters |
output | any | No | Output/result data |
status | "pending" | "running" | "completed" | "failed" | Yes | Current status |
duration | number | No | Execution time in ms |
Artifact
Property | Type | Required | Description |
---|---|---|---|
id | string | Yes | Unique identifier |
type | "code" | "file" | "image" | "data" | Yes | Artifact type |
name | string | Yes | File/artifact name |
content | string | Yes | Artifact content |
language | string | No | Programming language (for code) |
size | string | No | File size display |