# create-context-graph: Scaffold AI Agents with Graph-Based Memory in Minutes

> create-context-graph is a CLI scaffolding tool from Neo4j Labs that generates a complete full-stack AI agent application with Neo4j graph memory, a FastAPI backend, and a Next.js frontend, in a single command. It works with either a hosted NAMS backend or a self-hosted bolt Neo4j instance.

**neo4j-labs/create-context-graph** — AI agents with graph based reasoning memory, scaffolded in seconds

- Repository: https://github.com/neo4j-labs/create-context-graph
- Website: https://create-context-graph.dev
- Stars: 731 · Forks: 106
- Language: Python
- License: Apache-2.0
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/neo4j-labs-create-context-graph

## What create-context-graph Builds and Who It Serves

Building an AI agent with persistent, structured memory is a multi-component problem: the agent needs a memory backend, a domain-specific schema, tools for querying that schema, and a way for users to interact with it. create-context-graph generates all of these from a single command, targeting developers who want to prototype or build a domain-specific AI agent without assembling those components individually.

The scaffolded application includes a FastAPI backend with an AI agent configured for a chosen industry domain, powered by the neo4j-agent-memory library for multi-turn conversations with automatic entity extraction. It also generates a Next.js frontend with Chakra UI v3 that provides streaming chat, real-time tool call visualization with animated timelines, interactive graph exploration with double-click expand and drag-and-zoom, entity detail panels, document browsers, and decision trace viewers.

The tool is a Neo4j Labs project, meaning it is maintained by Neo4j staff and the community but carries no official support commitment. Issues and questions go to the GitHub issue tracker or the Neo4j Community Forum.

The command runs as a Python package via uvx or as a Node.js package via npx, so there is nothing to install globally before the first use. Python 3.11 or later and Node.js 18 or later are required. The pyproject.toml declares Python compatibility with 3.11, 3.12, and 3.13.

## Two Backends: Hosted NAMS and Self-Hosted Neo4j

The tool offers two memory backend configurations that represent a real trade-off between operational simplicity and capability.

The NAMS (Neo4j Autonomous Memory Service) path uses a hosted API at memory.neo4jlabs.com. It requires a NAMS API key and no Neo4j installation. The graph starts empty and the agent populates it through automatic entity extraction as the user chats. This is the default.

The self-hosted path uses a bolt Neo4j instance: Neo4j Aura, Docker, or a local install. This path supports full Neo4j capabilities including native Cypher writes, GDS graph projections, arbitrary queries, relationship types, and entity properties. It also supports loading rich demo fixtures: approximately 85 entities, 180 relationships, 25 documents, and decision traces, seeded with the `make seed` command.

The README is specific about which agent frameworks need which backend. The `strands` framework requires an Anthropic API key; the example also shows `pydanticai` with the self-hosted path. The `google-adk` framework appears in the smoke test scripts. Each framework generates a different backend implementation, so the choice of framework affects the generated code, not only the runtime behavior.

## Scaffolding a Project with the CLI

The NAMS path is the simplest entry point:

```bash
uvx create-context-graph my-app \
  --domain healthcare \
  --framework strands \
  --nams-api-key sk-nams-...
```

After scaffolding, install dependencies and start the application:

```bash
cd my-app
echo 'ANTHROPIC_API_KEY=sk-ant-...' >> .env
make install
make start
```

The self-hosted path with demo data adds a Neo4j step:

```bash
uvx create-context-graph my-app \
  --domain healthcare \
  --framework pydanticai \
  --self-hosted \
  --demo

cd my-app
echo 'ANTHROPIC_API_KEY=sk-ant-...' >> .env
make install
make docker-up
make seed
make start
```

The interactive wizard, invoked without arguments, asks six prompts with autocomplete for domain selection:

```bash
uvx create-context-graph
```

Custom domains work by describing the domain in plain English with --custom-domain; the LLM generates a complete ontology from the description. SaaS data connectors for GitHub, Slack, Gmail, Jira, Notion, Salesforce, and others are available through the --connector flag. An optional MCP server configuration for Claude Desktop can be generated with --with-mcp, allowing Claude Desktop to query the same knowledge graph.

Once running, the frontend is at http://localhost:3000, the FastAPI docs at http://localhost:8000/docs, and the Neo4j browser (self-hosted) at http://localhost:7474.

## The Generated Application Architecture

The scaffolding creates a project directory with a Python backend, a Node.js frontend, and Makefile targets that handle common operations.

The backend uses FastAPI with domain-specific agent tools containing Cypher queries tailored to the chosen industry. The agent memory layer is the neo4j-agent-memory library at version 0.4, which handles multi-turn conversations and automatic entity extraction. The LiteLLM provider injection for the memory layer means the memory model and embedding model are configurable separately from the agent model, each set through MEMORY_LLM and MEMORY_EMBEDDING environment variables. Native adapters resolve first for Anthropic, OpenAI, Bedrock, Vertex AI, Ollama, Groq, and Together, with everything else routing through LiteLLM.

The frontend's graph visualization supports schema view, interactive expansion by double-clicking nodes, drag-and-zoom, a property panel for selected nodes, and a document browser. The streaming chat uses Server-Sent Events.

