All files / src/apps/user/pages/agents AgentsGrid.tsx

68.08% Statements 64/94
68% Branches 34/50
53.65% Functions 22/41
70.93% Lines 61/86

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587                                                                                                                  4x 4x             4x         4x   4x                     4x   4x 4x                     4x 8x   8x   2x   8x   8x                     8x   8x 8x       8x                     8x   8x         4x 4x   4x                                       4x 4x   4x   4x   2x     4x   4x         2x   2x                                                     4x 2x       2x         2x               2x                                                                                                                                                                   4x 2x       2x         2x                                                                                             4x                                                                                       4x                                                                                                             4x 34x     34x         34x 33x   4x         34x   33x     34x 33x                 34x     34x           34x             2x                                         2x         2x                     2x             2x                                                      
import BuiltInBadge from "@/components/badge/BuiltInBadge";
import {
  OriginBadge,
} from "@/components/owner";
import { encodeResourceId } from "@/components/detail";
import { AppearanceSwatch } from "@/components/appearance/AppearancePicker";
import { AGENT_ICON_REGISTRY } from "@/components/appearance/icons";
import {
  collectionSection,
  CreateButton,
  GenerateButton,
  ResourceCollection,
  useCollectionFilters,
} from "@/components/collection";
import {
  Agent,
  AgentRepository,
  AgentSkillset,
  AgentToolkit,
} from "@/objects/Agent";
import { isSystemManaged } from "@/objects/Doc";
import { Skill } from "@/objects/Skill";
import { Skillset } from "@/objects/Skillset";
import { Toolkit } from "@/objects/Toolkit";
import { APP_ROUTES, ROUTE_PARAMS } from "@/routes/const";
import { QUERY_KEYS } from "@/services/query_keys";
import { useApiHandler } from "@/services/useApiHandler";
import { useQuery } from "@tanstack/react-query";
import {
  Bot,
  BotMessageSquare,
  ChevronRight,
  FileText,
  FolderGit2,
  Network,
  Wrench,
} from "lucide-react";
import React, { useMemo } from "react";
import { Link } from "react-router-dom";
import { parseServerDate } from "@/util/time";
import { MCP_AVAILABLE } from "@/util/mcp";
 
export interface AgentsGridProps {
  agents: Agent[];
  loading?: boolean;
}
 
// ─── MCP servers via toolkits ─────────────────────────────────────────────
//
// Agents only ever integrate MCP servers through an attached toolkit — never
// individually — so an agent's effective servers are the union of its attached
// toolkits' members.
//
// This used to report toolkit *tools*. Built-in tools are bound to every agent
// by svc-ai, so a per-card tool count said the same thing on every card; the
// servers an agent can reach are what actually differ between them.
 
const useAgentMcpViaToolkits = (agentId: string): string[] => {
  const { getApiHandler } = useApiHandler();
 
  // Bound to explicitly typed consts: the pinned TypeScript cannot infer
  // react-query v5's return type, so `data` arrives as `any` and every callback
  // below would land as an implicit any.
  // One request per card, for servers that cannot run while MCP servers are
  // not available in this release (util/mcp.ts) — so not made at all.
  const { data: toolkitLinks } = useQuery<AgentToolkit[]>({
    queryKey: [QUERY_KEYS.GET.AGENT_TOOLKITS, agentId],
    queryFn: () => getApiHandler().agent_router.listAgentToolkits(agentId),
    enabled: MCP_AVAILABLE,
  });
  const agentToolkits: AgentToolkit[] = toolkitLinks ?? [];
 
  const { data: toolkitData } = useQuery<Toolkit[]>({
    queryKey: [QUERY_KEYS.GET.AGENT_TOOLKITS, agentId, "toolkits"],
    queryFn: async () => {
      const api = getApiHandler();
      const results = await Promise.all(
        agentToolkits.map((at) => api.toolkit_router.getById(at.toolkit_id)),
      );
      return results.filter((t): t is Toolkit => t !== null);
    },
    enabled: MCP_AVAILABLE && agentToolkits.length > 0,
  });
  const toolkitRecords: Toolkit[] = toolkitData ?? [];
 
  return useMemo(
    () => Array.from(new Set(toolkitRecords.flatMap((t) => t.mcp_server_ids))),
    [toolkitRecords],
  );
};
 
