> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memvid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Framework Integrations

> SDK adapters and API-first platform integrations for Memvid

Memvid supports two integration styles:

* **SDK adapters** for framework-native tools and retrievers
* **REST API integrations** for platforms that work best with HTTP

<Info>
  **One Memory, Many Surfaces.** Use SDK adapters with `.mv2` files, or use cloud memories through `https://api.memvid.com` for API-first platforms.
</Info>

## Quick Comparison

| Integration                                                      | Type        | Language           | Best For                     |
| ---------------------------------------------------------------- | ----------- | ------------------ | ---------------------------- |
| [LangChain](/frameworks/langchain)                               | SDK adapter | Python, Node.js    | Agents, chains, RAG          |
| [LlamaIndex](/frameworks/llamaindex)                             | SDK adapter | Python, Node.js    | RAG pipelines, indexing      |
| [Vercel AI](/frameworks/vercel-ai)                               | SDK adapter | Node.js            | Next.js, streaming           |
| [OpenAI](/frameworks/openai)                                     | SDK adapter | Python, Node.js    | Direct API, function calling |
| [Google ADK](/frameworks/google-adk)                             | SDK adapter | Python, Node.js    | Gemini, ADK agents           |
| [AutoGen](/frameworks/autogen)                                   | SDK adapter | Python, Node.js    | Multi-agent systems          |
| [CrewAI](/frameworks/crewai)                                     | SDK adapter | Python, Node.js    | Agent crews                  |
| [Semantic Kernel](/frameworks/semantic-kernel)                   | SDK adapter | Python, Node.js    | Enterprise AI, Azure         |
| [Haystack](/frameworks/haystack)                                 | SDK adapter | Python             | Search pipelines             |
| [API Integration Patterns](/frameworks/api-integration-patterns) | REST API    | Any HTTP runtime   | Shared production patterns   |
| [n8n](/frameworks/n8n)                                           | REST API    | No-code / low-code | Workflow automation          |
| [Replit](/frameworks/replit)                                     | REST API    | Node.js, Python    | Cloud prototyping and apps   |
| [Lovable](/frameworks/lovable)                                   | REST API    | TypeScript         | Productized AI app builders  |
| [v0](/frameworks/v0)                                             | REST API    | Next.js            | Generated app frontends      |

***

## Choosing the Right Integration

