Identity Anchor

Establish user identity and context at the start of a session.

category: Tool Context
arcade.dev/patterns

Context

Multi-tool sessions where user context matters.

Problem

Agents need to know who the user is and what they can access.

Solution

Provide identity anchor tool:
- who_am_i(): Returns current user info
- User ID: For other tools to reference
- Roles/permissions: What the user can do
- Context: Team, org, preferences

Examples

Python
@tool
def who_am_i() -> UserContext:
    """Get current user context.
    
    Call this first to understand:
    - Who you're acting as
    - What permissions you have
    - What team/org you're in
    
    Other tools may need the user_id returned here.
    """
    user = auth.get_current_user()
    return UserContext(
        user_id=user.id,
        email=user.email,
        name=user.display_name,
        roles=user.roles,
        team_id=user.team_id,
        permissions=user.permissions
    )

Considerations

  • Either make this the recommended first tool call, or automatically execute it and inject the response into the system prompt
  • Include enough context for downstream tools
  • Cache the result for the session

Related Patterns

More in Tool Context