智能体的认知架构
深入了解用于模拟人类式推理和学习过程的成熟认知架构(例如 SOAR、ACT-R)。
智能体的认知架构 是 CoddyKit 上的免费 AI Agents with LangChain & Autonomous Workflows 课时。 这是第 4 节课,共 6 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 AI Agents with LangChain & Autonomous Workflows 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 AI Agents with LangChain & Autonomous Workflows 课程共包含 6 节课。
本课时的部分内容尚未翻译,以英文显示。
Intro to Cognitive Agents
Welcome! Today, we'll explore Cognitive Architectures. These aren't just simple programs; they're frameworks designed to mimic human-like reasoning, learning, and decision-making in AI agents.
They bridge the gap between reactive agents and truly intelligent systems capable of complex problem-solving.
Why Cognitive Architectures?
Simple agents react to immediate percepts. But what if an agent needs to plan, learn from mistakes, or understand complex situations?
- Human-like Intelligence: Model how humans think.
- General Problem Solving: Tackle diverse tasks, not just one.
- Learning & Adaptation: Improve performance over time.
- Robustness: Handle unexpected situations.
Core Components of Cognition
Most cognitive architectures share common building blocks, inspired by human psychology:
- Perceptual System: How the agent "sees" the world.
- Memory Systems: Short-term (working) and long-term knowledge.
- Decision-Making: How the agent chooses its next action.
- Motor System: How the agent acts on the world.
SOAR: State, Operator, Result
SOAR (State, Operator, And Result) is a classic cognitive architecture. It views all intelligence as a continuous process of problem-solving, represented as searching through a state space.
SOAR operates in decision cycles, constantly choosing operators to apply to the current state to reach a desired result.
SOAR's Working Memory
SOAR's working memory holds the agent's current understanding of the world, its goals, and the current problem state. It's temporary and constantly updated.
Think of it as the agent's "consciousness" at any given moment. Here's a simplified representation:
public class SoarWorkingMemory {
String goal;
String currentState;
boolean obstacleDetected;
public SoarWorkingMemory(String goal, String state) {
this.goal = goal;
this.currentState = state;
this.obstacleDetected = false;
}
public void updateState(String newState) {
this.currentState = newState;
}
public String toString() {
return "Goal: " + goal + ", State: " + currentState +
", Obstacle: " + obstacleDetected;
}
public static void main(String[] args) {
SoarWorkingMemory wm = new SoarWorkingMemory("ReachExit", "StartRoom");
System.out.println(wm);
wm.updateState("Corridor");
System.out.println(wm);
}
}SOAR's Production Rules
SOAR uses production rules (if-then rules) in its long-term memory to propose and select operators. When a rule's if condition matches the working memory, its then part proposes an action or modifies the state.
This example shows a simple rule for moving an agent:
public class SoarProductionRule {
public static void main(String[] args) {
String currentState = "near_door";
String goal = "exit_room";
System.out.println("Current State: " + currentState);
System.out.println("Goal: " + goal);
// A simple SOAR-like production rule
if (currentState.equals("near_door") && goal.equals("exit_room")) {
System.out.println("Rule Fired: Propose 'open_door_operator'");
System.out.println("Action: Agent opens the door.");
currentState = "door_open"; // State update
} else {
System.out.println("No matching rule fired.");
}
System.out.println("New State: " + currentState);
}
}SOAR's Learning: Chunking
A unique feature of SOAR is chunking. When the agent encounters an impasse (a situation where it can't decide what to do), it enters a sub-state to resolve it.
Once the impasse is resolved, SOAR "chunks" the experience, creating a new production rule that directly solves that type of impasse in the future. This is how SOAR learns!
ACT-R: Adaptive Control of Thought
ACT-R (Adaptive Control of Thought—Rational) is another prominent cognitive architecture. It's designed to model human cognition at a finer grain, focusing on psychological data and predicting human behavior.
ACT-R emphasizes a modular structure, with distinct memory systems and processes working together.
ACT-R's Memory Modules
ACT-R has several key modules, including:
- Declarative Memory: Stores factual knowledge (e.g., "Paris is the capital of France") as discrete units called chunks.
- Procedural Memory: Stores "how-to" knowledge (e.g., "how to tie a shoe") as production rules.
- Goal Module: Manages the agent's current goals.
- Imaginal Module: Holds temporary problem representations.
Activation & Utility in ACT-R
Unlike SOAR's pure rule-matching, ACT-R's modules interact based on activation and utility:
- Activation: Chunks in declarative memory have an activation level, influencing how quickly they can be retrieved. More relevant or recent chunks have higher activation.
- Utility: Production rules in procedural memory have a utility value, reflecting their past success. Rules with higher utility are more likely to be chosen.
Cognitive Arch. Check
Let's check your understanding of these cognitive architectures.
Recap: Cognitive Agents
We've explored Cognitive Architectures, frameworks that aim for human-like intelligence. We looked at:
- SOAR: Problem-solving as search, using production rules and learning via chunking.
- ACT-R: A modular system with declarative and procedural memory, guided by activation and utility.
These architectures provide powerful models for building agents that can reason, learn, and adapt in complex ways.
常见问题解答
「智能体的认知架构」课时是免费的吗?
是的 — 「智能体的认知架构」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 AI Agents with LangChain & Autonomous Workflows 课程的其余内容,请升级到 CoddyKit PRO。 AI Agents with LangChain & Autonomous Workflows 课程共包含 6 节课。
「智能体的认知架构」这节课中我会学到什么?
深入了解用于模拟人类式推理和学习过程的成熟认知架构(例如 SOAR、ACT-R)。 你通过在浏览器中直接运行的动手代码来练习 AI Agents with LangChain & Autonomous Workflows,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 AI Agents with LangChain & Autonomous Workflows 需要有经验吗?
无需任何先前经验。CoddyKit 上的 AI Agents with LangChain & Autonomous Workflows 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 6 节。
「智能体的认知架构」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 AI Agents with LangChain & Autonomous Workflows 课中编写并运行代码吗?
能。每节 AI Agents with LangChain & Autonomous Workflows 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。