# Agentic Prompting

## Agentic Prompting

**Agentic Prompting** represents a major leap in AI capabilities. Instead of just responding to a single request, this technique empowers a Large Language Model to act as an **autonomous agent**. An agent can break down a high-level goal into a sequence of steps and use a set of tools to accomplish it without constant human intervention.

It's the difference between giving someone a fish (a simple prompt) and giving them a fishing rod and teaching them how to use it (an agent).

#### The Core Components of an Agent

An AI agent is typically built with three key components:

1. **A High-Level Goal:** The user provides a complex, open-ended objective. For example, "Research the top 3 electric vehicles released this year and compile a report comparing their price, range, and features."
2. **A Set of Tools:** The agent has access to a variety of tools it can choose to use. These can include:
   * A web search function
   * A calculator
   * A code interpreter (to run Python, for example)
   * Other APIs (for booking flights, checking weather, etc.)
3. **A Reasoning Loop:** This is the agent's "brain." It constantly cycles through a process of **Thought → Action → Observation**.
   * **Thought:** The LLM decides what the next logical step should be to move closer to the goal.
   * **Action:** The LLM chooses a tool and uses it to execute that step.
   * **Observation:** The LLM analyzes the result from the tool and uses this new information to inform its next thought.

This loop continues until the high-level goal is achieved.

#### Example: A Travel Agent Bot

Let's see how an agent would handle a complex travel request.

**User Goal:** `"Plan a 4-day trip to Marrakesh, Morocco from my current location for mid-October. My budget is $1,500."`

**Agent's Internal Monologue & Actions:**

1. **Thought:** I need to find flights first to determine the bulk of the cost. I know the user is in Temsia, Morocco and the destination is Marrakesh (RAK). Dates are mid-October.
   * **Action:** Use `flight_search_tool(origin="Agadir-Al Massira Airport", destination="RAK", dates="2025-10-15 to 2025-10-18")`.
2. **Observation:** Flight results are back. The best round-trip flight costs $150. My remaining budget is $1,350.
3. **Thought:** Now I need a hotel for 3 nights. The budget is tight, so I should look for well-rated riads under $250/night.
   * **Action:** Use `hotel_search_tool(city="Marrakesh", check_in="2025-10-15", check_out="2025-10-18", max_price=250, min_rating=4.5)`.
4. **Observation:** Found several highly-rated riads. "Riad Yasmine" is available for $200/night, totaling $600. My remaining budget is now $1350 - $600 = $750.
5. **Thought:** I have a good amount left for activities. I should suggest a popular food tour and a trip to the Atlas Mountains.
   * **Action:** Use `experience_search_tool(city="Marrakesh", keywords=["food tour", "Atlas Mountains"])`.
6. **Observation:** Found a food tour for $80 and a day trip for $120. Total activity cost is $200.
7. **Thought:** The total planned cost is $150 (flight) + $600 (hotel) + $200 (activities) = $950. This is well under the $1,500 budget. I have all the components. I can now assemble the final itinerary and present it to the user.
   * **Action:** Format the final plan and present it to the user.

Agentic prompting is the foundation for building powerful, autonomous AI applications that can perform complex tasks in the real world.
