এআই এজেন্ট তৈরি করা সফটওয়্যার ডেভেলপমেন্টে একটি উল্লেখযোগ্য অগ্রগতি, যা সিস্টেমগুলোকে জটিল যুক্তি সম্পাদন করতে এবং আরও বেশি স্বায়ত্তশাসনের সাথে কাজ করতে সক্ষম করে। তবে, এই সিস্টেমগুলোকে চালনাকারী মৌলিক মডেলগুলো স্বাভাবিকভাবেই তাদের প্রশিক্ষণ ডেটা দ্বারা সীমাবদ্ধ থাকে। বাহ্যিক প্রেক্ষাপট ছাড়া, তাদের রিয়েল-টাইম পরিস্থিতি সম্পর্কে সচেতনতার অভাব থাকে, যেমন বাইরের বর্তমান আবহাওয়া, স্থানীয় কোনো ব্যবসা এই মুহূর্তে খোলা আছে কিনা, বা কোনো গন্তব্যে পৌঁছানোর সবচেয়ে কার্যকর পথ কোনটি।
এই ডকুমেন্টটিতে বিস্তারিতভাবে বর্ণনা করা হয়েছে কীভাবে গুগল ম্যাপস থেকে প্রাপ্ত নির্ভরযোগ্য ভূ-স্থানিক ডেটা দিয়ে আপনার এআই এজেন্টদের গ্রাউন্ডিং করার মাধ্যমে স্থির যুক্তি এবং গতিশীল বাস্তবতার মধ্যেকার ব্যবধান পূরণ করা যায়। আপনি জানতে পারবেন বাস্তব-জগতের কাজগুলোর জন্য স্থানিক গ্রাউন্ডিং কেন অপরিহার্য, কীভাবে মডেল কনটেক্সট প্রোটোকল (MCP) টুল ইন্টিগ্রেশনকে সহজ করে, এবং কীভাবে গুগল ম্যাপস গ্রাউন্ডিং লাইট MCP ব্যবহার করে একটি ভ্রমণ-পরিকল্পনা এজেন্ট তৈরি করতে হয়।

এজেন্টদের কেন মানচিত্র ডেটা গ্রাউন্ডিং প্রয়োজন
প্রচলিত সফটওয়্যার থেকে এজেন্টিক ওয়ার্কফ্লোতে রূপান্তর হলো ডিটারমিনিস্টিক ইঞ্জিনিয়ারিং থেকে প্রোবাবিলিস্টিক অর্কেস্ট্রেশনের দিকে একটি পরিবর্তন। আমরা এমন সিস্টেম থেকে সরে আসছি যা কেবল তথ্য জানে, এবং এমন প্রোঅ্যাকটিভ এক্সিকিউশন ইঞ্জিনের দিকে যাচ্ছি যা বাস্তবে কাজ করে। যখন কোনো অ্যাপ্লিকেশন সেই সীমা অতিক্রম করে বাস্তব জগতে পদক্ষেপ নেয়, তখন নির্ভুলতার গুরুত্ব পুরোপুরি বদলে যায়।
লার্জ ল্যাঙ্গুয়েজ মডেল (এলএলএম) যুক্তি বোঝে, কিন্তু এর অভ্যন্তরীণ স্মৃতি হলো একটি ঐতিহাসিক মুহূর্তের ছবি। উদাহরণস্বরূপ, যদি কোনো এজেন্ট একটি সাপ্লাই চেইন পরিচালনা করার সময় কোনো সরবরাহকারীর প্রাপ্যতা বা রাস্তার রুট ভুলভাবে নিশ্চিত করে, তাহলে এর ফলে জ্বালানির অপচয়, এসএলএ (SLA) পূরণে ব্যর্থতা এবং প্রকৃত ব্যবসায়িক ব্যাঘাত ঘটবে। আর মাল্টি-এজেন্ট আর্কিটেকচারে, আপনি একটি ক্রমিক বিভ্রম সমস্যার সম্মুখীন হবেন। যদি চেইনের কোনো একটি এজেন্ট বিভ্রমের শিকার হয়ে দ্বিতীয় এজেন্টকে ভুল তথ্য দেয়, তাহলে পুরো সিস্টেমটি একটি মিথ্যার উপর ভিত্তি করে বাস্তব জগতের প্রতিশ্রুতি দিতে শুরু করে। সত্য ছাড়া স্বায়ত্তশাসন একটি বিশাল দায়ে পরিণত হয়।
গ্রাউন্ডিং-এর জন্য এজেন্টকে তার প্রশিক্ষণের সীমার বাইরে যেতে হয়। প্লেসেস ডেটা এবং রাউটিং ডেটার মতো যাচাইযোগ্য, লাইভ তথ্য সংগ্রহ করতে এআই-কে বাধ্য করার মাধ্যমে, আপনি এজেন্টকে রিয়েল-টাইম চোখ ও কান দেন, যা একটি পরিসংখ্যানগত অনুমানকে একটি সুচিন্তিত অপারেশনাল সিদ্ধান্তে রূপান্তরিত করে।
কেন এমসিপি
মডেল কনটেক্সট প্রোটোকল (MCP) হলো একটি উন্মুক্ত স্ট্যান্ডার্ড, যা টুল এবং ডেটা ইন্টিগ্রেশনকে প্লাগ-এন্ড-প্লে করার জন্য ডিজাইন করা হয়েছে।
ঐতিহাসিকভাবে, একটি এআই মডেলকে বাহ্যিক এপিআই-এর সাথে সংযুক্ত করার জন্য কঠোর, বিশেষায়িত র্যাপার লিখতে হতো। প্রতিটি স্বতন্ত্র সক্ষমতার জন্য আপনাকে ম্যানুয়ালি ফরম্যাটিং, ত্রুটি পার্সিং এবং টুল-কল অনুবাদের কাজ করতে হতো।
এমসিপি এই ইন্টিগ্রেশন লেয়ারকে মানসম্মত করে। একটি এমসিপি ক্লায়েন্ট বাস্তবায়নের মাধ্যমে, আপনার অ্যাপ্লিকেশন একটি সমন্বিত প্রোটোকল ব্যবহার করে সার্ভার-প্রদত্ত টুলগুলো গতিশীলভাবে খুঁজে বের করতে এবং কার্যকর করতে পারে। এর ফলে ডেভেলপারের মনোযোগ পুনরাবৃত্তিমূলক এপিআই ইন্টিগ্রেশন লজিক লেখা থেকে সরে এসে উচ্চ-স্তরের এজেন্টিক নেটওয়ার্ক ডিজাইন করার দিকে চলে যায়।
গুগল ম্যাপস গ্রাউন্ডিং লাইট এমসিপি
Google Maps Grounding Lite MCP হলো একটি সম্পূর্ণভাবে পরিচালিত, গুগল-হোস্টেড MCP সার্ভার যা যেকোনো সামঞ্জস্যপূর্ণ এজেন্টিক ফ্রেমওয়ার্কের সাথে সরাসরি সংযুক্ত করা যায়।
বর্তমানে, সার্ভারটি গ্রাউন্ডিংয়ের জন্য তিনটি মূল টুল সরবরাহ করে:
- স্থান অনুসন্ধান করুন : স্থান সম্পর্কে তথ্যের জন্য অনুরোধ করুন এবং AI-দ্বারা তৈরি স্থানের ডেটার সারাংশ পান। এর সাথে সারাংশে অন্তর্ভুক্ত প্রতিটি স্থানের জন্য প্লেস আইডি, অক্ষাংশ ও দ্রাঘিমাংশের স্থানাঙ্ক এবং গুগল ম্যাপস লিঙ্কও পাবেন। প্রাপ্ত প্লেস আইডি এবং অক্ষাংশ ও দ্রাঘিমাংশের স্থানাঙ্ক ব্যবহার করে আপনি মানচিত্রে স্থানগুলো প্রদর্শন করতে পারবেন।
- আবহাওয়া অনুসন্ধান করুন : আবহাওয়া সংক্রান্ত তথ্যের জন্য অনুরোধ করুন এবং বর্তমান অবস্থা, ঘণ্টাভিত্তিক পূর্বাভাস ও দৈনিক পূর্বাভাস জানুন।
- পথ গণনা করুন : দুটি স্থানের মধ্যে গাড়ি বা হাঁটার পথের তথ্য এবং ফিরতি পথের দূরত্ব ও সময়কাল সম্পর্কে জানতে অনুরোধ করুন।
পরিষেবাটি অ্যাক্সেস করতে, আপনি একটি এপিআই কী (API Key) অথবা ওঅথ (OAuth) ব্যবহার করতে পারেন। গুগল ম্যাপস প্ল্যাটফর্ম একটি বিনামূল্যের ডেমো এপিআই কী প্রদান করে, যা বিশেষভাবে ডেভেলপারদের অবিলম্বে প্রোটোটাইপিং শুরু করতে সাহায্য করার জন্য ডিজাইন করা হয়েছে।