<AccordionGroup>
  <Accordion title="I'm building a RAG application" icon="magnifying-glass">
    **Recommended:** [LangChain](/frameworks/langchain) or [LlamaIndex](/frameworks/llamaindex)

    Use the tools to search your knowledge base and build RAG pipelines.

    ```python theme={null}
    # LangChain with tools
    from memvid_sdk import use
    from langgraph.prebuilt import create_react_agent
    from langchain_openai import ChatOpenAI

    mem = use('langchain', 'knowledge.mv2')
    agent = create_react_agent(ChatOpenAI(model="gpt-4o"), mem.tools)
    result = agent.invoke({"messages": [{"role": "user", "content": "What is..."}]})

    # Or use find() + ask() directly
    results = mem.find("search query", k=5)
    answer = mem.ask("What is the main concept?")
    ```
  </Accordion>

  <Accordion title="I'm building an AI agent" icon="robot">
    **Recommended:** [LangChain](/frameworks/langchain), [AutoGen](/frameworks/autogen), or [CrewAI](/frameworks/crewai)

    These frameworks excel at agent orchestration with tool use.

    ```python theme={null}
    # LangChain Agent
    from langgraph.prebuilt import create_react_agent
    mem = use('langchain', 'knowledge.mv2')
    agent = create_react_agent(model, mem.tools)

    # AutoGen
    mem = use('autogen', 'knowledge.mv2')
    assistant = AssistantAgent("helper", llm_config={"tools": mem.tools})
    ```
  </Accordion>

  <Accordion title="I'm using Next.js / Vercel" icon="triangle">
    **Recommended:** [Vercel AI SDK](/frameworks/vercel-ai)

    Native streaming support and seamless integration with Next.js.

    ```typescript theme={null}
    import { use } from '@memvid/sdk';
    import { streamText } from 'ai';

    const mem = await use('vercel-ai', 'knowledge.mv2');

    export async function POST(req: Request) {
      const result = await streamText({
        model: openai('gpt-4o'),
        tools: mem.tools,
        messages: await req.json(),
      });
      return result.toDataStreamResponse();
    }
    ```
  </Accordion>

  <Accordion title="I want direct OpenAI/Gemini function calling" icon="plug">
    **Recommended:** [OpenAI](/frameworks/openai) or [Google ADK](/frameworks/google-adk)

    Use the native function calling APIs without framework overhead.

    ```python theme={null}
    # OpenAI
    mem = use('openai', 'knowledge.mv2')
    response = client.chat.completions.create(
        model="gpt-4o",
        tools=mem.tools,
        messages=[...]
    )

    # Google Gemini
    mem = use('google-adk', 'knowledge.mv2')
    chat = client.chats.create(
        model="gemini-2.0-flash",
        config=types.GenerateContentConfig(tools=[mem.tools])
    )
    ```
  </Accordion>

  <Accordion title="I'm building enterprise AI with Azure" icon="building">
    **Recommended:** [Semantic Kernel](/frameworks/semantic-kernel)

    Microsoft's SDK with enterprise features and Azure integration.

    ```python theme={null}
    mem = use('semantic-kernel', 'knowledge.mv2')
    kernel.add_plugin(mem.tools, "memvid")
    ```
  </Accordion>

  <Accordion title="I'm automating workflows with no-code tools" icon="bolt">
    **Recommended:** [n8n](/frameworks/n8n) and [Lovable](/frameworks/lovable)

    Use direct REST calls to Memvid from HTTP request steps and backend actions.

    ```bash theme={null}
    curl -X POST https://api.memvid.com/v1/memories/{MEMORY_ID}/ask \
      -H "Authorization: Bearer mv2_YOUR_KEY" \
      -H "Content-Type: application/json" \
      -d '{"question":"What does this process do?"}'
    ```
  </Accordion>

  <Accordion title="I'm prototyping quickly in hosted app builders" icon="triangle">
    **Recommended:** [Replit](/frameworks/replit) and [v0](/frameworks/v0)

    Route your app's backend requests to Memvid API and keep keys server-side.

    ```typescript theme={null}
    const res = await fetch("https://api.memvid.com/v1/memories/{MEMORY_ID}/find", {
      method: "POST",
      headers: { Authorization: `Bearer ${process.env.MEMVID_API_KEY}` },
      body: JSON.stringify({ query: "search query", topK: 5 }),
    });
    ```
  </Accordion>
</AccordionGroup>

***

## Universal Features

All adapters provide these core capabilities:

### Tools / Functions

Every adapter exposes three primary tools:

| Tool          | Description                      |
| ------------- | -------------------------------- |
| `memvid_put`  | Store documents in memory        |
| `memvid_find` | Search for relevant documents    |
| `memvid_ask`  | Ask questions with RAG synthesis |

```python theme={null}
# Access tools (framework-specific format)
tools = mem.tools
```

### Direct API Access

You can always bypass the adapter and use the core API directly:

```python theme={null}
# These work with any adapter
results = mem.find('search query', k=10)
answer = mem.ask('What is machine learning?')
timeline = mem.timeline(limit=50)
stats = mem.stats()
```

***

## Installation

Each adapter requires its framework to be installed:

<Tabs>
  <Tab title="Node.js">
    ```bash theme={null}
    # Core SDK
    npm install @memvid/sdk

    # Framework dependencies (install what you need)
    npm install @langchain/core @langchain/openai   # LangChain
    npm install llamaindex                          # LlamaIndex
    npm install ai @ai-sdk/openai                   # Vercel AI
    npm install openai                              # OpenAI
    npm install @google/generative-ai              # Google ADK
    ```
  </Tab>

  <Tab title="Python">
    ```bash theme={null}
    # Core SDK
    pip install memvid-sdk

    # Framework dependencies (install what you need)
    pip install "memvid-sdk[langchain]"        # LangChain
    pip install "memvid-sdk[llamaindex]"       # LlamaIndex
    pip install "memvid-sdk[openai]"           # OpenAI
    pip install google-genai                   # Google ADK
    pip install "memvid-sdk[autogen]"          # AutoGen
    pip install "memvid-sdk[crewai]"           # CrewAI
    pip install "memvid-sdk[semantic-kernel]"  # Semantic Kernel
    pip install "memvid-sdk[haystack]"         # Haystack

    # Or install all integrations:
    pip install "memvid-sdk[full]"
    ```
  </Tab>
</Tabs>

***

## Adapter Architecture

```mermaid theme={null}
flowchart TD
    subgraph App["Your Application"]
        LC[LangChain Adapter]
        LI[LlamaIndex Adapter]
        VA[Vercel AI Adapter]
        OA[OpenAI Adapter]
    end

    subgraph Core["Memvid Core API"]
        API["put, find, ask, timeline"]
    end

    subgraph Storage[".mv2 File"]
        D[Data]
        LX[Lex Index]
        VX[Vec Index]
        W[WAL]
    end

    LC --> API
    LI --> API
    VA --> API
    OA --> API
    API --> D
    API --> LX
    API --> VX
    API --> W
```

Each adapter:

1. **Wraps** the core Memvid API
2. **Formats** tools/retrievers for the specific framework
3. **Handles** framework-specific types and conventions
4. **Provides** seamless integration without lock-in

***

## Performance Comparison

All adapters have similar performance since they use the same core engine:

| Operation | Latency  | Notes                        |
| --------- | -------- | ---------------------------- |
| `find()`  | \< 5ms   | Hybrid search (lex + vec)    |
| `ask()`   | 20-200ms | Depends on LLM response time |
| `put()`   | \< 40ms  | With embedding generation    |
| File Open | \< 10ms  | Cold start                   |

The framework overhead is minimal (\< 1ms per operation).

***

## Examples Gallery

<CardGroup cols={2}>
  <Card title="RAG Chatbot" icon="comments" href="/examples/chatbot-memory">
    Build a chatbot with persistent memory using LangChain
  </Card>

  <Card title="Document Q&A" icon="file-lines" href="/examples/document-qa">
    Create a document Q\&A system with LlamaIndex
  </Card>

  <Card title="Knowledge Base" icon="book" href="/examples/knowledge-base">
    Build a searchable company knowledge base
  </Card>

  <Card title="Research Assistant" icon="flask" href="/examples/research-assistant">
    Create an AI research assistant for papers
  </Card>
</CardGroup>

***

## Framework Guides

<CardGroup cols={3}>
  <Card title="LangChain" icon="link" href="/frameworks/langchain">
    Agents, chains, retrievers
  </Card>

  <Card title="LlamaIndex" icon="database" href="/frameworks/llamaindex">
    RAG pipelines, query engines
  </Card>

  <Card title="Vercel AI" icon="triangle" href="/frameworks/vercel-ai">
    Next.js, streaming
  </Card>

  <Card title="OpenAI" icon="brain" href="/frameworks/openai">
    Function calling
  </Card>

  <Card title="Google ADK" icon="google" href="/frameworks/google-adk">
    Gemini, ADK agents
  </Card>

  <Card title="AutoGen" icon="robot" href="/frameworks/autogen">
    Multi-agent systems
  </Card>

  <Card title="CrewAI" icon="users" href="/frameworks/crewai">
    Agent crews
  </Card>

  <Card title="Semantic Kernel" icon="building" href="/frameworks/semantic-kernel">
    Enterprise AI
  </Card>

  <Card title="Haystack" icon="magnifying-glass" href="/frameworks/haystack">
    Search pipelines
  </Card>
</CardGroup>

***

## API Platform Guides

<CardGroup cols={2}>
  <Card title="API Integration Patterns" icon="shield" href="/frameworks/api-integration-patterns">
    Shared contracts, retries, polling, and smoke tests
  </Card>

  <Card title="n8n" icon="plug" href="/frameworks/n8n">
    Workflow automation with HTTP Request nodes
  </Card>

  <Card title="Replit" icon="bolt" href="/frameworks/replit">
    Cloud app integration with server-side fetch
  </Card>

  <Card title="Lovable" icon="comments" href="/frameworks/lovable">
    Product app builder integration via backend API calls
  </Card>

  <Card title="v0" icon="triangle" href="/frameworks/v0">
    Next.js route handlers and server actions
  </Card>
</CardGroup>
