A context provider that enables AI agents to retrieve knowledge graph context from Neo4j, supporting both vector and fulltext search with optional graph enrichment.
Context providers are plugins for the Microsoft Agent Framework that automatically inject relevant information into an agent's conversation before the AI model processes each message. The Neo4j Context Provider retrieves data from your Neo4j knowledge graph—whether through semantic vector search or keyword-based fulltext search—and enriches agent responses with graph-aware context.
For detailed architecture, configuration options, and sample walkthroughs, see NEO4J_PROVIDER_ARCHITECTURE.md.
- uv: Fast Python package installer
- Azure Developer CLI (azd): For infrastructure provisioning
- Azure CLI: For authentication
- Neo4j Database: With vector or fulltext indexes configured
Deploy Azure AI Foundry resources (for embeddings and chat models):
azd upuv sync --prerelease=allowPull environment variables from azd and create a local .env file:
uv run setup_env.pyAdd your Neo4j credentials to .env:
NEO4J_URI=neo4j+s://your-database.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=your-password
NEO4J_INDEX_NAME=your-index-name
Launch the interactive demo menu:
uv run start-agentOr run a specific sample directly:
uv run start-agent 3 # Run Context Provider (Fulltext)
uv run start-agent a # Run all samplesThe src/samples/ directory contains working examples. Run them using uv run start-agent:
| # | Sample | Description |
|---|---|---|
| 1 | agent_memory.py |
Agent Framework conversation memory using threads |
| 2 | semantic_search.py |
Direct vector search without Agent Framework |
| 3 | context_provider_basic.py |
Fulltext (keyword) search |
| 4 | context_provider_vector.py |
Vector search with Azure AI embeddings |
| 5 | context_provider_graph_enriched.py |
Graph traversal for rich context |
| 6 | aircraft_maintenance_search.py |
Aircraft domain with custom retrieval queries |
| 7 | aircraft_flight_delays.py |
Flight operations data analysis |
| 8 | component_health.py |
Component status with aggregated maintenance counts |
See NEO4J_PROVIDER_ARCHITECTURE.md for detailed walkthroughs of each sample.