Skip to main content
Use this pattern when the first turn should use authenticated context, such as account status or display name.

Concept

Authentication and profile lookup are different responsibilities. Authentication establishes who the user is and what context the session can trust. A profile lookup reads business data for that identity. ON_START can call a read-only profile tool after the session already has the identity value needed by that tool. Do not use a welcome message to reveal sensitive information before identity is verified. If the identity is missing, greet generically and ask the user to sign in before account-specific actions.

Minimal working example

How it works

session.account_id must already exist in runtime session context. ON_START calls the tool, binds the result as accountProfile, and then uses the profile fields in the welcome response.

Common variations

Guard the welcome when identity is missing

Verification

Test two sessions: one with session.account_id, and one without it. The authenticated session should call the profile tool and render the account-aware welcome. The unauthenticated session should not expose account-specific data.

Common mistakes

Troubleshooting

If the tool input is empty, inspect how the channel or authentication layer populates the session identity. If startup lookup adds latency, keep the welcome generic and move expensive profile calls into the first account-specific flow.

Production readiness checklist

  • Require verified identity before account-specific responses.
  • Make profile lookup tools read-only.
  • Keep sensitive account details out of the welcome.
  • Include a fallback for anonymous or partially authenticated users.
  • Trace startup tool calls and profile lookup failures.