Skip to content

vivek100/AgenticGenUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgenticGenUI

AgenticGenUI Banner

AgenticGenUI is an open-source library for building AI-powered, generative user interfaces. It provides a comprehensive set of components tailored for AI agent applications, enabling developers to rapidly create interactive, production-ready UIs that seamlessly integrate with large language models or any react based apps.


🌟 Features

  • 40+ Specialized Components: Purpose-built UI components for AI agent interfaces
  • CopilotKit Integration: Seamless compatibility with CopilotKit
  • Scenario-Based Design: Tailored to real AI agent use cases
  • Fully Responsive: Desktop, tablet, and mobile support
  • Accessibility-First: Adheres to a11y best practices
  • TypeScript Support: Strong typings for all components
  • Customizable Theming: Easy branding and theming
  • Demo Application: Explore all components live

πŸ“‹ Table of Contents


πŸš€ Installation

Note: AgenticGenUI is not yet available via npm. Use Git to install directly.

# Clone the repository
git clone https://github.com/vivek100/AgenticGenUI.git

# Navigate into the project
cd AgenticGenUI

# Install dependencies
npm install

# Start development server
npm run dev

πŸ–₯️ Demo Setup

Explore the full functionality via the included demo app.

Prerequisites

  • Node.js 18.x+
  • npm 9.x+

Environment Variables

Create a .env.local file in the root:

XAI_API_KEY=your_xai_api_key_here

Note: You can run the demo app without api keys too, it has mock mode where it can use fuzzy match of input text message and render the components.

Get your API key from Grok

Run the Demo

npm run dev
# Visit http://localhost:3000

🧩 Component Overview

AgenticGenUI ships 40+ ready-to-use components:

πŸ“Š Data Visualization

  • MetricCard, Chart, DataTable, DataGrid, ExpandableRowTable

πŸ“ Forms and Inputs

  • UserForm, MultiStepForm, SearchWithFilters, DateTimeRangePicker
  • MentionInput, ColorPickerPopover

πŸ”” Notifications

  • InfoBanner, ProgressBar, ToastStack, ConfirmationCard

βœ… Project Management

  • KanbanBoard, ChecklistWithProgress, ApprovalWorkflowCard, Timeline

πŸ‘₯ Team & Users

  • AvatarCard, TeamMemberList, OrgChartViewer, ThreadedComments

πŸ›’ E-Commerce

  • ProductCatalogGrid, CartSummaryPanel, PaymentDetailsForm, OrderStatusTracker

πŸ“š Content Display

  • TabLayout, AccordionContent, MarkdownRenderer, CodeSnippetViewer, ImageGallery

πŸ€– Specialized Components

  • AIPromptBuilder, LocationMap, RoutePlannerMap, EnvironmentSwitcher
  • LanguageSelector, ThemeToggle, ModalPrompt

πŸ” Usage Examples

βœ… Basic Component Example

import { MetricCard } from './agentic-ui/components';

function Dashboard() {
  return (
    <MetricCard
      title="Active Users"
      value={1254}
      change={12.5}
      changeType="increase"
      description="Total active users in the last 30 days"
      icon="users"
    />
  );
}

🧠 With CopilotKit Integration

import { CopilotKit } from '@copilotkit/react-core';
import { AgentRenderer } from './components/agent-renderer';
import { MetricCardGrid } from './agentic-ui/components';

function App() {
  return (
    <CopilotKit apiKey="your-api-key">
      <AgentRenderer>
        <MetricCardGrid
          title="Business Overview"
          metrics={[
            {
              title: "Revenue",
              value: "$12,345",
              change: 8.2,
              changeType: "increase",
              description: "Total revenue this month",
              icon: "dollar-sign"
            },
            {
              title: "Users",
              value: "1,234",
              change: 12.5,
              changeType: "increase",
              description: "Active users this month",
              icon: "users"
            }
          ]}
        />
      </AgentRenderer>
    </CopilotKit>
  );
}

πŸ”Œ Integration Guide

1. Install CopilotKit

npm install @copilotkit/react-core @copilotkit/react-ui @copilotkit/runtime

2. Configure Layout

// app/layout.tsx
import { CopilotKit } from '@copilotkit/react-core';

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <CopilotKit apiKey={process.env.COPILOT_API_KEY} chatApiEndpoint="/api/copilotkit">
          {children}
        </CopilotKit>
      </body>
    </html>
  );
}

3. Create API Endpoint

// app/api/copilotkit/route.ts
import { createAI } from '@copilotkit/runtime';

export async function POST(req: Request) {
  const body = await req.json();
  const { messages } = body;

  const ai = createAI({ /* your AI config */ });

  const response = await ai.chat(messages);
  return new Response(JSON.stringify(response));
}

🧠 AgentRenderer Example

// components/agent-renderer.tsx
import { useChat } from '@copilotkit/react-core';
import { componentRegistry } from '../agentic-ui/registry';

export function AgentRenderer({ children }) {
  const { messages, input, handleInputChange, handleSubmit } = useChat();

  const renderAIComponents = () =>
    messages.map((message, i) => {
      if (message.role === 'assistant' && message.content) {
        try {
          const content = JSON.parse(message.content);
          const Component = componentRegistry[content.type];
          return Component ? <Component key={i} {...content.props} /> : null;
        } catch {
          return <div key={i}>{message.content}</div>;
        }
      }
      return null;
    });

  return (
    <div>
      {children}
      {renderAIComponents()}
      <form onSubmit={handleSubmit}>
        <input value={input} onChange={handleInputChange} placeholder="Ask something..." />
        <button type="submit">Send</button>
      </form>
    </div>
  );
}

🧠 System Prompt Customization

export function getSystemPrompt() {
  return `
    You are an AI that generates UI components from user requests.
    Available components include:
    
    - MetricCard
    - Chart
    - DataTable
    ...

    Respond using JSON with:
    - type: Component name
    - props: Component props

    Example:
    {
      "type": "MetricCard",
      "props": {
        "title": "Active Users",
        "value": 1254,
        "change": 12.5,
        "changeType": "increase",
        "description": "Total active users in the last 30 days",
        "icon": "users"
      }
    }
  `;
}

🀝 Contributing

We welcome contributions!

  1. Fork this repo

  2. Create a feature branch

    git checkout -b feature/your-feature-name
  3. Commit your changes

    git commit -m "Add new feature"
  4. Push your branch

    git push origin feature/your-feature-name
  5. Open a Pull Request

Contribution Tips

  • Follow the existing code style
  • Write tests for new components
  • Update documentation
  • Ensure tests pass

πŸ“„ License

AgenticGenUI is licensed under the MIT License. See LICENSE for full details.


πŸ™ Acknowledgements


Built with ❀️ by Vivek


About

Render interactive components in your chat window

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages