Skip to content

Commit

Permalink
Catch and log exceptions occurring while executing a langchain agent …
Browse files Browse the repository at this point in the history
…node
  • Loading branch information
dagardner-nv committed Feb 1, 2024
1 parent 6dae8fe commit b381084
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion morpheus/llm/nodes/langchain_agent_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ async def _run_single(self, **kwargs: dict[str, typing.Any]) -> dict[str, typing
return results

# We are not dealing with a list, so run single
return await self._agent_executor.arun(**kwargs)
try:
return await self._agent_executor.arun(**kwargs)
except Exception as e:
logger.exception("Error running agent: %s: %s", kwargs, e)

async def execute(self, context: LLMContext) -> LLMContext:

Expand Down

0 comments on commit b381084

Please sign in to comment.