Introduction
Imagine a robot trying to complete a task in a room. It needs a way to notice what is around it, decide what to do, and then take action. This process helps the robot work step-by-step to achieve its goal.
Jump into concepts and practice - no test required
Imagine a person crossing a busy street. They first look both ways to see if cars are coming (observe). Then, they decide when it is safe to cross (think). Finally, they walk across the street (act).
┌─────────┐ ┌────────┐ ┌───────┐ │ Observe │ → │ Think │ → │ Act │ └─────────┘ └────────┘ └───────┘
observe step in an agent architecture?class Agent:
def observe(self, data):
self.data = data
def think(self):
return self.data * 2
def act(self, result):
print(f"Action: {result}")
agent = Agent()
agent.observe(5)
result = agent.think()
agent.act(result)class Agent:
def observe(self, data):
self.data = data
def think(self):
return self.data + 1
def act(self, result):
print(f"Action: {result}")
agent = Agent()
result = agent.think()
agent.act(result)think method?