Answer
PBA in AI (Perception, Brain, Action)
PBA (Perception-Brain-Action) is a framework for understanding how AI agents are structured, analogous to the human cognitive loop.
The PBA Framework
textEnvironment ↓ [PERCEPTION] — senses the environment ↓ [BRAIN] — processes, reasons, decides ↓ [ACTION] — acts on the environment ↑ └────────────── feedback loop
Each Component Explained
| Component | In Humans | In AI Agents |
|---|---|---|
| Perception | Eyes, ears, skin | Input processing (text, images, sensor data) |
| Brain | Neocortex — reasoning | LLM — language model that reasons |
| Action | Hands, voice, movement | Tool calls, API calls, file writes, messages |
PBA in AI Agent Architecture
pythonclass AIAgent: def __init__(self, llm, tools, memory): self.llm = llm # Brain self.tools = tools # Action mechanisms self.memory = memory # Part of Brain (long-term storage) def perceive(self, environment_input): '''PERCEPTION: Process raw input into structured context''' return { "raw_input": environment_input, "retrieved_memory": self.memory.search(environment_input), "context": self.process_input(environment_input) } def think(self, perception: dict) -> str: '''BRAIN: Reason and decide next action''' prompt = f''' Context: {perception['context']} Memory: {perception['retrieved_memory']} Task: {perception['raw_input']} What should I do next? Choose a tool or respond directly. ''' return self.llm.invoke(prompt) def act(self, decision: str): '''ACTION: Execute the decided action''' tool_name, tool_args = self.parse_decision(decision) if tool_name in self.tools: result = self.tools[tool_name](**tool_args) self.memory.store(result) # Update memory return result return decision # Direct response def run(self, task: str): '''Full PBA loop''' while True: perception = self.perceive(task) decision = self.think(perception) result = self.act(decision) if self.is_complete(result): return result task = f"Previous result: {result}. Continue..."
PBA Mapping to Modern AI Systems
| System | Perception | Brain | Action |
|---|---|---|---|
| ChatGPT | Text input | GPT-4o | Text output only |
| Claude Code | Files + terminal | Claude | File edits, shell commands |
| AutoGPT | Web + files | GPT-4 | Web search, file I/O |
| Robot AI | Camera, LIDAR | Neural net | Motor commands |
| Self-driving | Cameras, radar | Perception + decision model | Steering, braking |
Expanded PBA: Adding Memory
Modern agent frameworks extend PBA with memory layers:
textPERCEPTION → Working Memory (context window) ↓ BRAIN (LLM reasoning) ↕ Long-term Memory (vector DB) ↓ ACTION ← Decision ← Reasoning
Why PBA Matters for Gen AI Engineers
Understanding PBA helps you design better agents:
- Perception — what data should the agent receive? How to preprocess it?
- Brain — which LLM? How to structure reasoning prompts?
- Action — what tools does the agent need? How to handle failures?
- Feedback — how does the agent learn from action results?
Every AI agent framework (LangGraph, AutoGen, CrewAI) implements some version of this PBA loop.