The project version at the time of the last push is 0.14.0, classified in pyproject.toml as Development Status: Alpha. This classification reflects that the API and generated application structure are still evolving.

## NAMS Write-Path Constraints in Version 0.14.0

The README is detailed about the limitations of the NAMS hosted backend compared to self-hosted Neo4j, and they are significant enough to affect which use cases the NAMS path supports.

Relationships cannot be stored as native Neo4j relationships via the NAMS REST API. Instead, the scaffolded application encodes them as ccg-edges YAML blocks inside each source entity's description field. The frontend graph view parses these out and renders them visually, but they are not queryable as native graph edges. A future migration is planned for when NAMS adds a native add_relationship endpoint.

Entity properties cannot be stored as discrete node properties. The REST API accepts only name, type, and description, so additional properties collapse into the description as a markdown block.

Documents are dual-tracked: one entry goes through the long-term memory add_entity API, and a second goes through the short-term message API as extraction fuel. This dual write is a workaround for the absence of a dedicated document storage path in NAMS REST.

Preferences and facts are unavailable via NAMS REST. The auto_preferences option is forced off on the NAMS path. GDS endpoints and arbitrary Cypher writes return 501 on NAMS. Teams that need full graph capabilities, including native relationship types, property querying, and GDS projections, must use the self-hosted path.

## Limitations and When a Different Approach Fits Better

The generated applications require API keys for both the agent and the memory layer. The NAMS path requires a NAMS key from memory.neo4jlabs.com, and the agent itself requires an API key for the chosen LLM provider. The self-hosted path requires a running Neo4j instance and LLM access. Neither path is suitable for fully offline or air-gapped environments.

The generated frontend uses Next.js and Chakra UI v3 and is not designed to be unstyled or embedded into an existing application as a component. Teams who need the graph memory backend without the generated frontend will need to adapt the scaffolded code significantly.

The tool generates code for a specific set of supported agent frameworks. The README mentions PydanticAI, Strands, and Google ADK by name in the setup and test instructions. Teams using other frameworks will need to adapt the generated backend.

For simple single-turn agents that do not need persistent memory or graph structure, the scaffolding overhead is not justified. The tool is most valuable when the agent needs to remember entities across multiple conversations and reason over their relationships.

As a Neo4j Labs project, it carries no official support SLA. Breaking changes between 0.14.0 and future releases are possible.

## License, Maintenance, and Project Status

create-context-graph is released under the Apache-2.0 license, which permits commercial use, modification, and distribution with attribution. The optional connector dependencies bring in additional libraries, each with their own licenses listed in the pyproject.toml.

The current version is 0.14.0. The last push was on 2026-09-06. The pyproject.toml classifies the project as Alpha, which the README reinforces with the Neo4j Labs disclaimer. The project is maintained but not subject to the same stability guarantees as official Neo4j products.

The Makefile documents a test suite with 1,454 passing fast tests that run without a Neo4j instance or API keys. A matrix test covers 176 domain and framework combinations. These signal that the scaffolding logic is reasonably tested, though the integration tests requiring live services are gated behind a --slow flag.

## Conclusion

create-context-graph is the right tool for a developer who wants a working AI agent with graph-backed memory and a full web interface without building the plumbing from scratch, and who is already working in the Neo4j ecosystem or is comfortable adopting it. The NAMS hosted path requires less infrastructure but has significant API constraints in version 0.14.0: relationships, properties, GDS queries, and preferences all have workarounds or are unavailable via REST. The self-hosted path gives a complete graph with native Cypher but requires running Neo4j yourself. Verify which agent frameworks (PydanticAI, Strands, Google ADK) are supported before choosing, and check the NAMS write-path caveats in the README before assuming parity with the self-hosted mode.

## FAQ

### How do I create a context graph for an AI agent?

Run `uvx create-context-graph my-app --domain healthcare --framework strands --nams-api-key sk-nams-...` and follow the README's quick start steps. The tool scaffolds a complete FastAPI backend and Next.js frontend with Neo4j graph memory.

### What is the difference between a context graph and a knowledge graph?

The README uses context graph to refer to the structured memory a running AI agent builds from its conversations, storing entities and relationships specific to the agent's domain and task history. A knowledge graph is a broader term for a graph-structured knowledge base, which may be static or pre-loaded. The create-context-graph tool generates agents that populate their context graph dynamically through entity extraction during conversation.

### How do I build a context layer for an AI agent?

create-context-graph generates a complete context layer using Neo4j as the graph backend. The NAMS path requires only an API key and no local Neo4j instance; the self-hosted path requires a Neo4j bolt instance but gives full graph capabilities including native relationships and GDS projections.

## Sources

- [Issues](https://github.com/neo4j-labs/create-context-graph/issues)
- [License: Apache-2.0](https://github.com/neo4j-labs/create-context-graph/blob/main/LICENSE)
- [neo4j-labs/create-context-graph on GitHub](https://github.com/neo4j-labs/create-context-graph)
- [Project website](https://create-context-graph.dev)
- [README](https://github.com/neo4j-labs/create-context-graph/blob/main/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/neo4j-labs-create-context-graph
