Docs / built-apps / updateSiteAgent

updateSiteAgent

utilitysince 0.2.7not for built apps

Client function: patch an existing site agent persona — only the fields you send change.

import { updateSiteAgent } from 'flowstack-sdk'

Non-React client function. PATCH /api/v1/sites/{siteId}/agents/{name}. The safe counterpart to upsertSiteAgent: unsent fields are preserved. The persona name is the URL key and cannot be patched.

Signature

updateSiteAgent(credentials, siteId, name, patch, config?): Promise<ApiResponse<{ site_id: string; agent: SiteAgent }>>

Parameters

ParamTypeNotesDescription
credentialsFlowstackCredentialsrequiredThe app owner's credentials (owner-scoped JWT).
siteIdstringrequiredThe site/app id.
namestringrequiredThe persona to patch (URL-encoded into the path).
patchPartial<Omit<SiteAgentInput, 'name'>>requiredOnly the fields to change. name is excluded by the type — rename is not supported.
configFlowstackClientConfigClient config (baseUrl, tenantId as needed).

Returns

FieldTypeDescription
Promise<ApiResponse<{ site_id: string; agent: SiteAgent }>>The persona after the patch.

Examples

Pin a model
await updateSiteAgent(credentials, siteId, 'coach', { model: 'claude-sonnet-4-6' });
Clear the model pin
// Empty string clears the pin — omitting `model` would leave it in place.
await updateSiteAgent(credentials, siteId, 'coach', { model: '' });
WarningOwner/management operation — call it with the app owner's credentials from a builder/dashboard/server context, not from inside the generated app's end-user runtime. builtAppSafe is false.
WarningTo clear the builder-pinned model you must send model: '' explicitly. Omitting the field is a no-op under patch semantics, so there is no way to unpin by leaving it out.

See also

upsertSiteAgent · listSiteAgents · SiteAgent

Source: src/api/client.ts (Site Ops, P0-156; `model` pin P0-181) · Also available in llms-full.txt and registry.json.