// ─── Skills via skillsets ───────────────────────────────────────────────────
//
// Agents only ever integrate skills through an attached skillset — never
// individually — so an agent's effective skills are the union of its
// attached skillsets' member skills.
 
const useAgentSkillsViaSkillsets = (agentId: string): Skill[] => {
  const { getApiHandler } = useApiHandler();
 
  const { data: skillsetLinks } = useQuery<AgentSkillset[]>({
    queryKey: [QUERY_KEYS.GET.AGENT_SKILLSETS, agentId],
    queryFn: () => getApiHandler().agent_router.listAgentSkillsets(agentId),
  });
  const agentSkillsets: AgentSkillset[] = skillsetLinks ?? [];
 
  const { data: skillsetData } = useQuery<Skillset[]>({
    queryKey: [QUERY_KEYS.GET.AGENT_SKILLSETS, agentId, "skillsets"],
    queryFn: async () => {
      const api = getApiHandler();
      const results = await Promise.all(
        agentSkillsets.map((as) => api.skillset_router.getById(as.skillset_id)),
      );
      return results.filter((s): s is Skillset => s !== null);
    },
    enabled: agentSkillsets.length > 0,
  });
  const skillsetRecords: Skillset[] = skillsetData ?? [];
 
  const skillIds: string[] = useMemo(
    () => Array.from(new Set(skillsetRecords.flatMap((s) => s.skill_ids))),
    [skillsetRecords],
  );
 
  const { data: skillData } = useQuery<Skill[]>({
    queryKey: [QUERY_KEYS.GET.AGENT_SKILLSETS, agentId, "skills", skillIds],
    queryFn: async () => {
      const api = getApiHandler();
      const results = await Promise.all(
        skillIds.map((id) => api.skill_router.getById(id)),
      );
      return results.filter((s): s is Skill => s !== null);
    },
    enabled: skillIds.length > 0,
  });
  const skills: Skill[] = skillData ?? [];
 
  return skills;
};
 
// ─── Skill chips (card body) ──────────────────────────────────────────────────
 
const AgentSkillChips: React.FC<{ agentId: string }> = ({ agentId }) => {
  const skillRecords = useAgentSkillsViaSkillsets(agentId);
 
  Eif (skillRecords.length === 0) return null;
 
  return (
    <div className="flex items-center gap-1.5 flex-wrap">
      {skillRecords.map((skill) => (
        <span
          key={skill.id}
          title={skill.description}
          className="flex items-center gap-1 px-2 py-0.5 rounded-full bg-violet-50 dark:bg-violet-900/20 border border-violet-200 dark:border-violet-800 text-violet-700 dark:text-violet-300 text-xs font-medium"
        >
          <Network className="size-3 shrink-0" />
          {skill.name}
        </span>
      ))}
    </div>
  );
};
 
// ─── Capability counts (footer) ───────────────────────────────────────────────
 
const AgentCounts: React.FC<{ agentId: string }> = ({ agentId }) => {
  const { getApiHandler } = useApiHandler();
 
  const agentMcpIds = useAgentMcpViaToolkits(agentId);
 
  const { data: agentRepositories = [] } = useQuery<AgentRepository[]>({
    queryKey: [QUERY_KEYS.GET.AGENT_REPOSITORIES, agentId],
    queryFn: () => getApiHandler().agent_router.listAgentRepositories(agentId),
  });
 
  const agentSkills = useAgentSkillsViaSkillsets(agentId);
 
  if (
    agentMcpIds.length === 0 &&
    agentRepositories.length === 0 &&
    agentSkills.length === 0
  )
    return null;
 
  return (
    <div className="flex items-center gap-3 text-xs text-gray-400 dark:text-gray-500">
      {agentMcpIds.length > 0 && (
        <span className="flex items-center gap-1">
          <Wrench className="size-3 text-amber-400 dark:text-amber-500" />
          {agentMcpIds.length} server{agentMcpIds.length !== 1 ? "s" : ""}
        </span>
      )}
      {agentRepositories.length > 0 && (
        <span className="flex items-center gap-1">
          <FolderGit2 className="size-3 text-emerald-400 dark:text-emerald-500" />
          {agentRepositories.length} repo
          {agentRepositories.length !== 1 ? "s" : ""}
        </span>
      )}
      {agentSkills.length > 0 && (
        <span className="flex items-center gap-1">
          <Network className="size-3 text-violet-400 dark:text-violet-500" />
          {agentSkills.length} skill{agentSkills.length !== 1 ? "s" : ""}
        </span>
      )}
    </div>
  );
};
 
