{"id":48949067,"url":"https://github.com/redis/context-engine-demos","last_synced_at":"2026-04-17T19:00:57.052Z","repository":{"id":351632473,"uuid":"1192064758","full_name":"redis/context-engine-demos","owner":"redis","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-15T21:30:09.000Z","size":3998,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-15T21:31:58.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-25T21:24:40.000Z","updated_at":"2026-04-15T19:47:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/redis/context-engine-demos","commit_stats":null,"previous_names":["redis/context-engine-demos"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/redis/context-engine-demos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fcontext-engine-demos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fcontext-engine-demos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fcontext-engine-demos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fcontext-engine-demos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis","download_url":"https://codeload.github.com/redis/context-engine-demos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis%2Fcontext-engine-demos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31941845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-17T19:00:56.103Z","updated_at":"2026-04-17T19:00:57.045Z","avatar_url":"https://github.com/redis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Context Engine Demos\n\n**Reusable demo apps powered by Redis Context Surfaces**\n\nDomain-specific demo apps for agentic workflows over structured Redis data,\nwith full tool-call visibility in a dark-mode chat UI.\n\n[Getting Started](#getting-started) · [Architecture](#architecture) · [Demo Paths](#demo-paths)\n\n\u003c/div\u003e\n\n---\n\n## What is this?\n\nContext Engine Demos is a multi-domain demo framework built around **Redis Context Surfaces**. The shared runtime shows how Context Surfaces turns Redis data into auto-generated [MCP](https://modelcontextprotocol.io/) tools that an AI agent can call. Instead of stuffing documents into a vector store and hoping the LLM figures it out, Context Surfaces gives agents **structured, scoped, real-time access** to operational data.\n\nThe repo currently includes built-in demo domains for:\n\n- `reddash` — food-delivery support\n- `electrohub` — electronics retail and order support\n\n**Two modes, same UI:**\n\n| Mode | How it works | Best for |\n|------|-------------|----------|\n| **Context Surfaces** | LangGraph ReAct agent with 60+ auto-generated MCP tools | Multi-entity reasoning, real-time data |\n| **Simple RAG** | Vector search over policy docs → one-shot LLM answer | Showing the contrast |\n\n---\n\n## Prerequisites\n\n| Tool | Version | Purpose |\n|------|---------|---------|\n| [Python](https://python.org) | ≥ 3.11 | Backend + scripts |\n| [uv](https://docs.astral.sh/uv/) | latest | Python package manager |\n| [Node.js](https://nodejs.org) | ≥ 18 | Frontend |\n| [npm](https://npmjs.com) | ≥ 9 | Frontend dependencies |\n\nYou will also need:\n\n- **OpenAI API key** — for embeddings and chat completions\n- **Redis Cloud** instance — host, port, and password\n- **Context Surfaces admin key** (`CTX_ADMIN_KEY`) — from the Context Surfaces console\n\n\u003e The `context-surfaces` SDK ships with sensible defaults for API and MCP URLs. No extra URLs to configure.\n\n---\n\n## Getting Started\n\n### 1. Clone and configure\n\n```bash\ngit clone https://github.com/redis/context-engine-demos.git\ncd context-engine-demos\ncp .env.example .env\n```\n\nEdit `.env` and fill in three values:\n\n```env\nOPENAI_API_KEY=your-openai-api-key\nREDIS_HOST=redis-xxxxx.c1.us-east-1-2.ec2.redns.redis-cloud.com\nREDIS_PORT=12345\nREDIS_PASSWORD=your-redis-password\nCTX_ADMIN_KEY=your-admin-key\n```\n\nEverything else is auto-populated by later steps or has sensible defaults. The active domain defaults to `reddash`; you can override it with `DEMO_DOMAIN=\u003cdomain-id\u003e` or `make ... DOMAIN=\u003cdomain-id\u003e`.\n\n### 2. Install dependencies\n\n```bash\nmake install\n```\n\nRuns `uv sync` (Python) and `npm install` (frontend).\n\n### 3. Generate models and sample data\n\n```bash\nmake validate-domain DOMAIN=reddash\nmake generate-models DOMAIN=reddash\nmake generate-data DOMAIN=reddash\n```\n\n### 4. Set up the Context Surface\n\n```bash\nmake setup-surface\n```\n\nThis creates a Context Surface with the active domain's generated models, embeds the current Redis connection settings as the surface data source, generates an agent key, and writes `CTX_SURFACE_ID` and `MCP_AGENT_KEY` back into `.env`.\n\n### 5. Load data\n\n```bash\nmake load-data\n```\n\nPushes all records for the active domain through the Context Surfaces API, which handles Redis JSON storage and index creation.\n\n### 6. Run\n\n```bash\nmake dev\n```\n\n| Service | URL |\n|---------|-----|\n| Frontend | http://localhost:3040 |\n| Backend | http://localhost:8040 |\n\nOpen http://localhost:3040 and try:\n\n- In `reddash`:\n  - *\"Why is my order running late?\"*\n  - *\"How much was I charged for my last order?\"*\n- In `electrohub`:\n  - *\"Show me my recent ElectroHub orders.\"*\n  - *\"Can I pick that up at my local store?\"*\n\n---\n\n## Architecture\n\n```\n┌─────────────┐     SSE      ┌──────────────┐   JSON-RPC   ┌──────────────────┐\n│  React Chat │◄────────────►│   FastAPI     │◄────────────►│  Context Surfaces│\n│  (Vite)     │              │ + LangGraph   │              │  MCP Server      │\n│  :3040      │              │   :8040       │              │  (cloud)         │\n└─────────────┘              └──────┬────────┘              └───────┬──────────┘\n                                    │                               │\n                                    │ redis-py                      │\n                                    ▼                               ▼\n                             ┌──────────────┐               ┌──────────────┐\n                             │ Redis Cloud  │◄──────────────│ Auto-created │\n                             │ (your data)  │               │ Search indexes│\n                             └──────────────┘               └──────────────┘\n```\n\n**Backend** — FastAPI app with a LangGraph ReAct agent. The shared runtime loads an active `DomainPack`, exposes domain UI config to the frontend, mounts domain-defined internal tools, and fetches MCP tools from Context Surfaces at startup. Conversations are persisted via a Redis-backed LangGraph checkpointer. Responses stream to the frontend over SSE.\n\n**Frontend** — React + TypeScript + Vite. The UI shell is shared, while branding, starter prompts, placeholder text, and theme tokens are loaded from `/api/domain-config`. The chat view shows every tool call, payload, result, and duration.\n\n---\n\n## Example Data Model\n\nThe `reddash` domain models a food-delivery platform with nine entity types:\n\n| Entity | Key Pattern | Key Indexed Fields |\n|--------|-------------|-------------------|\n| **Customer** | `reddash_customer:{id}` | name, email, account_status, city |\n| **Restaurant** | `reddash_restaurant:{id}` | name, cuisine_type, city, rating |\n| **Order** | `reddash_order:{id}` | customer_id, status, order_total, city |\n| **OrderItem** | `reddash_order_item:{id}` | order_id, item_name, quantity |\n| **DeliveryEvent** | `reddash_delivery_event:{id}` | order_id, event_type, actor |\n| **Driver** | `reddash_driver:{id}` | name, current_status, active_order_id |\n| **Payment** | `reddash_payment:{id}` | order_id, customer_id, payment_method |\n| **SupportTicket** | `reddash_support_ticket:{id}` | customer_id, order_id, category, status |\n| **Policy** | `reddash_policy:{id}` | title, category, content, content_embedding (vector) |\n\nReddash schema definitions live in [`domains/reddash/schema.py`](domains/reddash/schema.py). ElectroHub schema definitions live in [`domains/electrohub/schema.py`](domains/electrohub/schema.py).\n\n---\n\n## Demo Paths\n\nSee:\n\n- [`domains/reddash/docs/demo_paths.md`](domains/reddash/docs/demo_paths.md)\n- [`domains/electrohub/docs/demo_paths.md`](domains/electrohub/docs/demo_paths.md)\n\nReddash includes four scripted conversation flows:\n\n1. **Late Order Investigation** ⭐ — 7-tool chain across orders, drivers, delivery events, and policies\n2. **Payment \u0026 Membership** — itemized charges, membership tier awareness\n3. **Support History** — ticket lookup, order drill-down, policy citation\n4. **Multi-Entity Awareness** — cross-entity aggregation (restaurants, spend, promo codes)\n\n\u003e **Tip:** After each path, toggle to Simple RAG mode and ask the same question to see the contrast.\n\n## Presentations\n\nKeep domain-specific presentations with the domain itself:\n\n- `domains/\u003cdomain-id\u003e/presentations/`\n\nExample:\n\n- [`domains/electrohub/presentations/director-demo/index.html`](domains/electrohub/presentations/director-demo/index.html)\n- [`domains/electrohub/presentations/director-demo/README.md`](domains/electrohub/presentations/director-demo/README.md)\n\n---\n\n## Makefile Reference\n\n| Target | Description |\n|--------|-------------|\n| `make install` | Install backend + frontend dependencies |\n| `make validate-domain DOMAIN=reddash` | Validate the chosen domain pack |\n| `make generate-models DOMAIN=reddash` | Regenerate ContextModel classes for the chosen domain |\n| `make generate-data DOMAIN=reddash` | Generate sample JSONL data in `output/\u003cdomain\u003e` |\n| `make setup-surface DOMAIN=reddash` | Create surface + agent key using embedded Redis connection settings |\n| `make load-data DOMAIN=reddash` | Import JSONL data via Context Surfaces API |\n| `make smoke-domain DOMAIN=reddash` | Run a lightweight scaffold/data/model smoke test |\n| `make create-domain DOMAIN=electronics-store` | Scaffold a new domain pack |\n| `make backend` | Start FastAPI backend only |\n| `make frontend` | Start Vite frontend only |\n| `make dev` | Run backend + frontend together |\n| `make flush-redis` | Flush the Redis database |\n| `make reset` | Flush Redis + recreate surface + reload data |\n\n---\n\n## Project Structure\n\n```\ncontext-engine-demos/\n├── backend/app/             # Shared FastAPI + LangGraph runtime\n│   ├── core/                # Domain contract, schema types, loader\n│   ├── main.py              # App entry, SSE endpoints, /api/domain-config\n│   ├── langgraph_agent.py   # Shared ReAct agent runtime\n│   ├── context_surface_service.py  # MCP tool integration\n│   ├── rag_service.py       # Shared simple-RAG comparison mode\n│   └── settings.py          # Pydantic settings (.env loader)\n├── domains/\n│   ├── reddash/             # Delivery-support reference domain\n│   └── electrohub/          # Electronics retail reference domain\n│       ├── domain.py        # DOMAIN export implementing the contract\n│       ├── schema.py        # Entity definitions\n│       ├── prompt.py        # Domain prompt/playbooks\n│       ├── data_generator.py\n│       ├── generated_models.py\n│       ├── assets/logo.(svg|png|jpg|webp)\n│       └── docs/demo_paths.md\n│       └── presentations/   # Domain-specific decks and assets\n├── frontend/src/            # React + Vite chat UI\n│   ├── App.tsx              # Shared chat UI shell\n│   └── styles.css           # Theme-driven styles\n├── scripts/                 # Generic domain tooling\n├── tests/                   # Domain and framework smoke tests\n├── .codex/skills/domain-pack-authoring/\n│   └── SKILL.md             # Agent workflow for creating new domains\n├── Makefile                 # All build/run targets\n├── pyproject.toml           # Python dependencies\n└── .env.example             # Environment template\n```\n\n## Creating a New Domain\n\n```bash\nmake create-domain DOMAIN=electronics-store\nmake validate-domain DOMAIN=electronics-store\n```\n\nThen fill in `domains/electronics-store/` and follow the repo-local skill at\n[`./.codex/skills/domain-pack-authoring/SKILL.md`](.codex/skills/domain-pack-authoring/SKILL.md).\nDomain logos can be `svg`, `png`, `jpg`, `jpeg`, or `webp` as long as\n`branding.logo_path` matches the asset under `domains/\u003cdomain\u003e/assets/`.\nIf the domain has presentation material, keep it under\n`domains/\u003cdomain-id\u003e/presentations/`.\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis%2Fcontext-engine-demos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis%2Fcontext-engine-demos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis%2Fcontext-engine-demos/lists"}