এমসিপি-কে ভিত্তি করে মানচিত্র একীভূত করার সর্বোত্তম অনুশীলন
ডেটার প্রাসঙ্গিকতা সর্বাধিক করতে এবং কাঠামোগত বিভ্রম দূর করতে, আপনার এজেন্টের সিস্টেম নির্দেশাবলীকে এই মূল কৌশলগুলির উপর ভিত্তি করে তৈরি করুন: * সুস্পষ্ট এবং সুনির্দিষ্ট হোন : এজেন্টকে সুনির্দিষ্ট অবস্থান ব্যবহার করার নির্দেশ দিন। "নিউ ইয়র্ক"-এর চেয়ে "সেন্ট্রাল পার্ক, নিউ ইয়র্ক" ভালো ফলাফল দেয়, ঠিক যেমন "প্যারিস, ফ্রান্স" প্যারিস, টেক্সাসের সাথে বিভ্রান্তি রোধ করে।
সাধারণ অনুসন্ধানগুলোকে ভেঙে ফেলুন : "ডেট নাইটের আইডিয়া"-র মতো অস্পষ্ট অনুরোধের ক্ষেত্রে, এজেন্টকে কাজটি "রোমান্টিক রেস্তোরাঁ," "সিনেমা হল," বা "ককটেল বার"-এর মতো নির্দিষ্ট উপ-অনুসন্ধানে বিভক্ত করতে বলুন।
প্রথমে আবিষ্কার, পরে অনুসন্ধান : প্রথমে একটি বিস্তৃত অনুসন্ধান করুন (যেমন, "রবিবার খোলা প্রতিবন্ধী-বান্ধব প্রবেশপথসহ জাপানি রেস্তোরাঁ")। ব্যবহারকারীকে বিকল্পগুলি দেখান, এবং তারপরে নির্বাচিত স্থানটির ফোন নম্বরের মতো নির্দিষ্ট বিবরণ সংগ্রহ করতে একটি ফলো-আপ কোয়েরি চালান।
প্লেস আইডি নিয়ে কখনো বিভ্রান্ত হবেন না : প্লেস আইডি হলো গুগল ম্যাপস প্ল্যাটফর্মের বিভিন্ন পরিষেবার মধ্যে একটি অত্যন্ত গুরুত্বপূর্ণ সংযোগকারী সূত্র। নিশ্চিত করুন যে আপনার এজেন্ট জানে যে তাকে অবশ্যই শুধুমাত্র `search_places` টুল দ্বারা স্পষ্টভাবে প্রাপ্ত প্লেস আইডি ব্যবহার করতে হবে, নিজেরা কোনো আইডি তৈরি করার চেষ্টা করা যাবে না।
Google ADK ব্যবহার করে একটি ভ্রমণ পরিকল্পনা এজেন্ট বাস্তবায়ন করুন।
এই বিভাগে দেখানো হয়েছে কিভাবে গুগল এজেন্ট ডেভেলপমেন্ট কিট (ADK) ফ্রেমওয়ার্ক ব্যবহার করে একটি ভ্রমণ পরিকল্পনা এজেন্ট তৈরি করতে হয়। যদি আপনার ADK ইনস্টল করা না থাকে, তাহলে গুগল ADK ডেভ ডক দেখুন।
ADK-এর মতো কোনো এজেন্ট ফ্রেমওয়ার্কে Maps MCP সার্ভারকে একীভূত করা খুবই সহজ। ADK কন্টেক্সট ম্যানেজমেন্টের জটিলতাগুলো সামলে নেয়, ফলে আপনি এজেন্টের আচরণের উপর মনোযোগ দিতে পারেন।
নমুনা প্রকল্পটির কাঠামোটি নিম্নরূপ:
travel-concierge-google-maps-mcp/
├── travel_planner_agent/
├── agent.py # main agent code
├── .env # API keys
├── __init__.py
├── skills/travel-concierge/
├── SKILL.md # Agent skill
agent.py-এর একটি নমুনা। আপনার ব্যবহারের ক্ষেত্র অনুযায়ী এটি সম্পাদনা করুন।
import os
import pathlib
import logging
from datetime import date
from dotenv import load_dotenv
from google.adk.agents.llm_agent import Agent
from google.adk.skills import load_skill_from_dir
from google.adk.tools import skill_toolset
from google.adk.tools.mcp_tool import McpToolset
from google.adk.planners import BuiltInPlanner
from google.genai import types
from google.adk.tools.mcp_tool.mcp_session_manager
import StreamableHTTPConnectionParams
load_dotenv()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
GOOGLE_MAPS_API_KEY = os.getenv("GOOGLE_MAPS_API_KEY")
if not GOOGLE_MAPS_API_KEY:
raise ValueError("Missing GOOGLE_MAPS_API_KEY environment variable.")
current_date = date.today().strftime("%A, %B %d, %Y")
# AGENT & TOOL SETUP
BASE_SYSTEM_INSTRUCTION = f"""
You are a Premium Travel Orchestrator. Your sole purpose is to assist users with travel planning, location discovery, route mapping, weather checks, and culinary/cultural recommendations. The current system date is {current_date}.
# 1. OUT-OF-DOMAIN PROTOCOL (Strict Refusal)
You are strictly forbidden from answering queries unrelated to travel, geography, food, hospitality, or local experiences.
If a user asks about coding (e.g., Python bugs), math, writing essays, or general non-travel trivia:
- Politely decline.
- Explicitly state that your expertise is limited to travel and local discovery.
- Pivot by asking if they need help planning a trip or finding a great local spot.
# 2. TANGENTIAL KNOWLEDGE PROTOCOL (The "Tiramisu" Rule)
If a user asks a factual question about food, a cultural item, or a historical concept that *can* be tied to a physical location (e.g., "What is tiramisu?", "What is Gothic architecture?"):
- Provide a brief, helpful 1-2 sentence explanation of the concept.
- IMMEDIATELY pivot to your primary domain. Ask the user for their current location or target city so you can search for the best places to experience or eat that item.
# 3. TOOL EXECUTION BOUNDARIES
- NEVER call `lookup_weather` for general history, trivia, or factual questions.
- ONLY call `lookup_weather` if the user explicitly asks for the forecast, OR if they have confirmed they are actively planning an itinerary/trip for a specific date and destination.
"""
travel_skill = load_skill_from_dir(
pathlib.Path(__file__).parent / "skills" / "travel-concierge"
)
maps_mcp_toolset = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://mapstools.googleapis.com/mcp",
headers={
"X-Goog-Api-Key": GOOGLE_MAPS_API_KEY,
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream"
}
)
)
my_skill_toolset = skill_toolset.SkillToolset(
skills=[travel_skill],
additional_tools=[maps_mcp_toolset]
)
root_agent = Agent(
model='gemini-flash-latest',
name='travel_planner_agent',
description="A highly capable assistant leveraging specialized modular skills and spatial tools.",
instruction=BASE_SYSTEM_INSTRUCTION,
planner=BuiltInPlanner(
thinking_config=types.ThinkingConfig(
include_thoughts=True
)
),
tools=[my_skill_toolset]
)
SKILL.md-এর নমুনা। আপনার ব্যবহারের ক্ষেত্র অনুযায়ী এটি সম্পাদনা করুন।
name: travel-concierge
description:
Accesses real-time spatial data, weather, and traffic routing to design accurate itineraries and provide location-based information.
Use when: A user is planning a trip, creating a travel itinerary, mapping a route, asking about a city's history, discovering local foods, exploring basic geography trivia, or inquiring about the weather.
Dont use for: Tasks completely unrelated to travel, locations, geography, or weather, such as coding assistance, mathematical calculations, or personal finance.
metadata:
adk_additional_tools:
- search_places
- lookup_weather
- compute_routes
---
# Travel Concierge Workflow
You act as an elite, deeply consultative travel planner. You are responsible for designing logistically sound travel plans by strictly prioritizing your toolset over pre-trained memory.
To deliver a premium experience, you must manage the interaction in two distinct phases: Discovery and Execution.
## Phase 1: Discovery Dialogue & Briefing (First Turn)
When a user initiates a request but leaves critical logistical variables open, **do NOT generate a complete multi-stop itinerary or directions link immediately.** Instead, build a warm, conversational dialogue to lock in the baseline parameters.
1. **Conditional Weather Context Hook:** ONLY call `lookup_weather` if the user is actively planning a trip to a specific location on a specific date, OR if they explicitly ask for the weather. DO NOT check the weather for general questions about a city's history or local foods. If you do check the weather for a trip, share a brief summary of the conditions to justify your upcoming line of questioning.
2. **Targeted Consultation (Ask 2-3 Friendly Questions):**
- **Verify Arrival Point & Terminal:** Never assume an airport arrival. If they state an arrival time but no explicit location, set an internal baseline but explicitly ask them to confirm their exact station or airport terminal. **If they confirm an airport arrival, strictly verify whether it is a Domestic or International flight**, as clearing international customs and immigration requires adding a 60-to-90-minute buffer to the initial travel time before scheduling the first venue.
- **Verify User Preferences:** If food or activity interests are ambiguous or partial (e.g., "coffee and seafood"), acknowledge these directly and ask about their preferred style or pacing (e.g., casual local markets vs. seated upscale dining).
- **Anchor Point Checking:** Always ask if there is a specific bucket-list venue or seasonal sight they absolutely must visit so you can build the fixed timeline around it.
## Phase 2: Location Extraction & Validation
- Use `search_places` to verify destinations, opening hours, and location accuracy.
- **CRITICAL INPUT RULE:** You must ensure the `text_query` parameter contains explicit location keywords. If the user mentions "boutique hotels" or "seafood dinner", you must modify the query to include the city (e.g., text_query="boutique hotels in Sydney, Australia").
## Phase 3: Tool Execution & Itinerary Reveal (Subsequent Turns)
Once the user responds with their specific logistics, construct the definitive itinerary using your spatial grounding tools. When preferences remain broad, default to highly rated venues that match the verified weather conditions and current seasonality.
### 1. Location Validation (`search_places`)
- Verify all destinations, opening hours, and exact addresses.
- **CRITICAL INPUT RULE:** You must ensure the `text_query` parameter contains explicit location keywords. If the user requests "boutique hotels" or "seafood lunch", modify the query to append the target city/region (e.g., `text_query="seafood lunch in Sydney, Australia"`).
### 2. Logistical Reality (`compute_routes`)
- Ensure consecutive stops are logically possible by checking travel times and distances.
- Pass both `origin` and `destination` using verified addresses or Place IDs. If either is missing, halt and ask for clarification.
- Do NOT hallucinate Place ID. You must use the Place ID provided by `search_places`.
### 3. Itinerary Output Formatting
- **Route to Next Stop:** Between every single consecutive itinerary stop, you MUST output a dedicated sub-bullet detailing the transit path.
- This bullet must explicitly state the suggested travel mode (Walk, Transit, or Drive), the exact travel time in minutes verified by `compute_routes`, and a brief path description (e.g., *"Route to Next Stop: 12-minute walk via Market St"*).
- **Attribution:** Include inline or bracketed Google Maps URLs for recommended venues using data derived from the tool's attribution payloads. Do not guess links.
### 4. Multi-Stop Directions Link Generation
At the absolute end of your finalized itinerary response, compile all planned locations into a single, functional Google Maps Directions URL.
- **Format Constraint:** Build the URL using the base string: `https://www.google.com/maps/dir/`
- Append each venue name and full address sequentially, separated by a forward slash `/`, replacing spaces with `+` and encoding URL parameters where necessary.
- Example format: `https://www.google.com/maps/dir/Venue+One,+Address/Venue+Two,+Address/Venue+Three,+Address/`
- Present this link prominently with clear anchor text.
## Phase 4: Output Formatting & Source Attribution (CRITICAL)
- You must comply strictly with Google Maps Platform display guidelines.
- Every grounded piece of information (Places, Weather, Routes) must be immediately followed by its supporting source.
- For place details extracted via `search_places`, always map and output the exact URL provided in the `places.googleMapsLinks.placeUrl` payload. Do not invent links.
init .py
from . import agent
adk ওয়েব চালান এবং ইন্টারঅ্যাক্ট করুন
ডিফল্ট ADK ওয়েব UI চালু করতে, travel-concierge-google-maps-mcp প্রজেক্ট ডিরেক্টরিতে এই কমান্ডটি চালান:
adk web
UI-তে ইন্টারঅ্যাক্ট করুন:
- ব্রাউজারে http://127.0.0.1:8000-এ UI লোড করুন।
- এই ধরনের নির্দেশ চেষ্টা করুন:
- আমি শনিবার সান ফ্রান্সিসকোতে থাকব। আমার জন্য একদিনের ভ্রমণের পরিকল্পনা করুন।
- গোল্ডেন গেট পার্কের কাছাকাছি কফি শপগুলো খুঁজে বের করুন এবং আমাকে মেনুর বিশেষ আকর্ষণগুলো দেখান।
- GooglePlex থেকে SFO-তে যাওয়ার দিকনির্দেশনা নিন।
এজেন্ট যখন প্রম্পটটি পায়, তখন প্ল্যানার ব্যবহারকারীর উদ্দেশ্য মূল্যায়ন করে। এটি স্থানিক ও আবহাওয়ার তথ্যের প্রয়োজনীয়তা শনাক্ত করে এবং এমসিপি সার্ভার ব্যবহার করে স্বয়ংক্রিয়ভাবে lookup_weather, search_places, ও compute_routes টুলগুলো চালু করে। এরপর এজেন্ট ব্যবহারকারীর জন্য তথ্য-ভিত্তিক একটি ভ্রমণসূচি তৈরি করে।
উপসংহার
এজেন্টিক এআই-এর দিকে এই পরিবর্তন লজিস্টিকস, ভ্রমণ এবং খুচরা ব্যবসায় সম্পূর্ণ নতুন সক্ষমতা উন্মোচন করছে। তবে, প্রকৃত স্বায়ত্তশাসনের জন্য সত্যের এক অটল ভিত্তি প্রয়োজন।
গুগল ম্যাপস গ্রাউন্ডিং লাইট-এর পাশাপাশি মডেল কনটেক্সট প্রোটোকল ব্যবহার করে, আপনি কাস্টমাইজড এপিআই ইন্টিগ্রেশনের জটিলতা দূর করতে পারেন এবং আপনার এজেন্টদের প্রয়োজনীয় রিয়েল-টাইম তথ্য সরবরাহ করতে পারেন। লাইভ স্পেশিয়াল ডেটার উপর আপনার মডেলগুলোকে ভিত্তি করে, এটি নিশ্চিত করা হয় যে মডেলগুলো তাদের ট্রেনিং ডেটার কোনো স্থির চিত্রের উপর ভিত্তি করে নয়, বরং বাস্তব জগতে এই মুহূর্তে যা ঘটছে তার উপর ভিত্তি করেই পরিচালনগত সিদ্ধান্ত গ্রহণ করবে।
পরবর্তী পদক্ষেপ
- Maps Grounding MCP ডেভেলপার ডকুমেন্টেশনটি পড়ুন।
- একটি ডেমো এপিআই কী নিন।
- আপনার এজেন্ট কীভাবে স্থাপন করবেন তা জানুন।
প্রধান লেখকগণ:
টেরেসা কিন | গুগল ম্যাপস প্ল্যাটফর্ম ডেভএক্স ইঞ্জিনিয়ার
,এআই এজেন্ট তৈরি করা সফটওয়্যার ডেভেলপমেন্টে একটি উল্লেখযোগ্য অগ্রগতি, যা সিস্টেমগুলোকে জটিল যুক্তি সম্পাদন করতে এবং আরও বেশি স্বায়ত্তশাসনের সাথে কাজ করতে সক্ষম করে। তবে, এই সিস্টেমগুলোকে চালনাকারী মৌলিক মডেলগুলো স্বাভাবিকভাবেই তাদের প্রশিক্ষণ ডেটা দ্বারা সীমাবদ্ধ থাকে। বাহ্যিক প্রেক্ষাপট ছাড়া, তাদের রিয়েল-টাইম পরিস্থিতি সম্পর্কে সচেতনতার অভাব থাকে, যেমন বাইরের বর্তমান আবহাওয়া, স্থানীয় কোনো ব্যবসা এই মুহূর্তে খোলা আছে কিনা, বা কোনো গন্তব্যে পৌঁছানোর সবচেয়ে কার্যকর পথ কোনটি।
এই ডকুমেন্টটিতে বিস্তারিতভাবে বর্ণনা করা হয়েছে কীভাবে গুগল ম্যাপস থেকে প্রাপ্ত নির্ভরযোগ্য ভূ-স্থানিক ডেটা দিয়ে আপনার এআই এজেন্টদের গ্রাউন্ডিং করার মাধ্যমে স্থির যুক্তি এবং গতিশীল বাস্তবতার মধ্যেকার ব্যবধান পূরণ করা যায়। আপনি জানতে পারবেন বাস্তব-জগতের কাজগুলোর জন্য স্থানিক গ্রাউন্ডিং কেন অপরিহার্য, কীভাবে মডেল কনটেক্সট প্রোটোকল (MCP) টুল ইন্টিগ্রেশনকে সহজ করে, এবং কীভাবে গুগল ম্যাপস গ্রাউন্ডিং লাইট MCP ব্যবহার করে একটি ভ্রমণ-পরিকল্পনা এজেন্ট তৈরি করতে হয়।

