# e2b-dev/e2b-cookbook architecture

> Architecture diagram of the GitHub repository e2b-dev/e2b-cookbook, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/e2b-dev/e2b-cookbook
- Repository: https://github.com/e2b-dev/e2b-cookbook

## Overview

##### Main Components

a) Core Infrastructure Layer:
- E2B SDK (central component)
- Sandbox Environment for Code Execution
- File System Interface

b) Language Support Layer:
- JavaScript/TypeScript Runtime
- Python Runtime

c) Integration Layer:
- LLM Provider Integrations
- OpenAI (GPT-4, o1)
- Anthropic (Claude)
- Meta (Llama)
- Mistral
- Groq
- Fireworks AI
- Together AI
- Framework Integrations
- LangChain
- LangGraph
- Autogen
- Vercel AI SDK

d) Examples Layer:
- Hello World Examples
- Use Case Examples
- Framework-specific Examples
- LLM Provider-specific Examples

**┌─────────────────────────────────────────────┐**
- Examples Layer                 │
- ┤
- Integration Layer                │
- ┤
- Language Support Layer             │
- ┤
- Core Infrastructure Layer          │
- ┘

##### Specific Implementation Details

a) For each LLM provider integration:
- Connection to both JS/TS and Python runtimes where applicable
- Supported features (code interpretation, function calling)

b) For framework integrations:
- Relationship with E2B SDK
- Language support
- To relevant examples

##### Implementation Notes

- The modularity of the E2B SDK
- The variety of supported LLM providers
- The flexibility of language support
- The extensive example coverage

Remember to:
- Use consistent naming conventions
- Version information where relevant
- Document any important assumptions or limitations

This system design should help developers understand how the different components interact and how to implement their own solutions using the E2B SDK.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Component]:::core --- L2[Dependency]
        L3([Language Runtime]):::lang
        L4{{LLM Provider}}:::llm
        L5[(Framework)]:::framework
        L6[/Example/]:::example
    end

    subgraph Core["Core Infrastructure Layer"]
        SDK[E2B SDK]:::core
        Sandbox[Sandbox Environment]:::core
        FileSystem[File System Interface]:::core
        Testing[Testing Infrastructure]:::core
        Migration[Migration Patterns]:::core
        
        SDK --> Sandbox
        SDK --> FileSystem
        SDK --> Testing
        SDK --> Migration
    end

    subgraph Lang["Language Support Layer"]
        JS([JavaScript/TypeScript]):::lang
        PY([Python]):::lang
        
        SDK --> JS
        SDK --> PY
    end

    subgraph Integration["Integration Layer"]
        direction TB
        subgraph LLM["LLM Providers"]
            Claude{{Anthropic Claude}}:::llm
            GPT{{OpenAI GPT-4}}:::llm
            O1{{OpenAI o1}}:::llm
            Llama{{Meta Llama}}:::llm
            Together{{Together AI}}:::llm
            Fireworks{{Fireworks AI}}:::llm
            Mistral{{Mistral}}:::llm
        end

        subgraph Frameworks["Framework Integrations"]
            LangChain[(LangChain)]:::framework
            LangGraph[(LangGraph)]:::framework
            Autogen[(Autogen)]:::framework
            Vercel[(Vercel AI SDK)]:::framework
        end
    end

    subgraph Examples["Examples Layer"]
        HelloJS[/"Hello World JS"/]:::example
        HelloPY[/"Hello World Python"/]:::example
        ClaudeJS[/"Claude JS"/]:::example
        ClaudePY[/"Claude Python"/]:::example
        GPT4JS[/"GPT-4 JS"/]:::example
        GPT4PY[/"GPT-4 Python"/]:::example
        LlamaJS[/"Llama JS"/]:::example
        LlamaPY[/"Llama Python"/]:::example
        TogetherEx[/"Together AI Example"/]:::example
        FireworksEx[/"Fireworks Example"/]:::example
        O1JS[/"O1 JS"/]:::example
        O1PY[/"O1 Python"/]:::example
        LangChainEx[/"LangChain Example"/]:::example
        LangGraphEx[/"LangGraph Example"/]:::example
        AutogenEx[/"Autogen Example"/]:::example
        VercelEx[/"Next.js Example"/]:::example
        WebsiteViz[/"Website Topic Visualization"/]:::example
        AirbnbAnalysis[/"Airbnb Data Analysis"/]:::example
        DatasetUpload[/"Dataset Upload"/]:::example
    end

    %% Connections
    JS --> HelloJS
    PY --> HelloPY
    Claude --> ClaudeJS
    Claude --> ClaudePY
    GPT --> GPT4JS
    GPT --> GPT4PY
    Llama --> LlamaJS
    Llama --> LlamaPY
    Together --> TogetherEx
    Fireworks --> FireworksEx
    O1 --> O1JS
    O1 --> O1PY
    LangChain --> LangChainEx
    LangGraph --> LangGraphEx
    Autogen --> AutogenEx
    Vercel --> VercelEx

    %% Click events
    click HelloJS "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/hello-world-js"
    click HelloPY "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/hello-world-python"
    click ClaudeJS "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/claude-code-interpreter-js"
    click ClaudePY "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/claude-code-interpreter-python"
    click GPT4JS "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/gpt-4o-code-interpreter-js"
    click GPT4PY "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/gpt-4o-code-interpreter"
    click LlamaJS "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/llama-3-code-interpreter-js"
    click LlamaPY "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/llama-3-code-interpreter-python"
    click TogetherEx "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/together-ai-with-code-interpreting"
    click FireworksEx "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/fireworks-code-interpreter-python"
    click O1JS "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/o1-code-interpreter-js"
    click O1PY "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/o1-code-interpreter-python"
    click LangChainEx "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/langchain-python"
    click LangGraphEx "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/langgraph-python"
    click AutogenEx "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/e2b_autogen"
    click VercelEx "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/nextjs-code-interpreter"
    click WebsiteViz "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/claude-visualize-website-topics"
    click AirbnbAnalysis "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/scrape-and-analyze-airbnb-data-with-firecrawl"
    click DatasetUpload "https://github.com/e2b-dev/e2b-cookbook/tree/main/examples/upload-dataset-code-interpreter"
    click Testing "https://github.com/e2b-dev/e2b-cookbook/blob/main/tests/examples.test.ts"
    click Migration "https://github.com/e2b-dev/e2b-cookbook/blob/main//.grit/patterns/e2b_v0_to_v1_js.md"

classDef core fill:#a2d2ff
classDef lang fill:#bde0fe
classDef llm fill:#ffafcc
classDef framework fill:#cdb4db
classDef example fill:#ffc8dd
```
