buildAgentSystemPrompt call produces appropriately different behavior for an email agent, a Slack bot, and an SMS assistant.
Quick Start
systemPrompt as the system parameter to your LLM provider call. The output is a plain string — no special formatting required.
AgentContext Reference
The communication channel this agent operates on. Affects formatting rules and link guidance.
One of:
"email" | "chat" | "sms" | "slack" | "discord"Behavioral mode for the agent. Controls how the agent presents itself and what actions it takes autonomously.
One of:
"direct" | "mediated" | "observed"Free-form organization-specific context injected into the identity module. Use this to describe your book of business, customer base, or specialized lines.
Advanced per-platform configuration for output formatting. See platform-specific options below.
Custom override for link formatting instructions. Replaces the default guidance derived from
platform and siteUrl.Prompt Modules
buildAgentSystemPrompt composes the following modules in order. Each module is a function you can also call individually for custom compositions.
1
Identity
Establishes who the agent is, the company it works for, and any organization-specific context. Sets the agent’s name and scopes its expertise to insurance.
2
Intent
Applies behavioral rules based on the
intent value. direct — speaks and acts as the primary point of contact. mediated — acts on behalf of a broker, surfaces broker contact for escalations. observed — summarizes and routes, does not make commitments.3
Formatting
Platform-specific output rules. Email agents produce well-structured prose with salutations. Chat and Slack agents use markdown. SMS agents avoid markdown entirely and keep responses short.
4
Safety
Scope guardrails that restrict the agent to insurance topics. Anti-hallucination rules that require citing evidence before stating coverage facts. Prompt injection defenses that prevent instruction override via user messages.
5
Coverage Gaps
Guidance for proactively identifying and surfacing gaps in coverage when comparing quotes or reviewing policy documents.
6
COI Routing
Instructions for handling certificate of insurance requests based on the
coiHandling setting. Routes requests to the appropriate party or self-serves generation when permitted.7
Quotes and Policies
Guidance on correctly differentiating between quote documents and bound policy documents, and appropriate language for each.
8
Memory
Instructions for using conversation history to provide continuity across sessions without re-asking for information the user has already provided.
Custom Module Composition
Call individual module builders when you need to add, remove, or reorder modules for a specialized agent.Each module function returns a string or
null. Filtering out null values before joining ensures you don’t get blank sections when a module has nothing to contribute for a given context.Intent Classification
When your pipeline receives inbound messages (emails, chat messages) and needs to route them before calling the agent, usebuildClassifyMessagePrompt to generate a classification prompt.
Platform Behavior Reference
- email
- chat
- sms
- slack / discord
- Produces full salutation and sign-off
- Uses structured sections with bold headers
- Includes policy numbers and document references inline
- Provides full links with descriptive anchor text