এজেন্টদের কেন মানচিত্র ডেটা গ্রাউন্ডিং প্রয়োজন
প্রচলিত সফটওয়্যার থেকে এজেন্টিক ওয়ার্কফ্লোতে রূপান্তর হলো ডিটারমিনিস্টিক ইঞ্জিনিয়ারিং থেকে প্রোবাবিলিস্টিক অর্কেস্ট্রেশনের দিকে একটি পরিবর্তন। আমরা এমন সিস্টেম থেকে সরে আসছি যা কেবল তথ্য জানে, এবং এমন প্রোঅ্যাকটিভ এক্সিকিউশন ইঞ্জিনের দিকে যাচ্ছি যা বাস্তবে কাজ করে। যখন কোনো অ্যাপ্লিকেশন সেই সীমা অতিক্রম করে বাস্তব জগতে পদক্ষেপ নেয়, তখন নির্ভুলতার গুরুত্ব পুরোপুরি বদলে যায়।
লার্জ ল্যাঙ্গুয়েজ মডেল (এলএলএম) যুক্তি বোঝে, কিন্তু এর অভ্যন্তরীণ স্মৃতি হলো একটি ঐতিহাসিক মুহূর্তের ছবি। উদাহরণস্বরূপ, যদি কোনো এজেন্ট একটি সাপ্লাই চেইন পরিচালনা করার সময় কোনো সরবরাহকারীর প্রাপ্যতা বা রাস্তার রুট ভুলভাবে নিশ্চিত করে, তাহলে এর ফলে জ্বালানির অপচয়, এসএলএ (SLA) পূরণে ব্যর্থতা এবং প্রকৃত ব্যবসায়িক ব্যাঘাত ঘটবে। আর মাল্টি-এজেন্ট আর্কিটেকচারে, আপনি একটি ক্রমিক বিভ্রম সমস্যার সম্মুখীন হবেন। যদি চেইনের কোনো একটি এজেন্ট বিভ্রমের শিকার হয়ে দ্বিতীয় এজেন্টকে ভুল তথ্য দেয়, তাহলে পুরো সিস্টেমটি একটি মিথ্যার উপর ভিত্তি করে বাস্তব জগতের প্রতিশ্রুতি দিতে শুরু করে। সত্য ছাড়া স্বায়ত্তশাসন একটি বিশাল দায়ে পরিণত হয়।
গ্রাউন্ডিং-এর জন্য এজেন্টকে তার প্রশিক্ষণের সীমার বাইরে যেতে হয়। প্লেসেস ডেটা এবং রাউটিং ডেটার মতো যাচাইযোগ্য, লাইভ তথ্য সংগ্রহ করতে এআই-কে বাধ্য করার মাধ্যমে, আপনি এজেন্টকে রিয়েল-টাইম চোখ ও কান দেন, যা একটি পরিসংখ্যানগত অনুমানকে একটি সুচিন্তিত অপারেশনাল সিদ্ধান্তে রূপান্তরিত করে।
কেন এমসিপি
মডেল কনটেক্সট প্রোটোকল (MCP) হলো একটি উন্মুক্ত স্ট্যান্ডার্ড, যা টুল এবং ডেটা ইন্টিগ্রেশনকে প্লাগ-এন্ড-প্লে করার জন্য ডিজাইন করা হয়েছে।
ঐতিহাসিকভাবে, একটি এআই মডেলকে বাহ্যিক এপিআই-এর সাথে সংযুক্ত করার জন্য কঠোর, বিশেষায়িত র্যাপার লিখতে হতো। প্রতিটি স্বতন্ত্র সক্ষমতার জন্য আপনাকে ম্যানুয়ালি ফরম্যাটিং, ত্রুটি পার্সিং এবং টুল-কল অনুবাদের কাজ করতে হতো।
এমসিপি এই ইন্টিগ্রেশন লেয়ারকে মানসম্মত করে। একটি এমসিপি ক্লায়েন্ট বাস্তবায়নের মাধ্যমে, আপনার অ্যাপ্লিকেশন একটি সমন্বিত প্রোটোকল ব্যবহার করে সার্ভার-প্রদত্ত টুলগুলো গতিশীলভাবে খুঁজে বের করতে এবং কার্যকর করতে পারে। এর ফলে ডেভেলপারের মনোযোগ পুনরাবৃত্তিমূলক এপিআই ইন্টিগ্রেশন লজিক লেখা থেকে সরে এসে উচ্চ-স্তরের এজেন্টিক নেটওয়ার্ক ডিজাইন করার দিকে চলে যায়।
গুগল ম্যাপস গ্রাউন্ডিং লাইট এমসিপি
Google Maps Grounding Lite MCP হলো একটি সম্পূর্ণভাবে পরিচালিত, গুগল-হোস্টেড MCP সার্ভার যা যেকোনো সামঞ্জস্যপূর্ণ এজেন্টিক ফ্রেমওয়ার্কের সাথে সরাসরি সংযুক্ত করা যায়।
বর্তমানে, সার্ভারটি গ্রাউন্ডিংয়ের জন্য তিনটি মূল টুল সরবরাহ করে:
- স্থান অনুসন্ধান করুন : স্থান সম্পর্কে তথ্যের জন্য অনুরোধ করুন এবং AI-দ্বারা তৈরি স্থানের ডেটার সারাংশ পান। এর সাথে সারাংশে অন্তর্ভুক্ত প্রতিটি স্থানের জন্য প্লেস আইডি, অক্ষাংশ ও দ্রাঘিমাংশের স্থানাঙ্ক এবং গুগল ম্যাপস লিঙ্কও পাবেন। প্রাপ্ত প্লেস আইডি এবং অক্ষাংশ ও দ্রাঘিমাংশের স্থানাঙ্ক ব্যবহার করে আপনি মানচিত্রে স্থানগুলো প্রদর্শন করতে পারবেন।
- আবহাওয়া অনুসন্ধান করুন : আবহাওয়া সংক্রান্ত তথ্যের জন্য অনুরোধ করুন এবং বর্তমান অবস্থা, ঘণ্টাভিত্তিক পূর্বাভাস ও দৈনিক পূর্বাভাস জানুন।
- পথ গণনা করুন : দুটি স্থানের মধ্যে গাড়ি বা হাঁটার পথের তথ্য এবং ফিরতি পথের দূরত্ব ও সময়কাল সম্পর্কে জানতে অনুরোধ করুন।
পরিষেবাটি অ্যাক্সেস করতে, আপনি একটি এপিআই কী (API Key) অথবা ওঅথ (OAuth) ব্যবহার করতে পারেন। গুগল ম্যাপস প্ল্যাটফর্ম একটি বিনামূল্যের ডেমো এপিআই কী প্রদান করে, যা বিশেষভাবে ডেভেলপারদের অবিলম্বে প্রোটোটাইপিং শুরু করতে সাহায্য করার জন্য ডিজাইন করা হয়েছে।

