diff --git a/backend/models.py b/backend/models.py index c7009a3..98c00a1 100644 --- a/backend/models.py +++ b/backend/models.py @@ -8,6 +8,12 @@ class Agent(BaseModel): runtime: str = "?" model: str = "?" healthy: bool = True + cpu: float = 0 + active_runs: int = 0 + tokens_used: int = 0 + tokens_limit: int = 100000 + budget_used: float = 0 + budget_limit: float = 50 class AgentUpdate(BaseModel): status: Literal["online", "offline", "busy"] diff --git a/frontend/src/components/agents/AgentCard.tsx b/frontend/src/components/agents/AgentCard.tsx index 62c9c03..493a36a 100644 --- a/frontend/src/components/agents/AgentCard.tsx +++ b/frontend/src/components/agents/AgentCard.tsx @@ -1,20 +1,24 @@ import { motion } from 'framer-motion' -import { Cpu, Activity, Zap } from 'lucide-react' -import { Badge } from '@/components/ui/badge' +import { Cpu, Activity, Zap, Wallet } from 'lucide-react' +import { Progress } from '@/components/ui/progress' export function AgentCard({ agent }: { agent: any }) { const statusColor = { online: 'bg-emerald-500', busy: 'bg-amber-500', offline: 'bg-zinc-500', - }[agent.status] || 'bg-zinc-500' + }[agent.status] || 'bg-emerald-500' + + const tokenPercent = Math.round((agent.tokens_used / agent.tokens_limit) * 100) + const budgetPercent = Math.round((agent.budget_used / agent.budget_limit) * 100) return ( -
+ {/* Header */} +
@@ -22,10 +26,11 @@ export function AgentCard({ agent }: { agent: any }) {
{agent.runtime} ยท {agent.model}
- {agent.status} +
{agent.status}
-
+ {/* Main metrics */} +
@@ -33,16 +38,42 @@ export function AgentCard({ agent }: { agent: any }) {
CPU %
-
-
{agent.activeRuns}
+
{agent.active_runs || agent.activeRuns}
RUNS
+ {/* Per-agent Usage Limits */} +
+
+
+ + Tokens + + + {agent.tokens_used?.toLocaleString()} / {agent.tokens_limit?.toLocaleString()} + +
+ +
+ +
+
+ + Budget + + + ${agent.budget_used} / ${agent.budget_limit} + +
+ +
+
+