|
| 1 | +# Context Engineering Recipes |
| 2 | + |
| 3 | +This section contains comprehensive recipes and tutorials for **Context Engineering** - the practice of designing, implementing, and optimizing context management systems for AI agents and applications. |
| 4 | + |
| 5 | +## What is Context Engineering? |
| 6 | + |
| 7 | +Context Engineering is the discipline of building systems that help AI agents understand, maintain, and utilize context effectively. This includes: |
| 8 | + |
| 9 | +- **System Context**: What the AI should know about its role, capabilities, and environment |
| 10 | +- **Memory Management**: How to store, retrieve, and manage both short-term and long-term memory |
| 11 | +- **Tool Integration**: How to define and manage available tools and their usage |
| 12 | +- **Context Optimization**: Techniques for managing context window limits and improving relevance |
| 13 | + |
| 14 | +## Repository Structure |
| 15 | + |
| 16 | +``` |
| 17 | +context-engineering/ |
| 18 | +├── README.md # This file |
| 19 | +├── reference-agent/ # Complete reference implementation |
| 20 | +│ ├── src/ # Source code for the Redis University Class Agent |
| 21 | +│ ├── scripts/ # Data generation and ingestion scripts |
| 22 | +│ ├── data/ # Generated course catalogs and sample data |
| 23 | +│ └── tests/ # Test suite |
| 24 | +├── notebooks/ # Educational notebooks organized by section |
| 25 | +│ ├── section-1-introduction/ # What is Context Engineering? |
| 26 | +│ ├── section-2-system-context/# Setting up system context and tools |
| 27 | +│ └── section-3-memory/ # Memory management concepts |
| 28 | +└── resources/ # Shared resources, diagrams, and assets |
| 29 | +``` |
| 30 | + |
| 31 | +## Course Structure |
| 32 | + |
| 33 | +This repository supports a comprehensive web course on Context Engineering with the following sections: |
| 34 | + |
| 35 | +### Section 1: Introduction |
| 36 | +- **What is Context Engineering?** - Core concepts and principles |
| 37 | +- **The Role of a Context Engine** - How context engines work in AI systems |
| 38 | +- **Project Overview: Redis University Class Agent** - Hands-on project introduction |
| 39 | + |
| 40 | +### Section 2: Setting up System Context |
| 41 | +- **Prepping the System Context** - Defining what the AI should know |
| 42 | +- **Defining Available Tools** - Tool integration and management |
| 43 | + |
| 44 | +### Section 3: Memory |
| 45 | +- **Memory Overview** - Concepts and architecture |
| 46 | +- **Short-term/Working Memory** - Managing conversation context |
| 47 | +- **Summarizing Short-term Memory** - Context window optimization |
| 48 | +- **Long-term Memory** - Persistent knowledge storage and retrieval |
| 49 | + |
| 50 | +## Reference Agent: Redis University Class Agent |
| 51 | + |
| 52 | +The reference implementation is a complete **Redis University Class Agent** that demonstrates all context engineering concepts in practice. This agent can: |
| 53 | + |
| 54 | +- Help students find courses based on their interests and requirements |
| 55 | +- Maintain conversation context across sessions |
| 56 | +- Remember student preferences and academic history |
| 57 | +- Provide personalized course recommendations |
| 58 | +- Answer questions about course prerequisites, schedules, and content |
| 59 | + |
| 60 | +### Key Technologies |
| 61 | + |
| 62 | +- **LangGraph**: Agent workflow orchestration |
| 63 | +- **Redis Agent Memory Server**: Long-term memory management |
| 64 | +- **langgraph-redis-checkpointer**: Short-term memory and state persistence |
| 65 | +- **RedisVL**: Vector storage for course catalog and semantic search |
| 66 | +- **OpenAI GPT**: Language model for natural conversation |
| 67 | + |
| 68 | +## Getting Started |
| 69 | + |
| 70 | +1. **Set up the environment**: Install required dependencies |
| 71 | +2. **Run the reference agent**: Start with the complete implementation |
| 72 | +3. **Explore the notebooks**: Work through the educational content |
| 73 | +4. **Experiment**: Modify and extend the agent for your use cases |
| 74 | + |
| 75 | +## Prerequisites |
| 76 | + |
| 77 | +- Python 3.8+ |
| 78 | +- Redis Stack (local or cloud) |
| 79 | +- OpenAI API key |
| 80 | +- Basic understanding of AI agents and vector databases |
| 81 | + |
| 82 | +## Quick Start |
| 83 | + |
| 84 | +```bash |
| 85 | +# Navigate to the reference agent directory |
| 86 | +cd python-recipes/context-engineering/reference-agent |
| 87 | + |
| 88 | +# Install dependencies |
| 89 | +pip install -r requirements.txt |
| 90 | + |
| 91 | +# Generate sample course data |
| 92 | +python -m redis_context_course.scripts.generate_courses |
| 93 | + |
| 94 | +# Ingest data into Redis |
| 95 | +python -m redis_context_course.scripts.ingest_courses |
| 96 | + |
| 97 | +# Start the CLI agent |
| 98 | +python -m redis_context_course.cli |
| 99 | +``` |
| 100 | + |
| 101 | +## Learning Path |
| 102 | + |
| 103 | +1. Start with **Section 1** notebooks to understand core concepts |
| 104 | +2. Explore the **reference agent** codebase to see concepts in practice |
| 105 | +3. Work through **Section 2** to learn system context setup |
| 106 | +4. Complete **Section 3** to master memory management |
| 107 | +5. Experiment with extending the agent for your own use cases |
| 108 | + |
| 109 | +## Contributing |
| 110 | + |
| 111 | +This is an educational resource. Contributions that improve clarity, add examples, or extend the reference implementation are welcome. |
0 commit comments