MCPcopy
hub / github.com/kagent-dev/kagent / AgentCard

Function AgentCard

ui/src/components/AgentCard.tsx:37–209  ·  view source on GitHub ↗
({ agentResponse, onAgentsChanged }: AgentCardProps)

Source from the content-addressed store, hash-verified

35}
36
37export function AgentCard({ agentResponse, onAgentsChanged }: AgentCardProps) {
38 const { agent, model, modelProvider, deploymentReady, accepted } = agentResponse;
39 const router = useRouter();
40 const [memoriesOpen, setMemoriesOpen] = useState(false);
41 const [deleteOpen, setDeleteOpen] = useState(false);
42
43 const agentHarness = isAgentHarness(agentResponse);
44 const harnessBackend = getAgentHarnessBackend(agentResponse);
45 const harnessRuntime = getAgentHarnessRuntime(agentResponse);
46
47 const agentRef = k8sRefUtils.toRef(
48 agent.metadata.namespace || '',
49 agent.metadata.name || ''
50 );
51
52 const isBYO = agent.spec?.type === "BYO";
53 const byoImage = isBYO ? agent.spec?.byo?.deployment?.image : undefined;
54 const isReady = accepted && deploymentReady;
55
56 const handleEditClick = (e: React.MouseEvent) => {
57 e.preventDefault();
58 e.stopPropagation();
59 router.push(`/agents/new?edit=true&name=${agent.metadata.name}&namespace=${agent.metadata.namespace}`);
60 };
61
62 const getStatusInfo = () => {
63 if (!accepted) {
64 return {
65 message: "Agent not Accepted",
66 className:"bg-red-500/10 text-red-600 dark:text-red-500"
67 };
68 }
69 if (!deploymentReady) {
70 return {
71 message: "Agent not Ready",
72 className:"bg-yellow-400/30 text-yellow-800 dark:bg-yellow-500/40 dark:text-yellow-200"
73 };
74 }
75 return null;
76 };
77
78 const statusInfo = getStatusInfo();
79
80 const cardContent = (
81 <Card className={cn(
82 "group relative transition-all duration-200 overflow-hidden min-h-[200px]",
83 isReady
84 ? 'cursor-pointer hover:border-primary hover:shadow-md'
85 : 'cursor-default'
86 )}>
87 <CardHeader className="flex flex-row items-start justify-between space-y-0 pb-2 relative z-30">
88 <CardTitle className="flex items-center gap-2 flex-1 min-w-0">
89 {agentHarness ? (
90 <span
91 className="inline-flex h-5 w-5 flex-shrink-0 items-center justify-center text-lg leading-none"
92 aria-hidden
93 title={
94 harnessBackend

Callers 1

agent.pyFile · 0.85

Calls 8

isAgentHarnessFunction · 0.90
getAgentHarnessBackendFunction · 0.90
getAgentHarnessRuntimeFunction · 0.90
cnFunction · 0.90
agentHarnessTypeLabelFunction · 0.90
agentHarnessRuntimeLabelFunction · 0.90
useRouterFunction · 0.85
getStatusInfoFunction · 0.70

Tested by

no test coverage detected