এমসিপি-কে ভিত্তি করে মানচিত্র একীভূত করার সর্বোত্তম অনুশীলন
ডেটার প্রাসঙ্গিকতা সর্বাধিক করতে এবং কাঠামোগত বিভ্রম দূর করতে, আপনার এজেন্টের সিস্টেম নির্দেশাবলীকে এই মূল কৌশলগুলির উপর ভিত্তি করে তৈরি করুন: * সুস্পষ্ট এবং সুনির্দিষ্ট হোন : এজেন্টকে সুনির্দিষ্ট অবস্থান ব্যবহার করার নির্দেশ দিন। "নিউ ইয়র্ক"-এর চেয়ে "সেন্ট্রাল পার্ক, নিউ ইয়র্ক" ভালো ফলাফল দেয়, ঠিক যেমন "প্যারিস, ফ্রান্স" প্যারিস, টেক্সাসের সাথে বিভ্রান্তি রোধ করে।
সাধারণ অনুসন্ধানগুলোকে ভেঙে ফেলুন : "ডেট নাইটের আইডিয়া"-র মতো অস্পষ্ট অনুরোধের ক্ষেত্রে, এজেন্টকে কাজটি "রোমান্টিক রেস্তোরাঁ," "সিনেমা হল," বা "ককটেল বার"-এর মতো নির্দিষ্ট উপ-অনুসন্ধানে বিভক্ত করতে বলুন।
প্রথমে আবিষ্কার, পরে অনুসন্ধান : প্রথমে একটি বিস্তৃত অনুসন্ধান করুন (যেমন, "রবিবার খোলা প্রতিবন্ধী-বান্ধব প্রবেশপথসহ জাপানি রেস্তোরাঁ")। ব্যবহারকারীকে বিকল্পগুলি দেখান, এবং তারপরে নির্বাচিত স্থানটির ফোন নম্বরের মতো নির্দিষ্ট বিবরণ সংগ্রহ করতে একটি ফলো-আপ কোয়েরি চালান।
প্লেস আইডি নিয়ে কখনো বিভ্রান্ত হবেন না : প্লেস আইডি হলো গুগল ম্যাপস প্ল্যাটফর্মের বিভিন্ন পরিষেবার মধ্যে একটি অত্যন্ত গুরুত্বপূর্ণ সংযোগকারী সূত্র। নিশ্চিত করুন যে আপনার এজেন্ট জানে যে তাকে অবশ্যই শুধুমাত্র `search_places` টুল দ্বারা স্পষ্টভাবে প্রাপ্ত প্লেস আইডি ব্যবহার করতে হবে, নিজেরা কোনো আইডি তৈরি করার চেষ্টা করা যাবে না।
Google ADK ব্যবহার করে একটি ভ্রমণ পরিকল্পনা এজেন্ট বাস্তবায়ন করুন।
এই বিভাগে দেখানো হয়েছে কিভাবে গুগল এজেন্ট ডেভেলপমেন্ট কিট (ADK) ফ্রেমওয়ার্ক ব্যবহার করে একটি ভ্রমণ পরিকল্পনা এজেন্ট তৈরি করতে হয়। যদি আপনার ADK ইনস্টল করা না থাকে, তাহলে গুগল ADK ডেভ ডক দেখুন।
ADK-এর মতো কোনো এজেন্ট ফ্রেমওয়ার্কে Maps MCP সার্ভারকে একীভূত করা খুবই সহজ। ADK কন্টেক্সট ম্যানেজমেন্টের জটিলতাগুলো সামলে নেয়, ফলে আপনি এজেন্টের আচরণের উপর মনোযোগ দিতে পারেন।
নমুনা প্রকল্পটির কাঠামোটি নিম্নরূপ:
travel-concierge-google-maps-mcp/
├── travel_planner_agent/
├── agent.py # main agent code
├── .env # API keys
├── __init__.py
├── skills/travel-concierge/
├── SKILL.md # Agent skill
agent.py-এর একটি নমুনা। আপনার ব্যবহারের ক্ষেত্র অনুযায়ী এটি সম্পাদনা করুন।
import os
import pathlib
import logging
from datetime import date
from dotenv import load_dotenv
from google.adk.agents.llm_agent import Agent
from google.adk.skills import load_skill_from_dir
from google.adk.tools import skill_toolset
from google.adk.tools.mcp_tool import McpToolset
from google.adk.planners import BuiltInPlanner
from google.genai import types
from google.adk.tools.mcp_tool.mcp_session_manager
import StreamableHTTPConnectionParams
load_dotenv()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
GOOGLE_MAPS_API_KEY = os.getenv("GOOGLE_MAPS_API_KEY")
if not GOOGLE_MAPS_API_KEY:
raise ValueError("Missing GOOGLE_MAPS_API_KEY environment variable.")
current_date = date.today().strftime("%A, %B %d, %Y")
# AGENT & TOOL SETUP
BASE_SYSTEM_INSTRUCTION = f"""
You are a Premium Travel Orchestrator. Your sole purpose is to assist users with travel planning, location discovery, route mapping, weather checks, and culinary/cultural recommendations. The current system date is {current_date}.
# 1. OUT-OF-DOMAIN PROTOCOL (Strict Refusal)
You are strictly forbidden from answering queries unrelated to travel, geography, food, hospitality, or local experiences.
If a user asks about coding (e.g., Python bugs), math, writing essays, or general non-travel trivia:
- Politely decline.
- Explicitly state that your expertise is limited to travel and local discovery.
- Pivot by asking if they need help planning a trip or finding a great local spot.
# 2. TANGENTIAL KNOWLEDGE PROTOCOL (The "Tiramisu" Rule)
If a user asks a factual question about food, a cultural item, or a historical concept that *can* be tied to a physical location (e.g., "What is tiramisu?", "What is Gothic architecture?"):
- Provide a brief, helpful 1-2 sentence explanation of the concept.
- IMMEDIATELY pivot to your primary domain. Ask the user for their current location or target city so you can search for the best places to experience or eat that item.
# 3. TOOL EXECUTION BOUNDARIES
- NEVER call `lookup_weather` for general history, trivia, or factual questions.
- ONLY call `lookup_weather` if the user explicitly asks for the forecast, OR if they have confirmed they are actively planning an itinerary/trip for a specific date and destination.
"""
travel_skill = load_skill_from_dir(
pathlib.Path(__file__).parent / "skills" / "travel-concierge"
)
maps_mcp_toolset = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://mapstools.googleapis.com/mcp",
headers={
"X-Goog-Api-Key": GOOGLE_MAPS_API_KEY,
"Content-Type": "application/json",
"Accept": "application/json, text/event-stream"
}
)
)
my_skill_toolset = skill_toolset.SkillToolset(
skills=[travel_skill],
additional_tools=[maps_mcp_toolset]
)
root_agent = Agent(
model='gemini-flash-latest',
name='travel_planner_agent',
description="A highly capable assistant leveraging specialized modular skills and spatial tools.",
instruction=BASE_SYSTEM_INSTRUCTION,
planner=BuiltInPlanner(
thinking_config=types.ThinkingConfig(
include_thoughts=True
)
),
tools=[my_skill_toolset]
)
SKILL.md-এর নমুনা। আপনার ব্যবহারের ক্ষেত্র অনুযায়ী এটি সম্পাদনা করুন।
name: travel-concierge
description:
Accesses real-time spatial data, weather, and traffic routing to design accurate itineraries and provide location-based information.
Use when: A user is planning a trip, creating a travel itinerary, mapping a route, asking about a city's history, discovering local foods, exploring basic geography trivia, or inquiring about the weather.
Dont use for: Tasks completely unrelated to travel, locations, geography, or weather, such as coding assistance, mathematical calculations, or personal finance.
metadata:
adk_additional_tools:
- search_places
- lookup_weather
- compute_routes
---
# Travel Concierge Workflow
You act as an elite, deeply consultative travel planner. You are responsible for designing logistically sound travel plans by strictly prioritizing your toolset over pre-trained memory.
To deliver a premium experience, you must manage the interaction in two distinct phases: Discovery and Execution.
## Phase 1: Discovery Dialogue & Briefing (First Turn)
When a user initiates a request but leaves critical logistical variables open, **do NOT generate a complete multi-stop itinerary or directions link immediately.** Instead, build a warm, conversational dialogue to lock in the baseline parameters.
1. **Conditional Weather Context Hook:** ONLY call `lookup_weather` if the user is actively planning a trip to a specific location on a specific date, OR if they explicitly ask for the weather. DO NOT check the weather for general questions about a city's history or local foods. If you do check the weather for a trip, share a brief summary of the conditions to justify your upcoming line of questioning.
2. **Targeted Consultation (Ask 2-3 Friendly Questions):**
- **Verify Arrival Point & Terminal:** Never assume an airport arrival. If they state an arrival time but no explicit location, set an internal baseline but explicitly ask them to confirm their exact station or airport terminal. **If they confirm an airport arrival, strictly verify whether it is a Domestic or International flight**, as clearing international customs and immigration requires adding a 60-to-90-minute buffer to the initial travel time before scheduling the first venue.
- **Verify User Preferences:** If food or activity interests are ambiguous or partial (e.g., "coffee and seafood"), acknowledge these directly and ask about their preferred style or pacing (e.g., casual local markets vs. seated upscale dining).
- **Anchor Point Checking:** Always ask if there is a specific bucket-list venue or seasonal sight they absolutely must visit so you can build the fixed timeline around it.
## Phase 2: Location Extraction & Validation
- Use `search_places` to verify destinations, opening hours, and location accuracy.
- **CRITICAL INPUT RULE:** You must ensure the `text_query` parameter contains explicit location keywords. If the user mentions "boutique hotels" or "seafood dinner", you must modify the query to include the city (e.g., text_query="boutique hotels in Sydney, Australia").
## Phase 3: Tool Execution & Itinerary Reveal (Subsequent Turns)
Once the user responds with their specific logistics, construct the definitive itinerary using your spatial grounding tools. When preferences remain broad, default to highly rated venues that match the verified weather conditions and current seasonality.
### 1. Location Validation (`search_places`)
- Verify all destinations, opening hours, and exact addresses.
- **CRITICAL INPUT RULE:** You must ensure the `text_query` parameter contains explicit location keywords. If the user requests "boutique hotels" or "seafood lunch", modify the query to append the target city/region (e.g., `text_query="seafood lunch in Sydney, Australia"`).
### 2. Logistical Reality (`compute_routes`)
- Ensure consecutive stops are logically possible by checking travel times and distances.
- Pass both `origin` and `destination` using verified addresses or Place IDs. If either is missing, halt and ask for clarification.
- Do NOT hallucinate Place ID. You must use the Place ID provided by `search_places`.
### 3. Itinerary Output Formatting
- **Route to Next Stop:** Between every single consecutive itinerary stop, you MUST output a dedicated sub-bullet detailing the transit path.
- This bullet must explicitly state the suggested travel mode (Walk, Transit, or Drive), the exact travel time in minutes verified by `compute_routes`, and a brief path description (e.g., *"Route to Next Stop: 12-minute walk via Market St"*).
- **Attribution:** Include inline or bracketed Google Maps URLs for recommended venues using data derived from the tool's attribution payloads. Do not guess links.
### 4. Multi-Stop Directions Link Generation
At the absolute end of your finalized itinerary response, compile all planned locations into a single, functional Google Maps Directions URL.
- **Format Constraint:** Build the URL using the base string: `https://www.google.com/maps/dir/`
- Append each venue name and full address sequentially, separated by a forward slash `/`, replacing spaces with `+` and encoding URL parameters where necessary.
- Example format: `https://www.google.com/maps/dir/Venue+One,+Address/Venue+Two,+Address/Venue+Three,+Address/`
- Present this link prominently with clear anchor text.
## Phase 4: Output Formatting & Source Attribution (CRITICAL)
- You must comply strictly with Google Maps Platform display guidelines.
- Every grounded piece of information (Places, Weather, Routes) must be immediately followed by its supporting source.
- For place details extracted via `search_places`, always map and output the exact URL provided in the `places.googleMapsLinks.placeUrl` payload. Do not invent links.
init .py
from . import agent
adk ওয়েব চালান এবং ইন্টারঅ্যাক্ট করুন
ডিফল্ট ADK ওয়েব UI চালু করতে, travel-concierge-google-maps-mcp প্রজেক্ট ডিরেক্টরিতে এই কমান্ডটি চালান:
adk web
UI-তে ইন্টারঅ্যাক্ট করুন:
- ব্রাউজারে http://127.0.0.1:8000-এ UI লোড করুন।
- এই ধরনের নির্দেশ চেষ্টা করুন:
- আমি শনিবার সান ফ্রান্সিসকোতে থাকব। আমার জন্য একদিনের ভ্রমণের পরিকল্পনা করুন।
- গোল্ডেন গেট পার্কের কাছাকাছি কফি শপগুলো খুঁজে বের করুন এবং আমাকে মেনুর বিশেষ আকর্ষণগুলো দেখান।
- GooglePlex থেকে SFO-তে যাওয়ার দিকনির্দেশনা নিন।
এজেন্ট যখন প্রম্পটটি পায়, তখন প্ল্যানার ব্যবহারকারীর উদ্দেশ্য মূল্যায়ন করে। এটি স্থানিক ও আবহাওয়ার তথ্যের প্রয়োজনীয়তা শনাক্ত করে এবং এমসিপি সার্ভার ব্যবহার করে স্বয়ংক্রিয়ভাবে lookup_weather, search_places, ও compute_routes টুলগুলো চালু করে। এরপর এজেন্ট ব্যবহারকারীর জন্য তথ্য-ভিত্তিক একটি ভ্রমণসূচি তৈরি করে।
উপসংহার
এজেন্টিক এআই-এর দিকে এই পরিবর্তন লজিস্টিকস, ভ্রমণ এবং খুচরা ব্যবসায় সম্পূর্ণ নতুন সক্ষমতা উন্মোচন করছে। তবে, প্রকৃত স্বায়ত্তশাসনের জন্য সত্যের এক অটল ভিত্তি প্রয়োজন।
গুগল ম্যাপস গ্রাউন্ডিং লাইট-এর পাশাপাশি মডেল কনটেক্সট প্রোটোকল ব্যবহার করে, আপনি কাস্টমাইজড এপিআই ইন্টিগ্রেশনের জটিলতা দূর করতে পারেন এবং আপনার এজেন্টদের প্রয়োজনীয় রিয়েল-টাইম তথ্য সরবরাহ করতে পারেন। লাইভ স্পেশিয়াল ডেটার উপর আপনার মডেলগুলোকে ভিত্তি করে, এটি নিশ্চিত করা হয় যে মডেলগুলো তাদের ট্রেনিং ডেটার কোনো স্থির চিত্রের উপর ভিত্তি করে নয়, বরং বাস্তব জগতে এই মুহূর্তে যা ঘটছে তার উপর ভিত্তি করেই পরিচালনগত সিদ্ধান্ত গ্রহণ করবে।
পরবর্তী পদক্ষেপ
- Maps Grounding MCP ডেভেলপার ডকুমেন্টেশনটি পড়ুন।
- একটি ডেমো এপিআই কী নিন।
- আপনার এজেন্ট কীভাবে স্থাপন করবেন তা জানুন।
প্রধান লেখকগণ:
টেরেসা কিন | গুগল ম্যাপস প্ল্যাটফর্ম ডেভএক্স ইঞ্জিনিয়ার