// ─── Agent card ───────────────────────────────────────────────────────────────
 
const AgentCard: React.FC<{ agent: Agent }> = ({ agent }) => {
  const href = APP_ROUTES.USER.INFERENCE.AGENTS.id.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
  const chatHref = APP_ROUTES.USER.INFERENCE.AGENTS.chat.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
 
  const createdLabel = agent.created_at
    ? parseServerDate(agent.created_at).toLocaleDateString(undefined, {
        year: "numeric",
        month: "short",
        day: "numeric",
      })
    : null;
 
  return (
    <div className="group flex flex-col rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-sm hover:shadow-md hover:border-gray-300 dark:hover:border-gray-500 transition-all overflow-hidden">
      <Link to={href} className="flex-1 p-5 flex flex-col gap-4">
        <div className="flex items-start gap-3 min-w-0">
          <AppearanceSwatch
            registry={AGENT_ICON_REGISTRY}
            icon={agent.icon}
            accent={agent.accent}
            size="lg"
            aiGenerated={agent.is_ai_generated}
            aiLabel="AI generated agent"
            className="mt-0.5"
          />
          <div className="min-w-0 flex-1">
            <div className="flex items-center gap-1.5 min-w-0">
              <div className="text-sm font-semibold text-gray-900 dark:text-gray-100 truncate leading-snug">
                {agent.name}
              </div>
              <OriginBadge resource={agent} />
            </div>
            {createdLabel && (
              <div className="text-xs text-gray-400 dark:text-gray-500 mt-0.5">
                Created {createdLabel}
              </div>
            )}
          </div>
        </div>
 
        {agent.description ? (
          <p className="text-xs text-gray-500 dark:text-gray-400 line-clamp-2 leading-relaxed">
            {agent.description}
          </p>
        ) : (
          <p className="text-xs text-gray-300 dark:text-gray-600 italic">
            No description provided.
          </p>
        )}
 
        {agent.system_prompt && (
          <div className="flex items-start gap-1.5 rounded-lg bg-gray-50 dark:bg-gray-700/40 px-3 py-2">
            <FileText className="size-3 text-gray-300 dark:text-gray-600 shrink-0 mt-0.5" />
            <p className="text-xs text-gray-400 dark:text-gray-500 line-clamp-2 font-mono leading-relaxed">
              {agent.system_prompt}
            </p>
          </div>
        )}
 
        <AgentSkillChips agentId={agent.id} />
      </Link>
 
      <div className="flex items-center justify-between px-5 py-3 border-t border-gray-100 dark:border-gray-700/80 bg-gray-50/60 dark:bg-gray-800/40">
        <Link
          to={chatHref}
          onClick={(e) => e.stopPropagation()}
          className="flex items-center gap-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 transition-colors"
        >
          <BotMessageSquare className="size-3.5" />
          Chat
        </Link>
        <div className="flex items-center gap-3">
          <AgentCounts agentId={agent.id} />
          <Link
            to={href}
            className="flex items-center gap-1 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 transition-colors"
          >
            View
            <ChevronRight className="size-3.5" />
          </Link>
        </div>
      </div>
    </div>
  );
};
 
// ─── Built-in agent card ──────────────────────────────────────────────────────
//
// CHAINR Bot, drawn apart from the fleet: it is the platform's agent, not one
// the user built, so it gets its own section, a "Built-in" badge in place of
// a creation date, and Chat as the primary action — there is nothing on it to
// configure. No system-prompt preview or capability counts either; those say
// "this is how you set it up", which is not a question the user can act on.
 
