Skip to main content

Greetings,

While in the process of testing Langchain and Zapier functionalities, I encountered an issue where the response I received was "observation: null." I followed the code provided in the documentation, but the problem persists. I'm seeking guidance on how to resolve this issue. Below is the code I used for reference.

 

from langchain.llms import OpenAI
from langchain.agents import initialize_agent, load_tools
from langchain.agents.agent_toolkits import ZapierToolkit
from langchain.agents import AgentType
from langchain.memory import ConversationBufferMemory
from langchain.utilities.zapier import ZapierNLAWrapper

OPENAI_API_KEY = "..."
ZAPIER_NLA_API_KEY = "..."

llm = OpenAI(temperature=1, openai_api_key= OPENAI_API_KEY)
memory = ConversationBufferMemory(memory_key="chat_history")
zapier = ZapierNLAWrapper(zapier_nla_api_key = ZAPIER_NLA_API_KEY)
toolkit = ZapierToolkit.from_zapier_nla_wrapper(zapier)
tools = toolkit.get_tools() + load_tools(("human"])
agent = initialize_agent(tools, llm, memory=memory, agent="conversational-react-description", verbose=True)

message = "Find the last email I received from giabao.corn20@gmail.com"
assistant_message = agent.run(message)
print(assistant_message)

This is what i got as a return: 



> Entering new AgentExecutor chain...

Thought: Do I need to use a tool? Yes
Action: Gmail: Find Email
Action Input: Search for 'from giabao.corn20@gmail.com'
Observation: null
Thought: Do I need to use a tool? No
AI: I'm sorry, I couldn't find an email from that address. Is there anything else I can help you with?

> Finished chain.
I'm sorry, I couldn't find an email from that address. Is there anything else I can help you with?

Edit 1: It appears that I can view the result in the Zapier NLA (Natural Language API) logs, but the process is still in the "previewed" state and hasn't automatically executed yet. I have to manually click the "run" button for it to execute and return the answer. How can I resolve this issue?

 

{
"id": "01H8QVAH3RSX29BV6EMQGH1ETS",
"action_used": "Notion: Find Page (By Title)",
"input_params": {
"Title": "tech"
},
"review_url": "https://nla.zapier.com/execution/01H8QVAH3RSX29BV6EMQGH1ETS/?needs_confirmation=true",
"result": null,
"additional_results": [],
"result_field_labels": null,
"status": "preview",
"error": null,
"assistant_hint": "When the response status=preview, always send the user to review_url to confirm and run the action. After the user confirms, fetch the execution log to see the results."
}

Similar issue with langchain, making an API request yields this message. Not sure why but it needs a manual review_url which is a pain, because I dont know if langchain can natively handle that. 


For me this problem was caused because my Zapier actions all had the option “require preview before running AI Action” toggled on (this is default). To toggle it off, go to https://nla.zapier.com/dev/actions/ and click on the action you want > show all options > scroll down and toggle off “require preview before running AI Action”.