The Thought-Action-Observation Cycle

Introduction to AI Agents

Adel Nehme

VP of AI Curriculum, DataCamp

The Agentic Trinity: Model, Tools, and Orchestration

model

1 Wiesinger, J., Marlow, P., & Vuskovic, V. (n.d.). Agents.
Introduction to AI Agents

The Agentic Trinity: Model, Tools, and Orchestration

tools

1 Wiesinger, J., Marlow, P., & Vuskovic, V. (n.d.). Agents.
Introduction to AI Agents

The Agentic Trinity: Model, Tools, and Orchestration

orchestration

1 Wiesinger, J., Marlow, P., & Vuskovic, V. (n.d.). Agents.
Introduction to AI Agents

Maintaining Memory, State, Reasoning, and Planning

detailed_orchestration

1 Wiesinger, J., Marlow, P., & Vuskovic, V. (n.d.). Agents.
Introduction to AI Agents

The Thought-Action-Observation Cycle

TAO_cycle

1 The Hugging Face Agents Course: https://github.com/huggingface/agents-course
Introduction to AI Agents

The Thought-Action-Observation Cycle

$$

TAO

$$

$$

$$

Thought: The model decides the next step based on the user prompt.

1 The Hugging Face Agents Course: https://github.com/huggingface/agents-course
Introduction to AI Agents

The Thought-Action-Observation Cycle

$$

TAO

$$

$$

$$

Action: The agent takes an action, by calling the tools at their disposal.

1 The Hugging Face Agents Course: https://github.com/huggingface/agents-course
Introduction to AI Agents

The Thought-Action-Observation Cycle

$$

TAO

$$

$$

$$

Observation: The model reflects on the response from the tool. Feeding into the next set of thoughts and actions.

1 The Hugging Face Agents Course: https://github.com/huggingface/agents-course
Introduction to AI Agents

A Customer Support Agent Example

ai_cust_support

$$

$$

$$

"I forgot to cancel my subscription and was accidentally billed. Help me get a refund."

1 Image generated with GPT-4o
Introduction to AI Agents

The Thought-Action-Observation Cycle

Introduction to AI Agents

The Thought-Action-Observation Cycle

Cycle Thought Action Observation
1 "I need to understand this customer's situation. Let me check their account details." Access customer database and retrieve subscription history Customer has premium plan, renewed 3 days ago for $99
Introduction to AI Agents

The Thought-Action-Observation Cycle

Cycle Thought Action Observation
1 "I need to understand this customer's situation. Let me check their account details." Access customer database and retrieve subscription history Customer has premium plan, renewed 3 days ago for $99
2 "The renewal is recent. I should check our refund policy for accidental renewals." Query company policy database for refund rules Policy allows full refunds within 7 days for accidental renewals
Introduction to AI Agents

The Thought-Action-Observation Cycle

Cycle Thought Action Observation
1 "I need to understand this customer's situation. Let me check their account details." Access customer database and retrieve subscription history Customer has premium plan, renewed 3 days ago for $99
2 "The renewal is recent. I should check our refund policy for accidental renewals." Query company policy database for refund rules Policy allows full refunds within 7 days for accidental renewals
3 "Great, they qualify! Now I need to process the refund." Initiate refund transaction through payment system Refund of $99 successfully processed
Introduction to AI Agents

The Thought-Action-Observation Cycle

Cycle Thought Action Observation
1 "I need to understand this customer's situation. Let me check their account details." Access customer database and retrieve subscription history Customer has premium plan, renewed 3 days ago for $99
2 "The renewal is recent. I should check our refund policy for accidental renewals." Query company policy database for refund rules Policy allows full refunds within 7 days for accidental renewals
3 "Great, they qualify! Now I need to process the refund." Initiate refund transaction through payment system Refund of $99 successfully processed
4 "Refund complete. I should update the customer and cancel their subscription to prevent future charges." Send confirmation email and update subscription status to 'cancelled' Email sent, subscription cancelled, ticket can be closed
Introduction to AI Agents

The Thought-Action-Observation Cycle

customer_support_happy

$$

$$

$$

Final action: Ticket now can be closed

1 Image generated with GPT-4o
Introduction to AI Agents

Let's Practice!

Introduction to AI Agents

Preparing Video For Download...