The agent function: perceive, reason, act
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: 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.