const SystemAgentCard: React.FC<{ agent: Agent }> = ({ agent }) => {
  const href = APP_ROUTES.USER.INFERENCE.AGENTS.id.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
  const chatHref = APP_ROUTES.USER.INFERENCE.AGENTS.chat.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
 
  return (
    <div
      data-testid="system-agent-card"
      className="flex flex-col sm:flex-row sm:items-center gap-4 rounded-xl border border-indigo-200 dark:border-indigo-800/70 bg-gradient-to-br from-indigo-50/80 to-white dark:from-indigo-950/30 dark:to-gray-800 shadow-sm p-5"
    >
      <Link to={href} className="flex items-start gap-3 min-w-0 flex-1">
        <AppearanceSwatch
          registry={AGENT_ICON_REGISTRY}
          icon={agent.icon}
          accent={agent.accent}
          size="lg"
          className="mt-0.5"
        />
        <div className="min-w-0 flex-1">
          <div className="flex items-center gap-2 min-w-0 flex-wrap">
            <span className="text-sm font-semibold text-gray-900 dark:text-gray-100 truncate">
              {agent.name}
            </span>
            <BuiltInBadge size="sm" />
          </div>
          {agent.description && (
            <p className="text-xs text-gray-500 dark:text-gray-400 mt-1 leading-relaxed">
              {agent.description}
            </p>
          )}
        </div>
      </Link>
      <div className="flex items-center gap-3 shrink-0">
        <Link
          to={href}
          className="flex items-center gap-1 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 transition-colors"
        >
          About
          <ChevronRight className="size-3.5" />
        </Link>
        <Link
          to={chatHref}
          className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-gray-900 dark:bg-white text-white dark:text-gray-900 text-xs font-medium hover:opacity-80 transition-opacity"
        >
          <BotMessageSquare className="size-3.5" />
          Chat
        </Link>
      </div>
    </div>
  );
};
 
const SystemAgentRow: React.FC<{ agent: Agent }> = ({ agent }) => {
  const href = APP_ROUTES.USER.INFERENCE.AGENTS.id.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
  const chatHref = APP_ROUTES.USER.INFERENCE.AGENTS.chat.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
 
  return (
    <div className="flex items-center gap-3 px-4 py-3 border-b border-gray-100 dark:border-gray-700 last:border-0 bg-indigo-50/40 dark:bg-indigo-950/20">
      <AppearanceSwatch
        registry={AGENT_ICON_REGISTRY}
        icon={agent.icon}
        accent={agent.accent}
        size="sm"
      />
      <Link to={href} className="flex-1 min-w-0">
        <div className="flex items-center gap-1.5 min-w-0">
          <span className="text-sm font-medium text-gray-900 dark:text-gray-100 truncate">
            {agent.name}
          </span>
          <BuiltInBadge size="sm" />
        </div>
        {agent.description && (
          <div className="text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5">
            {agent.description}
          </div>
        )}
      </Link>
      <Link
        to={chatHref}
        className="flex items-center gap-1 text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 transition-colors shrink-0"
      >
        <BotMessageSquare className="size-3.5" />
        <span className="hidden sm:inline">Chat</span>
      </Link>
    </div>
  );
};
 
// ─── Agent row ────────────────────────────────────────────────────────────────
 
const AgentRow: React.FC<{ agent: Agent }> = ({ agent }) => {
  const href = APP_ROUTES.USER.INFERENCE.AGENTS.id.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
  const chatHref = APP_ROUTES.USER.INFERENCE.AGENTS.chat.replace(
    ROUTE_PARAMS.AGENT.id,
    encodeResourceId(agent.id),
  );
 
  return (
    <div className="flex items-center gap-3 px-4 py-3 border-b border-gray-100 dark:border-gray-700 last:border-0 hover:bg-gray-50 dark:hover:bg-gray-700/40 transition-colors group">
      <AppearanceSwatch
        registry={AGENT_ICON_REGISTRY}
        icon={agent.icon}
        accent={agent.accent}
        size="sm"
        aiGenerated={agent.is_ai_generated}
        aiLabel="AI generated agent"
      />
      <Link to={href} className="flex-1 min-w-0">
        <div className="flex items-center gap-1.5 min-w-0">
          <div className="text-sm font-medium text-gray-900 dark:text-gray-100 truncate">
            {agent.name}
          </div>
          <OriginBadge resource={agent} />
        </div>
        {agent.description ? (
          <div className="text-xs text-gray-400 dark:text-gray-500 truncate mt-0.5">
            {agent.description}
          </div>
        ) : (
          <div className="text-xs text-gray-300 dark:text-gray-600 italic mt-0.5">
            No description.
          </div>
        )}
      </Link>
      <div className="flex items-center gap-2 shrink-0">
        <AgentCounts agentId={agent.id} />
        <Link
          to={chatHref}
          onClick={(e) => e.stopPropagation()}
          className="flex items-center gap-1 text-xs text-gray-400 dark:text-gray-500 hover:text-gray-900 dark:hover:text-gray-100 transition-colors opacity-0 group-hover:opacity-100"
        >
          <BotMessageSquare className="size-3.5" />
          <span className="hidden sm:inline">Chat</span>
        </Link>
        <ChevronRight className="size-3.5 text-gray-300 dark:text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity" />
      </div>
    </div>
  );
};
 
