From the course: Agentic AI Human-Agent Collaboration Design Patterns
Agent-environment interaction loop
From the course: Agentic AI Human-Agent Collaboration Design Patterns
Agent-environment interaction loop
In Chapter 1 of the Agentic AI Architecture Foundations course, we established the Agent-Environment Interaction Loop, in which we show how an agent iterates through a cycle comprised of four steps—perceive, reason, act, and, usually also, feedback. This is a cycle of steps an agent iterates through repeatedly when it is active and and interacting with its surroundings. This perspective is relevant to the design patterns covered in this course because when an agent collaborates with a human, the human may also be part of this loop. So with each pattern we cover, we'll revisit this figure to highlight where within the loop, human involvement may need to occur. It's also a good idea to make a distinction between this agent interaction loop and the human-in-the-loop design pattern that we described in chapter two of the Agentic AI Solution Design Patterns course. The agent-environment interaction loop is about the internal cycle an agent goes through when interacting with its environment. The completion of a cycle of this loop can sometimes take a while, especially when the human involved provides feedback at some point after the action is completed. Sometimes there's no feedback, in which case the agent doesn't pause or wait at all. It simply then proceeds to the next action. Now when we talk about the human in the loop design pattern, this is the loop we are referring to. We're putting a human in this loop. Specifically, we define what a human does in relation to the current agent action. It's a design approach we use where the involvement of the human is a necessary part of the overall solution workflow. We intentionally designed the agent's workflow logic to involve a human. So with human in the loop, we typically pause the agent environment interaction loop cycle after each reason step and wait for the human to do something before the act step. Or maybe the human is the one that ends up actually doing the entire action. The majority of patterns in this course can be viewed as specialized variations of the human in the loop pattern. Several of these incidentally also apply human feedback loop integration, which is a related design pattern we also cover in the same chapter two of the agentic AI solution design patterns course. In the upcoming design patterns, we sometimes show a human providing feedback and we sometimes don't. It's more about whether feedback is part of the immediate scope and purpose of a particular pattern. In reality, a human can provide feedback subsequent to any of these patterns. There are three common types of feedback we need to understand. The first is dynamic context, which is when we update system prompts during a given session and the prompts only last for the duration of the session. The next is static context, where we update system prompts for a longer time. Model retraining, then, is when we collect the log data related to the feedback as part of new training data that we then use to train a new version of the model. The first two items on this list relate to the in-context learning pattern covered in my agentic AI planning and reasoning design patterns course. And the model retraining relates to the reinforcement learning design pattern that was covered in my AI Solution Design Patterns course.