AI студия Владимира Ломтева
УСЛУГИПРОЕКТЫСТАТЬИБАЗА ЗНАНИЙМаркетплейсОбучениеПолезные сервисы

Оставьте заявку,
чтобы обсудить проект

Напишите ваш вопрос, не забудьте указать телефон. Мы перезвоним и все расскажем.

Контакты

Москва

Работаем по всей России
и миру (онлайн)

+7 (999) 760-24-41

Ежедневно с 9:00 до 21:00

v.lomtev@airassvet.ru

По вопросам сотрудничества

TelegramWhatsApp

Есть предложение?

Напишите нам в мессенджеры

© 2025 AI студия Владимира Ломтева

Политика конфиденциальностиСогласие на обработку ПДн|ИНН 623412173261
    Deep Agents Memory — Скилл для ИИ-агентов | AI Рассвет

    Deep Agents Memory

    INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.

    Скиллы для операций#GitHub#langchain-ai/langchain-skills#skills.sh
    Скачивания
    4
    В избранном
    0
    Комментарии
    0
    Просмотры
    45

    Установить скилл

    Добавьте инструмент одной командой или скачайте проверенный архив версии.

    npx skills add langchain-ai/langchain-skills --skill deep-agents-memory
    Скачать ZIP
    Версия
    1.0.0+b7a2a8fc363d
    Автор
    Владимир Ломтев
    Репозиторий
    langchain-ai/langchain-skills
    GitHub: langchain-ai/langchain-skills

    Как установить

    1. 1Скопируйте команду из блока установки.
    2. 2Запустите её в терминале из каталога проекта.

    Документация

    Deep Agents use pluggable backends for file operations and memory:

    Short-term (StateBackend): Persists within a single thread, lost when thread ends Long-term (StoreBackend): Persists across threads and sessions Hybrid (CompositeBackend): Route different paths to different backends

    FilesystemMiddleware provides tools: ls, read_file, write_file, edit_file, glob, grep

    Use Case Backend Why
    Temporary working files StateBackend Default, no setup
    Local development CLI FilesystemBackend Direct disk access
    Cross-session memory StoreBackend Persists across threads
    Hybrid storage CompositeBackend Mix ephemeral + persistent
    Default StateBackend stores files ephemerally within a thread.
    from deepagents import create_deep_agent
    
    agent = create_deep_agent()  # Default: StateBackend
    result = agent.invoke({
        "messages": [{"role": "user", "content": "Write notes to /draft.txt"}]
    }, config={"configurable": {"thread_id": "thread-1"}})
    ## /draft.txt is lost when thread ends
    
    Default StateBackend stores files ephemerally within a thread.
    import { createDeepAgent } from "deepagents";
    
    const agent = await createDeepAgent();  // Default: StateBackend
    const result = await agent.invoke({
      messages: [{ role: "user", content: "Write notes to /draft.txt" }]
    }, { configurable: { thread_id: "thread-1" } });
    // /draft.txt is lost when thread ends
    
    Configure CompositeBackend to route paths to different storage backends.
    from deepagents import create_deep_agent
    from deepagents.backends import CompositeBackend, StateBackend, StoreBackend
    from langgraph.store.memory import InMemoryStore
    
    store = InMemoryStore()
    
    composite_backend = lambda rt: CompositeBackend(
        default=StateBackend(rt),
        routes={"/memories/": StoreBackend(rt)}
    )
    
    agent = create_deep_agent(backend=composite_backend, store=store)
    
    ## /draft.txt -> ephemeral (StateBackend)
    ## /memories/user-prefs.txt -> persistent (StoreBackend)
    
    Configure CompositeBackend to route paths to different storage backends.
    import { createDeepAgent, CompositeBackend, StateBackend, StoreBackend } from "deepagents";
    import { InMemoryStore } from "@langchain/langgraph";
    
    const store = new InMemoryStore();
    
    const agent = await createDeepAgent({
      backend: (config) => new CompositeBackend(
        new StateBackend(config),
        { "/memories/": new StoreBackend(config) }
      ),
      store
    });
    
    // /draft.txt -> ephemeral (StateBackend)
    // /memories/user-prefs.txt -> persistent (StoreBackend)
    
    Files in /memories/ persist across threads via StoreBackend routing.
    ## Using CompositeBackend from previous example
    config1 = {"configurable": {"thread_id": "thread-1"}}
    agent.invoke({"messages": [{"role": "user", "content": "Save to /memories/style.txt"}]}, config=config1)
    
    config2 = {"configurable": {"thread_id": "thread-2"}}
    agent.invoke({"messages": [{"role": "user", "content": "Read /memories/style.txt"}]}, config=config2)
    ## Thread 2 can read file saved by Thread 1
    
    Files in /memories/ persist across threads via StoreBackend routing.
    // Using CompositeBackend from previous example
    const config1 = { configurable: { thread_id: "thread-1" } };
    await agent.invoke({ messages: [{ role: "user", content: "Save to /memories/style.txt" }] }, config1);
    
    const config2 = { configurable: { thread_id: "thread-2" } };
    await agent.invoke({ messages: [{ role: "user", content: "Read /memories/style.txt" }] }, config2);
    // Thread 2 can read file saved by Thread 1
    
    Use FilesystemBackend for local development with real disk access and human-in-the-loop.
    from deepagents import create_deep_agent
    from deepagents.backends import FilesystemBackend
    from langgraph.checkpoint.memory import MemorySaver
    
    agent = create_deep_agent(
        backend=FilesystemBackend(root_dir=".", virtual_mode=True),  # Restrict access
        interrupt_on={"write_file": True, "edit_file": True},
        checkpointer=MemorySaver()
    )
    
    ## Agent can read/write actual files on disk
    
    Use FilesystemBackend for local development with real disk access and human-in-the-loop.
    import { createDeepAgent, FilesystemBackend } from "deepagents";
    import { MemorySaver } from "@langchain/langgraph";
    
    const agent = await createDeepAgent({
      backend: new FilesystemBackend({ rootDir: ".", virtualMode: true }),
      interruptOn: { write_file: true, edit_file: true },
      checkpointer: new MemorySaver()
    });
    

    Security: Never use FilesystemBackend in web servers - use StateBackend or sandbox instead.

    Access the store directly in custom tools for long-term memory operations.
    from langchain.tools import tool, ToolRuntime
    from langchain.agents import create_agent
    from langgraph.store.memory import InMemoryStore
    
    @tool
    def get_user_preference(key: str, runtime: ToolRuntime) -> str:
        """Get a user preference from long-term storage."""
        store = runtime.store
        result = store.get(("user_prefs",), key)
        return str(result.value) if result else "Not found"
    
    @tool
    def save_user_preference(key: str, value: str, runtime: ToolRuntime) -> str:
        """Save a user preference to long-term storage."""
        store = runtime.store
        store.put(("user_prefs",), key, {"value": value})
        return f"Saved {key}={value}"
    
    store = InMemoryStore()
    
    agent = create_agent(
        model="gpt-4.1",
        tools=[get_user_preference, save_user_preference],
        store=store
    )
    
    ### What Agents CAN Configure
    • Backend type and configuration
    • Routing rules for CompositeBackend
    • Root directory for FilesystemBackend
    • Human-in-the-loop for file operations

    What Agents CANNOT Configure

    • Tool names (ls, read_file, write_file, edit_file, glob, grep)
    • Access files outside virtual_mode restrictions
    • Cross-thread file access without proper backend setup
    StoreBackend requires a store instance.
    ## WRONG
    agent = create_deep_agent(backend=lambda rt: StoreBackend(rt))
    
    ## CORRECT
    agent = create_deep_agent(backend=lambda rt: StoreBackend(rt), store=InMemoryStore())
    
    StoreBackend requires a store instance.
    // WRONG
    const agent = await createDeepAgent({ backend: (c) => new StoreBackend(c) });
    
    // CORRECT
    const agent = await createDeepAgent({ backend: (c) => new StoreBackend(c), store: new InMemoryStore() });
    
    StateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.
    ## WRONG: thread-2 can't read file from thread-1
    agent.invoke({"messages": [...]}, config={"configurable": {"thread_id": "thread-1"}})  # Write
    agent.invoke({"messages": [...]}, config={"configurable": {"thread_id": "thread-2"}})  # File not found!
    
    StateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.
    // WRONG: thread-2 can't read file from thread-1
    await agent.invoke({ messages: [...] }, { configurable: { thread_id: "thread-1" } });  // Write
    await agent.invoke({ messages: [...] }, { configurable: { thread_id: "thread-2" } });  // File not found!
    
    Path must match CompositeBackend route prefix for persistence.
    ## With routes={"/memories/": StoreBackend(rt)}:
    agent.invoke(...)  # /prefs.txt -> ephemeral (no match)
    agent.invoke(...)  # /memories/prefs.txt -> persistent (matches route)
    
    Path must match CompositeBackend route prefix for persistence.
    // With routes: { "/memories/": StoreBackend }:
    await agent.invoke(...);  // /prefs.txt -> ephemeral (no match)
    await agent.invoke(...);  // /memories/prefs.txt -> persistent (matches route)
    
    Use PostgresStore for production (InMemoryStore lost on restart).
    ## WRONG                              # CORRECT
    store = InMemoryStore()              store = PostgresStore(connection_string="postgresql://...")
    
    Use PostgresStore for production (InMemoryStore lost on restart).
    // WRONG                                    // CORRECT
    const store = new InMemoryStore();          const store = new PostgresStore({ connectionString: "..." });
    
    Enable virtual_mode=True to restrict path access (prevents ../ and ~/ escapes).
    backend = FilesystemBackend(root_dir="/project", virtual_mode=True)  # Secure
    
    CompositeBackend matches longest prefix first.
    routes = {"/mem/": StoreBackend(rt), "/mem/temp/": StateBackend(rt)}
    ## /mem/file.txt -> StoreBackend, /mem/temp/file.txt -> StateBackend (longer match)
    

    Требования и возможности

    Источник пакета
    https://github.com/langchain-ai/langchain-skills/tree/b7a2a8fc363d1711456f83d24230535c9fff93eb/config/skills/deep-agents-memory

    Файлы версии

    ПутьРазмерSHA256
    SKILL.md99583549b750ca9625dc...

    Частые вопросы

    Как установить Deep Agents Memory?
    Используйте команду npx skills add langchain-ai/langchain-skills --skill deep-agents-memory или скачайте ZIP-архив.
    Можно ли скачать Deep Agents Memory бесплатно?
    Да, опубликованную версию можно скачать из маркетплейса бесплатно.

    Похожие инструменты

    Смотреть все
    Ozon Seller и Performance APIСправочник Ozon Seller API и Performance API с локальными OpenAPI-спецификациями.Grill MeA relentless interview to sharpen a plan or design.Stop SlopRemove AI writing patterns from prose. Use when drafting, editing, or reviewing text to eliminate predictable AI tells.Git CommitExecute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
    Комментарии

    Войдите, чтобы оставить комментарий.

    Комментариев пока нет.

    Установить скилл

    Добавьте инструмент одной командой или скачайте проверенный архив версии.

    npx skills add langchain-ai/langchain-skills --skill deep-agents-memory
    Скачать ZIP
    Версия
    1.0.0+b7a2a8fc363d
    Автор
    Владимир Ломтев
    Репозиторий
    langchain-ai/langchain-skills
    GitHub: langchain-ai/langchain-skills