// ─── AgentsGrid ───────────────────────────────────────────────────────────────
 
const AgentsGrid: React.FC<AgentsGridProps> = ({ agents, loading }) => {
  const collection = useCollectionFilters<Record<string, never>>({
    defaults: {},
  });
  const { matches } = collection;
 
  // The API lists CHAINR Bot with the user's own agents so every agent picker
  // offers it; this page is the one place that separates them, because the
  // fleet — and its counts — is what the user built.
  const { builtIn, own } = useMemo(
    () => ({
      builtIn: agents.filter(isSystemManaged),
      own: agents.filter((a) => !isSystemManaged(a)),
    }),
    [agents],
  );
 
  const filtered = useMemo(
    () =>
      own.filter((a) => matches(a.name, a.description, a.system_prompt)),
    [own, matches],
  );
  const filteredBuiltIn = useMemo(
    () => builtIn.filter((a) => matches(a.name, a.description)),
    [builtIn, matches],
  );
 
  // The two routes the choice page offers, offered directly: with both
  // actions on the toolbar, sending "New Agent" to a page that asks
  // "generate or manual?" would be asking the question twice. The choice
  // page stays where it is for the links that reach it from elsewhere.
  const generateButton = (
    <GenerateButton to={APP_ROUTES.USER.INFERENCE.AGENTS.new_generative} />
  );
  const createButton = (
    <CreateButton
      label="New Agent"
      to={APP_ROUTES.USER.INFERENCE.AGENTS.new_manual}
    />
  );
 
  return (
    <ResourceCollection<Agent>
      description={`Agents are the fleet: an LLM with a system prompt, the ${MCP_AVAILABLE ? "skillsets and toolkits" : "skillsets"} it may call, and the knowledge repositories it answers from. Every invocation runs through the governed graph and lands in the version trail, so what an agent did is traceable to the revision that did it.`}
      stats={[
        { label: "Agents", value: own.length, loading },
        {
          label: "AI generated",
          value: own.filter((a) => a.is_ai_generated).length,
          loading,
        },
      ]}
      shown={filtered.length + filteredBuiltIn.length}
      search={{
        value: collection.search,
        onChange: collection.setSearch,
        placeholder: "Search agents…",
      }}
      {...collection.toolbarProps}
      actions={
        <>
          {generateButton}
          {createButton}
        </>
      }
      sections={[
        collectionSection<Agent>({
          label: "Built-in",
          items: filteredBuiltIn,
          itemKey: (agent) => agent.id,
          // One full-width card: the bot is an invitation to start, not a
          // peer of the fleet's cards.
          gridVariant: "full",
          skeletonCount: 1,
          renderCard: (agent) => <SystemAgentCard agent={agent} />,
          renderRow: (agent) => <SystemAgentRow agent={agent} />,
          loading,
          hideWhenEmpty: true,
          empty: { Icon: Bot, title: "No built-in agents." },
        }),
        collectionSection<Agent>({
          // Includes your organisations' and projects' agents; each shared
          // card says whose it is.
          label: "Your agents",
          items: filtered,
          itemKey: (agent) => agent.id,
          // Agents are what the Inference page is about, and an agent card
          // carries its prompt, skills, tools and knowledge counts — half a
          // row rather than a third, so it does not read as a peer of the
          // skillsets and toolkits that serve it.
          gridVariant: "wide",
          skeletonCount: 4,
          renderCard: (agent) => <AgentCard agent={agent} />,
          renderRow: (agent) => <AgentRow agent={agent} />,
          loading,
          empty: {
            Icon: Bot,
            title: "No agents of your own yet.",
            hint:
              builtIn.length > 0
                ? "CHAINR Bot is ready to chat now. When you need an agent that answers from your own documents and tools, build one field by field — or describe the problem and let the platform design it for you."
                : "Build an agent field by field — or describe the problem it should solve and let the platform design one for you.",
            dashed: true,
            action: (
              <div className="flex items-center gap-2">
                {generateButton}
                {createButton}
              </div>
            ),
          },
          emptyFilteredTitle: "No agents match your search.",
          emptyFilteredHint: "Try adjusting your search term.",
        }),
      ]}
    />
  );
};
 
export default AgentsGrid;