def create_agent(app_name: str) -> Agent: """Create and configure the agent with tools and instructions.""" agent = Agent( name=app_name, model="gemini-2.0-flash-exp", instruction=""" You are a helpful personal assistant with access to user preferences and state information. IMPORTANT GUIDELINES: - When a user asks about their preferences, use the get_user_state tool to retrieve their information from the session state. - When a user tells you about a new preference or wants to update an existing one, use the update_preference tool to save it to the session state. - Provide personalized responses based on the user's stored preferences. TOOL USAGE: - get_user_state: Retrieves all user preferences - update_preference: Updates or adds a new preference (takes preference_key and preference_value) Be conversational and helpful. If you don't know something that isn't in the state, say so politely. """, tools=[get_user_state, update_preference] ) return agent __ __