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 reads the interaction sentiment and the caller identity. concise_mode reads the channel name.
interaction.sentiment_label in the interaction context or in session or message metadata. See What a WHEN condition can read. Without that value, recovery_mode applies only to callers who are not authenticated.
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:
Active profile instructions and constraints also reach
REASONING: true steps in a FLOW. A flow step has no profile slot of its own. USE BEHAVIOR_PROFILE: on a step is ignored and raises warning W498. Attach the profile to the agent.
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
A
WHEN condition reads only the values in this table. It cannot read session variables, MEMORY fields, or tool results. A profile cannot branch on other values in this release.
Use AND, OR, and NOT, or &&, ||, and !. Use == and !=. === and !== fail compilation. Write WHEN: true for a profile that always applies.
A condition that names anything outside the table fails when the runtime evaluates it. The runtime skips the profile for that turn and logs a warning. The agent keeps its base behavior.
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. Read the signal frominteraction.sentiment_label, interaction.sentiment_score, or interaction.emotion_label. Your integration supplies these values.
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 caller profiles when verified or high-trust callers need a different tone, faster escalation, or more formal explanations. Match oncaller.identity_tier, caller.is_authenticated, or caller.verification_method.
Always-on profile
UseWHEN: true for a profile that applies on every turn, for example a shared response style that several agents attach.
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. - For interaction values, send the sentiment in the session interaction context or message metadata. Confirm that the profile applies.
- 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. - For a
FLOWagent, confirm that a matched profile instruction shapes the reply of aREASONING: truestep.
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
WHENcondition reads only values from the table in What aWHENcondition can read. - Your integration supplies every
interaction.*value that a condition uses, and a test proves it. - 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, and channel-specific response constraints.