diff --git a/frontend/src/pages/AgentsPage.tsx b/frontend/src/pages/AgentsPage.tsx
index 0a766607..c388a032 100644
--- a/frontend/src/pages/AgentsPage.tsx
+++ b/frontend/src/pages/AgentsPage.tsx
@@ -1,4 +1,5 @@
import { useEffect, useState, useCallback, useRef } from 'react';
+import ReactMarkdown from 'react-markdown';
import { toast } from 'sonner';
import { useAppStore } from '../lib/store';
import {
@@ -798,13 +799,65 @@ function AgentCard({
// Detail view — Configuration grid with editable model
// ---------------------------------------------------------------------------
+function AgentInstructionSection({ agent, onAgentUpdated }: { agent: ManagedAgent; onAgentUpdated: () => void }) {
+ const [editing, setEditing] = useState(false);
+ const [draft, setDraft] = useState('');
+ const currentInstruction = (agent.config?.instruction as string) || '';
+
+ async function save() {
+ try {
+ const newConfig = { ...(agent.config || {}), instruction: draft.trim() };
+ await updateManagedAgent(agent.id, { config: newConfig });
+ onAgentUpdated();
+ } catch { /* ignore */ }
+ setEditing(false);
+ }
+
+ return (
+
+
+
Instruction
+ {!editing && (
+
+ )}
+
+ {editing ? (
+
+ ) : (
+
+ {currentInstruction || '(No instruction set — click Edit to add one)'}
+
+ )}
+
+ );
+}
+
function AgentConfigGrid({ agent, onAgentUpdated }: { agent: ManagedAgent; onAgentUpdated: () => void }) {
const [editingModel, setEditingModel] = useState(false);
- const [editingInstruction, setEditingInstruction] = useState(false);
- const [instructionDraft, setInstructionDraft] = useState('');
const [models, setModels] = useState([]);
const currentModel = (agent.config?.model as string) || '(default)';
- const currentInstruction = (agent.config?.instruction as string) || '';
async function startEditingModel() {
try {
@@ -823,15 +876,6 @@ function AgentConfigGrid({ agent, onAgentUpdated }: { agent: ManagedAgent; onAge
setEditingModel(false);
}
- async function saveInstruction() {
- try {
- const newConfig = { ...(agent.config || {}), instruction: instructionDraft.trim() };
- await updateManagedAgent(agent.id, { config: newConfig });
- onAgentUpdated();
- } catch { /* ignore */ }
- setEditingInstruction(false);
- }
-
const rows: [string, React.ReactNode][] = [
['Intelligence', editingModel ? (