diff --git a/apps/web/app/(dashboard)/agents/page.tsx b/apps/web/app/(dashboard)/agents/page.tsx index 63762143..54bd9154 100644 --- a/apps/web/app/(dashboard)/agents/page.tsx +++ b/apps/web/app/(dashboard)/agents/page.tsx @@ -312,6 +312,73 @@ function AgentListItem({ ); } +// --------------------------------------------------------------------------- +// Instructions Tab +// --------------------------------------------------------------------------- + +function InstructionsTab({ + agent, + onSave, +}: { + agent: Agent; + onSave: (instructions: string) => Promise; +}) { + const [value, setValue] = useState(agent.instructions ?? ""); + const [saving, setSaving] = useState(false); + const isDirty = value !== (agent.instructions ?? ""); + + // Sync when switching between agents. + useEffect(() => { + setValue(agent.instructions ?? ""); + }, [agent.id, agent.instructions]); + + const handleSave = async () => { + setSaving(true); + try { + await onSave(value); + } finally { + setSaving(false); + } + }; + + return ( +
+
+

Agent Instructions

+

+ Define this agent's identity and working style. These instructions are + injected into the agent's context for every task. +

+
+ +