Concept
A behavior profile is conditional behavior layered onto an agent. Each profile has a name, aPRIORITY, a WHEN condition, and one or more behavior changes.
Use a profile for context-sensitive adaptation, not to change the agent’s core job. If the responsibility changes, create another agent. If only the delivery mode or handling style changes, use a profile.
Profiles come in two forms:
Use inline profiles when the behavior belongs to one agent and only changes instructions. Use standalone profiles when several agents share a rule, or when the profile changes voice, response limits, tools, gathering, or flow.
Minimal working example
This agent has two inline profiles.recovery_mode uses two project values, sentiment and repeat_contact. Your project must set both before the first turn, for example with a tool result or a SET action. concise_mode uses the built-in channel value.
How it works
The runtime checks theWHEN condition of every attached profile at session start and again on each turn. A profile applies while its condition is true. Several profiles can apply at the same time.
The runtime applies active profiles from the lowest to the highest PRIORITY. When two profiles set the same field, the higher number wins. The merge rules depend on the section:
PRIORITY must be a whole number of 0 or more. Two profiles attached to the same agent with USE BEHAVIOR_PROFILE: cannot share a priority. Give inline profiles unique priorities too.
What a WHEN condition can read
Use
AND, OR, and NOT, or &&, ||, and !. Use == and !=. === and !== fail compilation.
A variable that has no value makes the condition fail. If no other part of the expression is true, the platform skips the profile for that turn and logs a warning. The agent keeps its base behavior. Set every variable that a WHEN condition reads before the first turn.
Standalone profile example
A standalone profile lives in its own file. Attach it to each agent that needs it withUSE BEHAVIOR_PROFILE:.
VOICE accepts provider, voice_id, speed, pace, temperature, ssml, instructions, plain_text, and turn detection settings. channel.name == "voice" matches only the voice channel. Use another condition, such as channel.name == "voice_twilio", for the voice channel variants your project uses.
Common variations
Recovery mode
Use a high-priority recovery profile for frustrated users, repeated failures, or repeat contacts. Read the signal frominteraction.sentiment_label or from a session variable your project sets.
Channel mode
Use channel profiles for SMS, voice, WhatsApp, or web when response length, formatting, or speech pacing changes. Match onchannel.name.
Enterprise customer mode
Use customer-tier profiles when premium or enterprise users need a different tone, faster escalation, or more formal explanations. Set the tier variable, for examplecustomer_tier, before the first turn.
Response limits and hidden tools
A standalone profile can add constraints, limit response size, and hide tools. The agent must declare every hidden tool. An unknown tool name fails compilation withPROFILE_UNKNOWN_TOOL.
show_carousel tool and runs USE BEHAVIOR_PROFILE: whatsapp_compact.
Verification
- Validate the project. Confirm that no
PROFILE_*,E105,E131, orE132errors appear. - Start one session that matches each
WHENcondition and one that does not. Test on the real channel, especially voice and SMS. - Inspect the
profile_resolutiontrace event on each turn.evaluatedProfileslists every attached profile andmatchedProfileslists the ones that applied. - Look for the
behavior_profile_appliedtrace event when the set of active profiles changes. It shows added tools, hidden tools, and voice overrides. - Make two profiles match at once. Confirm that instructions from both apply and that the higher priority wins on
RESPONSEandVOICEfields. - Leave a
WHENvariable unset. Confirm that the profile does not apply and the agent keeps its base behavior.
Production readiness checklist
- Every profile has a
PRIORITYthat is a whole number of 0 or more. - Every profile has a
WHENcondition. - Priorities are unique on each agent.
- Every context variable in a
WHENcondition has a documented source and is set before the first turn. - Every tool a profile hides is declared by the agent.
- Shared standalone profiles are versioned and reviewed, because changing one can affect many agents.
- Tests cover overlapping profiles, no-match behavior, unset variables, and channel-specific response constraints.