Skip to main content
Vizra ADK is in maintenance mode. It continues to work and receives compatibility fixes, but no new features are planned. For evaluating AI agents — now built on the official Laravel AI SDK — check out Vizra Evals, its successor for the evaluation use-case. Coming from ADK? See the migration guide.

Overview

This example demonstrates how to build a personal shopping assistant that:
  • Maintains shopping cart state across conversations
  • Learns and remembers user preferences
  • Provides personalized product recommendations
  • Tracks budget and spending
  • Uses context hooks for dynamic behavior

Agent Definition

Context Summary Builder

The agent dynamically injects shopping context into prompts:

Response Parser

Extract structured data from LLM responses to update context:

Cart Manager Tool

Key Concepts Demonstrated

Context State Management

The agent uses AgentContext to maintain state across the conversation:

Lifecycle Hooks

Override lifecycle methods to inject dynamic behavior:

Usage Example

Best Practices

Shopping assistants benefit from more creative responses (0.7 temperature) to provide varied and interesting product suggestions.
Store and use customer preferences, past purchases, and browsing history to provide personalized recommendations.
Use AgentContext state to maintain cart contents across the conversation without requiring database persistence for every interaction.
Use the afterLlmResponse hook to parse structured data from LLM outputs and update context automatically.

Next Steps

Dynamic Prompts

Learn how to create prompts that adapt based on context

Tool Pipelines

Chain multiple tools together for complex operations