Building adaptive systems
Adaptability is a great attribute of agents. They should adapt to external and user feedback and correct their actions accordingly. As we discussed in Chapter 5, generative AI agents are adaptive through:
- Tool interaction: They incorporate feedback from previous tool calls and their outputs (by including
ToolMessages
that represent tool-calling results) when planning the next steps (like our ReACT agent adjusting based on search results). - Explicit reflection: They can be instructed to analyze current results and deliberately adjust their behavior.
- Human feedback: They can incorporate user input at critical decision points.
Dynamic behavior adjustment
We saw how to add a reflection step to our plan-and-solve agent. Given the initial plan, and the output of the steps performed so far, we’ll ask the LLM to reflect on the plan and adjust it. Again, we continue reiterating the key idea – such reflection might not happen naturally...