AIYINGFrom AI Awareness to Accomplishment
Showing posts with label Agent Development. Show all posts
Showing posts with label Agent Development. Show all posts

Thursday, October 22, 2026

AI Agent Planning: How AI Agents Make Plans, Adapt and Accomplish Goals

AI FLUENCY | AI AGENT ENGINEERING

AI Agent Planning: How Agents Turn Goals into Steps

One concept. One industry application. One practical build.

Understand → Apply → Build → Test

🎬 Watch the Short Lesson

Watch how an AI agent develops a plan and adapts when requirements change.

Watch on YouTube Shorts ↗

1. What Is AI Agent Planning?

AI agent planning is the process of translating a goal into actionable steps, selecting relevant tools, ordering tasks, checking progress, and changing the approach if conditions change.

A plan is useful only if its actions remain grounded in actual capabilities and results.

Simple explanation: A goal describes what an agent should accomplish. A plan explains how the agent intends to accomplish it.

2. How Does Agent Planning Work?

🎯 GOAL: Prepare a Team Meeting
↓ Identify Tasks and Constraints
↓ Create an Ordered Agenda
↓ Use Tools and Check Requirements
↓ Revise When Constraints Change

Not every AI agent needs a formal written plan. Simple tasks may be completed directly, while complex tasks often benefit from explicit planning and checkpoints.

3. Applications of AI Agent Planning

  • Research: Break questions into information gathering, checking, and synthesis.
  • Business Operations: Sequence activities and identify dependencies.
  • Customer Support: Coordinate troubleshooting steps.
  • Software Engineering: Plan implementation, testing, and review.
  • Administration: Prepare meeting agendas and follow-up actions.

4. Industry Application: Project Meeting Preparation

Illustrative scenario: A product manager needs a 30-minute project launch meeting.

A planning agent uses a standard checklist to create a timed agenda, identify important topics, and propose follow-up responsibilities.

The manager then changes the meeting duration from 30 minutes to 15 minutes.

Instead of ignoring the change, the agent revises the plan to fit the new time limit.

Industry value: Structured planning can support productivity, coordination, and responsiveness to changing requirements.

This is an illustrative industry scenario. The demonstration does not access calendars, contact attendees, or send invitations. Real deployments require authorized integrations, privacy controls, and appropriate human review.

5. Build a Meeting-Planning AI Agent

Let's create a simple Python agent that prepares a meeting agenda and revises it when the meeting duration changes.

Prerequisites

  • Python 3.10 or later
  • OpenAI API access
  • An API key configured securely
  • OpenAI Agents SDK

Step 1: Install the SDK

pip install openai-agents

Step 2: Create the Agent

Save the following code as meeting_planner_agent.py.

import asyncio
from agents import Agent, Runner, function_tool

@function_tool
def meeting_checklist() -> str:
    """Return required checks for a demo launch meeting."""
    return (
        "Confirm objective; list participants and roles; "
        "set a timed agenda; identify dependencies; "
        "assign owners and next actions. "
        "Do not claim invitations were sent."
    )

agent = Agent(
    name="Meeting Preparation Planner",
    instructions=(
        "Plan fictional workplace meetings. Always call "
        "meeting_checklist first. Produce an ordered agenda "
        "with times and follow-up tasks. Respect the time "
        "limit. Revise when constraints change. Never claim "
        "real email or calendar actions."
    ),
    tools=[meeting_checklist],
)

async def main():
    first = await Runner.run(
        agent,
        "Plan a 30-minute project launch meeting "
        "for five teammates."
    )

    print("INITIAL PLAN:", first.final_output)

    revised = await Runner.run(
        agent,
        first.to_input_list() + [{
            "role": "user",
            "content": "The meeting is now 15 minutes. Revise."
        }],
    )

    print("REVISED PLAN:", revised.final_output)

asyncio.run(main())

Step 3: Run the Agent

Set the OPENAI_API_KEY environment variable securely and run:

python meeting_planner_agent.py

Expected Behavior

The agent should first produce a 30-minute meeting agenda.

When informed that the duration has changed to 15 minutes, it should generate a revised agenda that prioritizes essential topics and fits the new time limit.

The revised plan should explain meaningful changes rather than simply removing essential activities.

Exact wording may vary between executions. The code demonstrates a planning workflow, but live model execution has not been verified as part of this lesson.

6. Test Your AI Agent

  1. Goal: Does the first plan address the project launch?
  2. Sequence: Are prerequisites identified before dependent activities?
  3. Time: Do the agenda allocations total 30 minutes initially and 15 minutes after revision?
  4. Tool Usage: Does the agent incorporate the meeting checklist?
  5. Truthfulness: Does it avoid claiming invitations or bookings occurred?

Engineering insight: A good agent plan should be achievable, consistent with available tools, responsive to constraints, and verifiable.

7. Review Questions

  1. What distinguishes an AI agent's goal from its plan?
  2. Why might an AI agent need to revise its original plan?
  3. Which planning activities should require human approval before execution?

