"use client"; import { CopilotKit, useCoAgent, useCoAgentStateRender, } from "@copilotkit/react-core"; import { CopilotSidebar } from "@copilotkit/react-ui"; import "@copilotkit/react-ui/styles.css"; import StateDisplay from "./StateDisplay"; interface ResearchState { question: string; status: string; current_iteration: number; max_iterations: number; confidence: number; plan: Array>; findings: Array>; final_report: Record | null; } function AgentContent() { // Use useCoAgent to sync state with the backend research agent const { state } = useCoAgent({ name: "research_agent", initialState: { question: "", status: "idle", current_iteration: 0, max_iterations: 2, confidence: 0.0, plan: [], findings: [], final_report: null, }, }); // Render state updates from the research agent useCoAgentStateRender({ name: "research_agent", render: ({ state: newState }) => { return (
Research Update: Status: {newState.status}, Iteration: {newState.current_iteration}/{newState.max_iterations}, Confidence: {(newState.confidence * 100).toFixed(0)}%
); }, }); return (

Haiku.rag Research Assistant

Interactive research powered by Haiku.rag,{" "} Pydantic AI, and AG-UI

); } export default function Agent() { return ( ); }