[GH-ISSUE #3055] [deepagents]: AttributeError: 'dict' object has no attribute 'interrupts' #2702

Closed
opened 2026-06-05 17:26:21 -04:00 by yindo · 5 comments
Owner

Originally created by @youngquan on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/3055

Type of issue

issue / bug

Language

Python

Description

When the code reaches result.interrupts, the following error will be prompted:

AttributeError: 'dict' object has no attribute 'interrupts'

I'm not sure if it's because the version has been upgraded but the code hasn't been updated. After changing it to result.get("__interrupt__"), the code ran correctly.
In addition, result.value["messages"][-1].content should also be modified to result["messages"][-1].content.

Originally created by @youngquan on GitHub (Mar 11, 2026). Original GitHub issue: https://github.com/langchain-ai/docs/issues/3055 ### Type of issue issue / bug ### Language Python ### Description When the code reaches `result.interrupts`, the following error will be prompted: ```bash AttributeError: 'dict' object has no attribute 'interrupts' ``` I'm not sure if it's because the version has been upgraded but the code hasn't been updated. After changing it to `result.get("__interrupt__")`, the code ran correctly. In addition, `result.value["messages"][-1].content` should also be modified to `result["messages"][-1].content`.
yindo added the externaldeepagents labels 2026-06-05 17:26:21 -04:00
yindo closed this issue 2026-06-05 17:26:21 -04:00
Author
Owner

@pawel-twardziak commented on GitHub (Mar 11, 2026):

hi @youngquan

based on the docs, coul you try adding version="v2" to invoke() calls:

result = agent.invoke(input, config=config, version="v2")
result.interrupts
result.value["messages"]

the v1 dict-style access

result = agent.invoke(input, config=config)
result.get("__interrupt__")  # works (but deprecated)
result["messages"]            # works
<!-- gh-comment-id:4037629105 --> @pawel-twardziak commented on GitHub (Mar 11, 2026): hi @youngquan based on the [docs](https://docs.langchain.com/oss/python/deepagents/human-in-the-loop), coul you try adding version="v2" to invoke() calls: ```py result = agent.invoke(input, config=config, version="v2") result.interrupts result.value["messages"] ``` the v1 dict-style access ```py result = agent.invoke(input, config=config) result.get("__interrupt__") # works (but deprecated) result["messages"] # works ```
Author
Owner

@youngquan commented on GitHub (Mar 11, 2026):

I tried, but it still prompts the same problem. Here is the code I tested:

import sqlite3
import uuid

from deepagents import create_deep_agent
from dotenv import load_dotenv
from langchain.chat_models import init_chat_model
from langchain.tools import tool
from langgraph.checkpoint.memory import MemorySaver


@tool
def write_file(file_path: str, content: str) -> str:
    """Write content to a file."""
    try:
        with open(file_path, "w", encoding="utf-8") as f:
            f.write(content)
        return f"Successfully wrote to file: {file_path}"
    except Exception as e:
        return f"Error writing file: {str(e)}"


@tool
def execute_sql(database: str, query: str) -> str:
    """Execute SQL query on a SQLite database."""
    try:
        conn = sqlite3.connect(database)
        cursor = conn.cursor()
        cursor.execute(query)
        conn.commit()
        result = cursor.fetchall()
        conn.close()
        return f"Query executed successfully. Result: {result}"
    except Exception as e:
        return f"Error executing SQL: {str(e)}"


@tool
def read_data(file_path: str) -> str:
    """Read content from a file."""
    try:
        with open(file_path, "r", encoding="utf-8") as f:
            content = f.read()
        return f"Successfully read file: {file_path}\nContent:\n{content}"
    except Exception as e:
        return f"Error reading file: {str(e)}"


# Checkpointer is REQUIRED for human-in-the-loop
checkpointer = MemorySaver()
load_dotenv()

model = init_chat_model(model="deepseek-chat")
agent = create_deep_agent(
    model=model,
    tools=[write_file, execute_sql, read_data],
    interrupt_on={
        "write_file": True,  # Default: approve, edit, reject
        "execute_sql": False,  # No interrupts needed
        "read_data": {"allowed_decisions": ["approve", "reject"]},
    },
    checkpointer=checkpointer,  # Required!
)


# Create config with thread_id for state persistence
config = {"configurable": {"thread_id": str(uuid.uuid4())}}

# Invoke the agent
result = agent.invoke(
    {
        "messages": [
            {
                "role": "user",
                "content": "Write the content in the file AGENTS.md: This is a test",
            }
        ]
    },
    config=config,
    version="v2",
)

result.interrupts
result.value["messages"]

Still the same error:

Traceback (most recent call last):
  File "d:\projects\kaixinguo\demo.py", line 82, in <module>
    result.interrupts
AttributeError: 'dict' object has no attribute 'interrupts'
<!-- gh-comment-id:4037771389 --> @youngquan commented on GitHub (Mar 11, 2026): I tried, but it still prompts the same problem. Here is the code I tested: ```python import sqlite3 import uuid from deepagents import create_deep_agent from dotenv import load_dotenv from langchain.chat_models import init_chat_model from langchain.tools import tool from langgraph.checkpoint.memory import MemorySaver @tool def write_file(file_path: str, content: str) -> str: """Write content to a file.""" try: with open(file_path, "w", encoding="utf-8") as f: f.write(content) return f"Successfully wrote to file: {file_path}" except Exception as e: return f"Error writing file: {str(e)}" @tool def execute_sql(database: str, query: str) -> str: """Execute SQL query on a SQLite database.""" try: conn = sqlite3.connect(database) cursor = conn.cursor() cursor.execute(query) conn.commit() result = cursor.fetchall() conn.close() return f"Query executed successfully. Result: {result}" except Exception as e: return f"Error executing SQL: {str(e)}" @tool def read_data(file_path: str) -> str: """Read content from a file.""" try: with open(file_path, "r", encoding="utf-8") as f: content = f.read() return f"Successfully read file: {file_path}\nContent:\n{content}" except Exception as e: return f"Error reading file: {str(e)}" # Checkpointer is REQUIRED for human-in-the-loop checkpointer = MemorySaver() load_dotenv() model = init_chat_model(model="deepseek-chat") agent = create_deep_agent( model=model, tools=[write_file, execute_sql, read_data], interrupt_on={ "write_file": True, # Default: approve, edit, reject "execute_sql": False, # No interrupts needed "read_data": {"allowed_decisions": ["approve", "reject"]}, }, checkpointer=checkpointer, # Required! ) # Create config with thread_id for state persistence config = {"configurable": {"thread_id": str(uuid.uuid4())}} # Invoke the agent result = agent.invoke( { "messages": [ { "role": "user", "content": "Write the content in the file AGENTS.md: This is a test", } ] }, config=config, version="v2", ) result.interrupts result.value["messages"] ``` Still the same error: ``` bash Traceback (most recent call last): File "d:\projects\kaixinguo\demo.py", line 82, in <module> result.interrupts AttributeError: 'dict' object has no attribute 'interrupts' ```
Author
Owner

@pawel-twardziak commented on GitHub (Mar 11, 2026):

hi @youngquan what are the versions of langchain/langgraph you are using?

<!-- gh-comment-id:4041857688 --> @pawel-twardziak commented on GitHub (Mar 11, 2026): hi @youngquan what are the versions of langchain/langgraph you are using?
Author
Owner

@youngquan commented on GitHub (Mar 11, 2026):

Here are some outputs from uv pip list:

langchain              1.2.10
langgraph              1.0.9
deepagents             0.4.3
<!-- gh-comment-id:4043340427 --> @youngquan commented on GitHub (Mar 11, 2026): Here are some outputs from `uv pip list`: ```bash langchain 1.2.10 langgraph 1.0.9 deepagents 0.4.3 ````
Author
Owner

@pawel-twardziak commented on GitHub (Mar 12, 2026):

hi @youngquan update langgraph to v1.1 -> version="v2"

<!-- gh-comment-id:4045009311 --> @pawel-twardziak commented on GitHub (Mar 12, 2026): hi @youngquan update `langgraph` to `v1.1` -> [version="v2"](https://docs.langchain.com/oss/python/releases/changelog#mar-10-2026)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#2702