diff --git a/main.py b/main.py index fd2c18c..8f8b750 100644 --- a/main.py +++ b/main.py @@ -1136,11 +1136,13 @@ def main(): # Otherwise, treat it as a chat message try: + print("MAIN: before invoke") result = agent.invoke({"messages": [HumanMessage(content=user_input)]}) + print(f"MAIN: after invoke, result type={type(result)}") # Extract the AI's response (works for both simple and tool agent) - print(f"MAIN: result keys={result.keys()}") - if "response" in result: + print(f"MAIN: result keys={result.keys() if hasattr(result, 'keys') else 'NO KEYS'}") + if result and "response" in result: # OllamaToolAgent returns a separate response field response_text = result["response"] else: