Skip to content

The agent engineering platform.

Docs: Fix deprecated initialize agent in ainetwork (#30355)

Yeonseolee65b16d3200ed
diff --git a/docs/docs/integrations/tools/ainetwork.ipynb b/docs/docs/integrations/tools/ainetwork.ipynb
index b33d4c48b9..6a8d467a8e 100644
--- a/docs/docs/integrations/tools/ainetwork.ipynb
+++ b/docs/docs/integrations/tools/ainetwork.ipynb
@@ -130,16 +130,11 @@
"metadata": {},
"outputs": [],
"source": [
- "from langchain.agents import AgentType, initialize_agent\n",
"from langchain_openai import ChatOpenAI\n",
+ "from langgraph.prebuilt import create_react_agent\n",
"\n",
"llm = ChatOpenAI(temperature=0)\n",
- "agent = initialize_agent(\n",
- " tools=tools,\n",
- " llm=llm,\n",
- " verbose=True,\n",
- " agent=AgentType.OPENAI_FUNCTIONS,\n",
- ")"
+ "agent = create_react_agent(model=llm, tools=tools)"
]
},
{
@@ -199,8 +194,10 @@
],
"source": [
"print(\n",
- " agent.run(\n",
- " f\"Create an app in the AINetwork Blockchain database with the name {appName}\"\n",
+ " agent.invoke(\n",
+ " {\n",
+ " \"messages\": f\"Create an app in the AINetwork Blockchain database with the name {appName}\"\n",
+ " }\n",
" )\n",
")"
]