1. Learn
  2. /
  3. Courses
  4. /
  5. Designing Agentic Systems with LangChain

Connected

Exercise

Configure outputs for multiple tools

Your chatbot's graph is ready to go! Now you can test how the chatbot works with different queries that should require different tools. To manage your chatbot's messages, the following modules have already been imported and your chatbot's config parameters have been set for one session.

from langchain_core.messages import AIMessage, HumanMessage

config = {"configurable": {"thread_id": "1"}}

Instructions

100 XP
  • Create an inputs message dictionary with the user's query as content for HumanMessage.
  • Stream msg and metadata from the chatbot app by iterating over the results using the .stream() method incorporating inputs and config.
  • Check if each msg has content and is not a HumanMessage, then print its content with flush set to True for immediate output printing.
  • Test the chatbot using multi_tool_output() with queries requiring different tools.