Context Engine with Alexa Demo

June 1, 2026 Β· View on GitHub

Overview

This demo demonstrates how Redis Iris can extend Amazon Alexa with a scalable context engine. Built using Java, LangChain4J, AWS Lambda, and Redis Cloud, it enables Alexa to recall past conversations and deliver contextual, intelligent responses. It showcases how to implement a memory and semantic-caching layer for AI assistants, enriching the natural language experience through state persistence and fast retrieval.

Table of Contents

Demo Objectives

  • Demonstrate how to implement context engineering patterns with LangChain4J.
  • Demonstrate Redis Agent Memory as a memory persistence layer for AI context.
  • Demonstrate Redis LangCache as a semantic cache layer for human interactions.
  • Automate Alexa skill deployment using Terraform, AWS Lambda, and the ASK CLI.
  • Illustrate how Redis Iris supports scalable AI use cases in need of context.

Setup

Dependencies

Account Requirements

AccountDescription
AWS accountRequired to create Lambda, IAM, and CloudWatch resources.
Amazon developer accountThis is needed to register, deploy, and test Alexa skills.
OpenAILLM that will power the intelligent responses for the skill.
CohereScoring model used to deduplicate memories from the context.
Redis CloudRequired for Redis Agent Memory (managed AI memory service) and LangCache.

Configuration

AWS Setup

  1. Install the AWS CLI: Installation Guide
  2. Configure your credentials:
    aws configure
    

Amazon Developer Account

  1. Install the ASK CLI: Installation Guide
  2. Configure your credentials:
    ask configure
    

Redis Cloud

  1. Enable your APIs from Redis Cloud.
  2. Export them as environment variables:
    export REDISCLOUD_ACCESS_KEY=<YOUR_API_ACCOUNT_KEY>
    export REDISCLOUD_SECRET_KEY=<YOUR_API_USER_KEY>
    

Terraform Configuration

  1. Create your variables file:
    cp infrastructure/terraform.tfvars.example infrastructure/terraform.tfvars
    
  2. Edit infrastructure/terraform.tfvars with your information:
VariableDescription
application_prefixPrefix used for naming AWS resources (Lambda function, S3 bucket, etc.).
openai_api_keyAPI key used by the Alexa skill to call the OpenAI LLM.
openai_model_nameName of the OpenAI model used to generate responses (e.g., gpt-4o).
cohere_api_keyAPI key used by the Alexa skill to deduplicate memories via Cohere's scoring model.
langcache_api_base_urlBase URL for the Redis LangCache service.
langcache_api_keyAPI key for the Redis LangCache service.
langcache_cache_idCache ID for the Redis LangCache service.
redis_agent_memory_api_urlBase URL for the Redis Agent Memory service (e.g., https://<region>.agent-memory.redis.io).
redis_agent_memory_api_keyAPI key for authenticating with the Redis Agent Memory service.
redis_agent_memory_store_idStore ID of the memory store created in Redis Agent Memory.
knowledge_base_bucket_nameName of the S3 bucket used to upload knowledge base documents.
alexa_skill_idThe Alexa skill ID assigned by the Amazon Developer Console.

Redis Agent Memory Setup

  1. Log in to Redis Cloud and navigate to the Agent Memory section.
  2. Create a new memory store and note the API URL, API key, and Store ID.
  3. Set these as the redis_agent_memory_api_url, redis_agent_memory_api_key, and redis_agent_memory_store_id variables in your terraform.tfvars.

Redis LangCache Setup

Creating the LangCache Service

Installation & Deployment

Once configured, deploy everything using:

./deploy.sh

When the deployment completes, note the output values including the Lambda ARN and function URL.

You can verify if the Agent Memory service is reachable by saying:

β€œAlexa, ask my jarvis to check the memory server.”

Running the Demo

Once the deployment is complete, you can interact with your Alexa skill named my jarvis.

my-jarvis-interaction.png

πŸ—£οΈ Examples of interactions

  • "Alexa, tell my javis to remember that my favorite programming language is Java."
  • "Alexa, ask my jarvis to recall if Java is my favorite programming language."
  • "Alexa, tell my jarvis to remember I have a doctor appointment next Monday at 10 AM."
  • "Alexa, ask my jarvis to suggest what should I do for my birthday party."

Teardown

To remove all deployed resources:

./undeploy.sh

Slide Deck

πŸ“‘ Beyond Prompting: Context Engineering for Production-Grade AI
Covers demo goals, motivations for a memory layer, and architecture overview.

Architecture

Software Architecture This architecture uses an Alexa skill written in Java and hosted as an AWS Lambda function. The Lambda implements a stream handler that processes user requests and responses, using Redis Agent Memory and Redis LangCache β€” which are managed services on Redis Cloud β€” as its backend layer.

Chat Assistant Service As part of the stream handler implementation, it uses a Chat Assistant Service that leverages LangChain4J to manage interactions with Redis Agent Memory. This service implements context engineering, ensuring that conversations are enriched with relevant historical data retrieved from Redis. OpenAI is the LLM used to process and generate responses.

Known Issues

  • Alexa Developer Console may require manual linking if credentials are not fully synchronized.

Resources

Maintainers

Maintainers:

License

This project is licensed under the MIT License.