

# The agent function: perceive, reason, act
<a name="perceive-reason-act"></a>

At the core of every software agent is a cognitive cycle that is often described as the *perceive, reason, act *loop. This process is illustrated in the following diagram. It defines how agents operate autonomously in dynamic environments.

![Perceive, reason, act loop.](http://docs.aws.amazon.com/prescriptive-guidance/latest/agentic-ai-foundations/images/perceive-reason-act.png)

+ **Perceive**: Agents gather information (for example, events, sensor inputs, or API signals) from the environment and update their internal state or beliefs.
+ **Reason**: Agents analyze current beliefs, goals, and contextual knowledge by using a plan library or logic system. This process might involve goal prioritization, conflict resolution, or intention selection.
+ **Act**: Agents select and execute actions that move them closer to achieving their delegated goals.

This architecture supports the ability of agents to function beyond rigid programming and enables flexible, context-sensitive, and goal-directed behavior. It forms the mental framework that guides the broader purposes of software agents.