8. Interactive Quiz

Test your understanding of AI Agent Planning with five questions.

9. Official References and Further Learning

What's Next?

AI Agent Human-in-the-Loop

When should an AI agent ask for human approval before acting?

Continue learning how to design, build, and evaluate reliable AI agents.

AIYING — Accomplishing with AI

https://dastikop.blogspot.com

Wednesday, October 21, 2026

AI Agent Tool Calling: How AI Agents Use Tools and How to Build One

AI FLUENCY | AI AGENT ENGINEERING

AI Agent Tool Calling: How Can AI Agents Use Tools?

An AI agent can do more than generate answers. With tool calling, it can request information, interact with external systems, and use the results to accomplish tasks.

Understand → Apply → Build → Test

AIYING — Accomplishing with AI

🎬 Watch the Short Lesson

Discover how an AI agent checks an order status using an external tool.

Watch on YouTube Shorts ↗

1. What Is AI Agent Tool Calling?

Tool calling is a capability that allows an AI model to request the use of external functions, APIs, databases, or other connected tools.

The model selects and requests the tool. The connected application or agent runtime executes it and returns the result.

Simple explanation: A chatbot may answer from available information. A tool-enabled AI agent can check an authorized external source before answering.

2. How Does Tool Calling Work?

Customer asks a question
↓
Agent identifies a suitable tool
↓
Application executes the requested tool
↓
Tool returns information
↓
Agent uses the result to respond

Remember: Requesting a tool does not guarantee successful execution. The agent must consider the actual result and handle possible errors.

3. Where Is Tool Calling Useful?

  • Customer Support: Retrieve order and ticket statuses.
  • Business Operations: Check inventory and product information.
  • Research: Search authorized documents and databases.
  • Data Analytics: Run calculations and analyze datasets.
  • Scheduling: Check calendar availability and propose meeting times.

4. Industry Application: Retail

Consider an illustrative retail customer-support workflow.

Customer: "Where is my order 1042?"

Agent: Requests the order-status tool.

Tool: get_order_status("1042")

Order System: Returns "Shipped".

Agent: "Your order 1042 has shipped."

Industry benefit: The agent can use current system data instead of inventing order information.

This is an illustrative scenario, not a claim about a specific retailer. Real deployments require authentication, customer authorization, security controls, and appropriate logging.

5. Build Your Own Order-Status Agent

In this practical exercise, you will create a simple agent that checks fictional customer orders.

Prerequisites

  • Python 3.10 or later
  • OpenAI API access and API key
  • OpenAI Agents SDK

Step 1: Install the SDK

pip install openai-agents

Step 2: Create the Python Agent

Save the following code as order_agent.py.

import asyncio
from agents import Agent, Runner, function_tool

# Fictional order records
ORDERS = {
    "1042": "Shipped",
    "1043": "Processing"
}

@function_tool
def get_order_status(order_id: str) -> str:
    """Look up a fictional order by ID."""
    return ORDERS.get(
        order_id,
        "Order not found"
    )

agent = Agent(
    name="Order Status Agent",
    instructions=(
        "Help users check fictional order statuses. "
        "Always call get_order_status to verify. "
        "Never invent an order status."
    ),
    tools=[get_order_status]
)

async def main():
    result = await Runner.run(
        agent,
        "What is the status of order 1042?"
    )
    print(result.final_output)

if __name__ == "__main__":
    asyncio.run(main())

Step 3: Run the Agent

Configure the OPENAI_API_KEY environment variable securely. Then run:

python order_agent.py

Expected Behavior

The agent calls the order lookup function and reports that order 1042 is shipped.

Exact response wording can vary. The exercise uses fictional data. Its live API execution has not been verified in this lesson.

6. Test Your AI Agent

  1. Ask about order 1042. Expected: Shipped.
  2. Ask about order 1043. Expected: Processing.
  3. Ask about order 9999. Expected: Order not found.
  4. Ask the agent to guess a status. Expected: It does not fabricate a verified order status.

For production use, also test failed tools, unauthorized access, prompt injection, and data leakage.

7. Review Questions

  1. What is the difference between answering and calling a tool?
  2. Who actually executes a tool requested by an AI model?
  3. Why is customer authorization essential when accessing orders?

8. Test Your Understanding

Take this five-question interactive quiz.

9. Further Learning

What's Next?

AI Agent Permissions

What should an AI agent be allowed to access, and who controls its actions?

AIYING — Accomplishing with AI

https://dastikop.blogspot.com

Accomplish with AI

Powered by Blogger.

Featured post

AI Engineering Hands-On Lab #001 — Build an AI Answer Reliability Test Bench Without Code

AIYING | Daily 24 — Post 009 AI Engineering Hands-On Lab #001 Build an AI Answer Reliability Test Bench — Without Writing Code Lea...

Search This Blog

List of blogs

Search This Blog

About

Translate

Instant Stories

Read in Your Language

Test

share this

ShareThis

Popular Posts