e2b-dev / e2b-dev/e2b-cookbook

config with thread_id error

Open
#36 2 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.4k
Forks
264
Avg merge
1d 22h
Merged PRs (30d)
8

Description

I try to run code here: examples/langgraph-python/langgraph_e2b_python/code_interpreter_tool.py

All my code is same as the example, expect that I added the memorysaver to enable the llm have chat memory for constant chat experience.


workflow = MessageGraph()
workflow.add_node("agent", llm.bind_tools(tools))
workflow.add_node("action", lambda x: execute_tools(x, tool_map))

#Conditional agent -> action OR agent -> END
workflow.add_conditional_edges(
"agent",
should_continue,
)
#Always transition action -> agent
workflow.add_edge("action", "agent")

workflow.set_entry_point("agent")
memory = MemorySaver()
app = workflow.compile(checkpointer = memory)

#4. Invoke the app
config = {"configurable": {"thread_id": str(uuid.uuid4())}}
result = app.invoke(input=("user", "please generate a random line plots"), config = config)


I got error message below when try to add config argument:


venv\lib\site-packages\langgraph\serde\jsonplus.py:72, in JsonPlusSerializer._default(self, obj)
68 return self._encode_constructor_args(
69 obj.class, kwargs={"node": obj.node, "arg": obj.arg}
70 )
71 else:
---> 72 raise TypeError(
73 f"Object of type {obj.class.name} is not JSON serializable"
74 )

TypeError: Object of type Result is not JSON serializable


I suppose the error comes due to change of message format that can not be json.dump(), is there any quick way to fix this? like some parser function maybe?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.