This document describes a high-level architecture for an application that generates and administers an interactive learning quiz with an agentic AI workflow. The agent assesses a user's knowledge on a specific topic and it uses a persistent session state and long-term memory to create a personalized experience. The agent maintains a history of the user's answers, which lets it dynamically adjust the difficulty and content of subsequent questions.
The intended audience for this document includes architects, developers, and administrators who build and manage agentic AI applications. This architecture is adaptable for creating interactive and stateful educational applications across various industries. The document assumes a foundational understanding of AI agent systems. For information about how agents differ from non-agentic systems, see What is the difference between AI agents, AI assistants, and bots?
The deployment section of this document provides links to code samples to help you experiment with deploying an agentic AI application that runs a data science workflow.
Architecture
The following diagram shows a high-level architecture for an interactive learning agent.
The architecture shows the following data flow:
- A user performs an action, such as starting a quiz or submitting an answer, within the quiz application that is hosted on Cloud Run.
- The application forwards the user's input to the AI agent.
The AI agent uses the Gemini model on Vertex AI to interpret the user's input. Based on the user's request, the agent calls the appropriate tools to perform the requested quiz action.
For example, the agent selects a tool to start a quiz session, evaluate an answer, or generate the next question.
The agent sends the response to the quiz application.
The quiz application forwards the response to the user.
To maintain the quiz's state and personalize the experience, the agent performs the following background tasks:
- The agent appends the latest quiz progress and score to the history of the saved session that's stored in Vertex AI Agent Engine Sessions.
- The agent transforms quiz data into memories and stores them in Memory Bank for long-term recall. The agent uses the historical data that's stored in memory to generate context-aware responses in future sessions.
Products used
This example architecture uses the following Google Cloud products:
- Cloud Run: A serverless compute platform that lets you run containers directly on top of Google's scalable infrastructure.
- Agent Development Kit (ADK): A set of tools and libraries to develop, test, and deploy AI agents.
- Vertex AI: An ML platform that lets you train and deploy ML models and AI applications, and customize LLMs for use in AI-powered applications.
- Vertex AI Agent Engine Sessions: A persistent storage service that saves and retrieves the history of interactions between a user and agents.
- Memory Bank: A persistent storage service that generates, refines, manages, and retrieves long-term memories based on a user's conversations with an agent.
Deployment
To deploy a sample implementation of this architecture that provides coding-related quizzes, use the Python tutor code sample that's available in GitHub.
What's next
- (Notebook) Get started with Sessions and Memory Bank for ADK agents in Cloud Run.
- (Blog) Learn more about state and memory with ADK.
- (Codelab) Build a production AI code review assistant with ADK.
- (Video) Watch the Agent Factory Podcast about memory in agents.
- Learn about Host AI agents on Cloud Run.
- For an overview of architectural principles and recommendations that are specific to AI and ML workloads in Google Cloud, see the AI and ML perspective in the Well-Architected Framework.
- For more reference architectures, diagrams, and best practices, explore the Cloud Architecture Center.
Contributors
Author: Samantha He | Technical Writer
Other contributors:
- Amina Mansour | Head of Cloud Platform Evaluations Team
- Kumar Dhanagopal | Cross-Product Solution Developer
- Megan O'Keefe | Developer Advocate
- Rachael Deacon-Smith | Developer Advocate
- Shir Meir Lador | Developer Relations Engineering Manager