Skip to main content
POST
Suggest Agent System Prompt

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Request body for POST /agents/system-prompt-suggestion.

Mirrors ValidateLlmRequest for the credential half (inline apiKey or savedConnectionId, with the same XOR rule) and adds the agent-context fields the meta-prompt needs to draft a starter customInstructions block. The runtime build_system_prompt already injects the per-agentType base template, schema field listing, and tool signatures - so the LLM is asked to produce only the user-facing instructions slot, never the boilerplate wrapper. See app.services.agent_prompt_suggester for the meta-prompt that enforces that.

provider
enum<string>
required

Unified LLM provider enum.

A single AgentLlmConnection row carries one provider and a set of capabilities (chat / embedding). PROVIDER_CAPABILITIES below pins which capabilities each provider can serve — picked by the FE Connections drawer and re-validated server-side on every write.

Available options:
anthropic,
openai,
openai-responses,
ollama,
azure,
azure-openai,
bedrock,
qwen,
openai-compatible
agentType
string
required

Agent type (e.g. react, workflow)

Required string length: 1 - 50
model
string
default:""
Maximum string length: 200
apiKey
string
default:""

Raw key - never stored

Maximum string length: 512
baseUrl
string | null
Maximum string length: 512
savedConnectionId
string | null

If set, BE resolves provider/apiKey/baseUrl from the tenant's saved llmConnection by id and ignores the inline apiKey / baseUrl.

Maximum string length: 100
agentName
string | null
Maximum string length: 100
description
string | null
Maximum string length: 500
inputTopics
string[]
Maximum array length: 20
selectedFields
string[]
Maximum array length: 50
tools
ToolContext · object[]

Tool name + description list. Replaces the older toolNames-only shape.

Maximum array length: 50
outputSchema
OutputSchemaField · object[]
Maximum array length: 50
filterSQL
string | null

Active record-filter (matches AgentInputConfig.filterSQL). Anchors the LLM's prompt to the actual shape of records reaching the agent.

Maximum string length: 4000
existingCustomInstructions
string | null

Existing draft to refine. Matches the FE textarea cap.

Maximum string length: 8000
generationHint
string | null

Optional one-line steer the user types into the wizard's 'Hint for AI' input. The meta-prompt already gets the agent's metadata, so this should carry use-case intent (tone, edge-case priority, what to emphasize) rather than restate the data shape.

Maximum string length: 500

Response

Successful Response

Response body for POST /agents/system-prompt-suggestion.

Token counts come straight from the provider's usage block (zeroed when the provider didn't return one). model / provider echo back the resolved values so the FE can display "generated with anthropic / claude-sonnet-4-5" alongside the suggestion.

generatedPrompt
string
required
tokensIn
integer
required
tokensOut
integer
required
model
string
required
provider
string
required