* Patch an existing agent with partial updates * PATCH /api/agents/{agentId}
(
agentId: string,
data: Record<string, unknown>,
)
| 107 | * PATCH /api/agents/{agentId} |
| 108 | */ |
| 109 | async patch( |
| 110 | agentId: string, |
| 111 | data: Record<string, unknown>, |
| 112 | ): Promise<AgentResponse> { |
| 113 | const response = await fetch(`${API_BASE}/agents/${agentId}`, { |
| 114 | method: "PATCH", |
| 115 | headers: { |
| 116 | "Content-Type": "application/json", |
| 117 | }, |
| 118 | body: JSON.stringify(data), |
| 119 | }); |
| 120 | if (!response.ok) { |
| 121 | const errorData = await response.json().catch(() => ({})); |
| 122 | throw new Error( |
| 123 | errorData.detail || `Failed to update agent: ${response.statusText}`, |
| 124 | ); |
| 125 | } |
| 126 | return response.json(); |
| 127 | }, |
| 128 | |
| 129 | /** |
| 130 | * Upload an image for use as agent picture |