סוכן Gemini Deep Research מתכנן, מבצע ומסכם באופן אוטונומי משימות מחקר מרובות שלבים. התכונה מבוססת על Gemini 3 Pro, והיא סורקת מאות אתרים, מנתחת את המידע שבהם ויוצרת דוח מקיף עם ציטוטים מלאים תוך דקות ספורות.
משימות מחקר כוללות חיפוש וקריאה חוזרים, והן יכולות להימשך כמה דקות. כדי להריץ את הסוכן באופן אסינכרוני ולבדוק אם יש תוצאות, צריך להשתמש בהרצה ברקע (הגדרה של background=true). פרטים נוספים מופיעים במאמר בנושא טיפול במשימות שפועלות לאורך זמן.
בדוגמה הבאה אפשר לראות איך מתחילים משימת מחקר ברקע ומבצעים סקר כדי לקבל את התוצאות.
Python
import time
from google import genai
client = genai.Client()
interaction = client.interactions.create(
input="Research the history of Google TPUs.",
agent='deep-research-pro-preview-12-2025',
background=True
)
print(f"Research started: {interaction.id}")
while True:
interaction = client.interactions.get(interaction.id)
if interaction.status == "completed":
print(interaction.outputs[-1].text)
break
elif interaction.status == "failed":
print(f"Research failed: {interaction.error}")
break
time.sleep(10)
JavaScript
import { GoogleGenAI } from '@google/genai';
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
input: 'Research the history of Google TPUs.',
agent: 'deep-research-pro-preview-12-2025',
background: true
});
console.log(`Research started: ${interaction.id}`);
while (true) {
const result = await client.interactions.get(interaction.id);
if (result.status === 'completed') {
console.log(result.outputs[result.outputs.length - 1].text);
break;
} else if (result.status === 'failed') {
console.log(`Research failed: ${result.error}`);
break;
}
await new Promise(resolve => setTimeout(resolve, 10000));
}
REST
# 1. Start the research task
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Research the history of Google TPUs.",
"agent": "deep-research-pro-preview-12-2025",
"background": true
}'
# 2. Poll for results (Replace INTERACTION_ID)
# curl -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/INTERACTION_ID" \
# -H "x-goog-api-key: $GEMINI_API_KEY"
רוצה לערוך מחקר עם נתונים משלך?
ל-Deep Research יש גישה למגוון כלים. כברירת מחדל, לסוכן יש גישה למידע באינטרנט הציבורי באמצעות כלי google_search ו-url_context. לא צריך לציין את הכלים האלה כברירת מחדל. עם זאת, אם אתם רוצים לתת לסוכן גישה לנתונים שלכם באמצעות הכלי חיפוש קבצים, אתם צריכים להוסיף אותו כמו בדוגמה הבאה.
Python
import time
from google import genai
client = genai.Client()
interaction = client.interactions.create(
input="Compare our 2025 fiscal year report against current public web news.",
agent="deep-research-pro-preview-12-2025",
background=True,
tools=[
{
"type": "file_search",
"file_search_store_names": ['fileSearchStores/my-store-name']
}
]
)
JavaScript
const interaction = await client.interactions.create({
input: 'Compare our 2025 fiscal year report against current public web news.',
agent: 'deep-research-pro-preview-12-2025',
background: true,
tools: [
{ type: 'file_search', file_search_store_names: ['fileSearchStores/my-store-name'] },
]
});
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Compare our 2025 fiscal year report against current public web news.",
"agent": "deep-research-pro-preview-12-2025",
"background": true,
"tools": [
{"type": "file_search", "file_search_store_names": ["fileSearchStores/my-store-name"]},
]
}'
הכוונה ועיצוב
אתם יכולים להנחות את הפלט של הסוכן על ידי מתן הוראות ספציפיות לעיצוב בהנחיה. כך תוכלו לחלק את הדוחות לקטעים ולתתי-קטעים ספציפיים, לכלול טבלאות נתונים או להתאים את הטון לקהלים שונים (לדוגמה, 'technical', 'executive', 'casual').
להגדיר באופן מפורש את פורמט הפלט הרצוי בטקסט הקלט.
Python
prompt = """
Research the competitive landscape of EV batteries.
Format the output as a technical report with the following structure:
1. Executive Summary
2. Key Players (Must include a data table comparing capacity and chemistry)
3. Supply Chain Risks
"""
interaction = client.interactions.create(
input=prompt,
agent="deep-research-pro-preview-12-2025",
background=True
)
JavaScript
const prompt = `
Research the competitive landscape of EV batteries.
Format the output as a technical report with the following structure:
1. Executive Summary
2. Key Players (Must include a data table comparing capacity and chemistry)
3. Supply Chain Risks
`;
const interaction = await client.interactions.create({
input: prompt,
agent: 'deep-research-pro-preview-12-2025',
background: true,
});
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Research the competitive landscape of EV batteries.\n\nFormat the output as a technical report with the following structure: \n1. Executive Summary\n2. Key Players (Must include a data table comparing capacity and chemistry)\n3. Supply Chain Risks",
"agent": "deep-research-pro-preview-12-2025",
"background": true
קלט מרובה מצבים
Deep Research תומך בקלט מולטי-מודאלי, כולל תמונות, קובצי PDF, אודיו ווידאו. התכונה מאפשרת לסוכן לנתח תוכן עשיר ואז לבצע מחקר באינטרנט בהקשר של הקלט שסופק. לדוגמה, אתם יכולים לספק תמונה ולבקש מהסוכן לזהות את הנושאים שמופיעים בה, לחקור את ההתנהגות שלהם או למצוא מידע שקשור אליהם.
בדוגמה הבאה מוצגת בקשה לניתוח תמונה באמצעות כתובת URL של תמונה.
Python
import time
from google import genai
client = genai.Client()
prompt = '''Analyze the interspecies dynamics and behavioral risks present
in the provided image of the African watering hole. Specifically, investigate
the symbiotic relationship between the avian species and the pachyderms
shown, and conduct a risk assessment for the reticulated giraffes based on
their drinking posture relative to the specific predator visible in the
foreground.'''
interaction = client.interactions.create(
input=[
{"type": "text", "text": prompt},
{
"type": "image",
"uri": "https://storage.googleapis.com/generativeai-downloads/images/generated_elephants_giraffes_zebras_sunset.jpg"
}
],
agent="deep-research-pro-preview-12-2025",
background=True
)
print(f"Research started: {interaction.id}")
while True:
interaction = client.interactions.get(interaction.id)
if interaction.status == "completed":
print(interaction.outputs[-1].text)
break
elif interaction.status == "failed":
print(f"Research failed: {interaction.error}")
break
time.sleep(10)
JavaScript
import { GoogleGenAI } from '@google/genai';
const client = new GoogleGenAI({});
const prompt = `Analyze the interspecies dynamics and behavioral risks present
in the provided image of the African watering hole. Specifically, investigate
the symbiotic relationship between the avian species and the pachyderms
shown, and conduct a risk assessment for the reticulated giraffes based on
their drinking posture relative to the specific predator visible in the
foreground.`;
const interaction = await client.interactions.create({
input: [
{ type: 'text', text: prompt },
{
type: 'image',
uri: 'https://storage.googleapis.com/generativeai-downloads/images/generated_elephants_giraffes_zebras_sunset.jpg'
}
],
agent: 'deep-research-pro-preview-12-2025',
background: true
});
console.log(`Research started: ${interaction.id}`);
while (true) {
const result = await client.interactions.get(interaction.id);
if (result.status === 'completed') {
console.log(result.outputs[result.outputs.length - 1].text);
break;
} else if (result.status === 'failed') {
console.log(`Research failed: ${result.error}`);
break;
}
await new Promise(resolve => setTimeout(resolve, 10000));
}
REST
# 1. Start the research task with image input
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": [
{"type": "text", "text": "Analyze the interspecies dynamics and behavioral risks present in the provided image of the African watering hole. Specifically, investigate the symbiotic relationship between the avian species and the pachyderms shown, and conduct a risk assessment for the reticulated giraffes based on their drinking posture relative to the specific predator visible in the foreground."},
{"type": "image", "uri": "https://storage.googleapis.com/generativeai-downloads/images/generated_elephants_giraffes_zebras_sunset.jpg"}
],
"agent": "deep-research-pro-preview-12-2025",
"background": true
}'
# 2. Poll for results (Replace INTERACTION_ID)
# curl -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/INTERACTION_ID" \
# -H "x-goog-api-key: $GEMINI_API_KEY"
טיפול במשימות לטווח ארוך
Deep Research הוא תהליך רב-שלבי שכולל תכנון, חיפוש, קריאה וכתיבה. המחזור הזה בדרך כלל חורג ממגבלות הזמן הקצוב לתפוגה של קריאות ל-API סינכרוני.
הסוכנים חייבים להשתמש ב-background=True. ה-API מחזיר אובייקט Interaction חלקי באופן מיידי. אפשר להשתמש במאפיין id כדי לאחזר אינטראקציה לצורך בדיקה. מצב האינטראקציה ישתנה מin_progress לcompleted או לfailed.
סטרימינג
Deep Research תומך בסטרימינג כדי לקבל עדכונים בזמן אמת על התקדמות המחקר. צריך להגדיר את stream=True ואת background=True.
בדוגמה הבאה אפשר לראות איך מתחילים משימת מחקר ומעבדים את הסטרימינג.
חשוב לציין שהסרטון מראה איך לעקוב אחרי האירוע interaction_id מתוך האירוע interaction.start. תצטרכו את המזהה הזה כדי להמשיך את השידור אם תהיה הפרעה ברשת. הקוד הזה גם כולל משתנה event_id שמאפשר לכם להמשיך מהנקודה הספציפית שבה התנתקתם.
Python
stream = client.interactions.create(
input="Research the history of Google TPUs.",
agent="deep-research-pro-preview-12-2025",
background=True,
stream=True,
agent_config={
"type": "deep-research",
"thinking_summaries": "auto"
}
)
interaction_id = None
last_event_id = None
for chunk in stream:
if chunk.event_type == "interaction.start":
interaction_id = chunk.interaction.id
print(f"Interaction started: {interaction_id}")
if chunk.event_id:
last_event_id = chunk.event_id
if chunk.event_type == "content.delta":
if chunk.delta.type == "text":
print(chunk.delta.text, end="", flush=True)
elif chunk.delta.type == "thought_summary":
print(f"Thought: {chunk.delta.content.text}", flush=True)
elif chunk.event_type == "interaction.complete":
print("\nResearch Complete")
JavaScript
const stream = await client.interactions.create({
input: 'Research the history of Google TPUs.',
agent: 'deep-research-pro-preview-12-2025',
background: true,
stream: true,
agent_config: {
type: 'deep-research',
thinking_summaries: 'auto'
}
});
let interactionId;
let lastEventId;
for await (const chunk of stream) {
// 1. Capture Interaction ID
if (chunk.event_type === 'interaction.start') {
interactionId = chunk.interaction.id;
console.log(`Interaction started: ${interactionId}`);
}
// 2. Track IDs for potential reconnection
if (chunk.event_id) lastEventId = chunk.event_id;
// 3. Handle Content
if (chunk.event_type === 'content.delta') {
if (chunk.delta.type === 'text') {
process.stdout.write(chunk.delta.text);
} else if (chunk.delta.type === 'thought_summary') {
console.log(`Thought: ${chunk.delta.content.text}`);
}
} else if (chunk.event_type === 'interaction.complete') {
console.log('\nResearch Complete');
}
}
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?alt=sse" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Research the history of Google TPUs.",
"agent": "deep-research-pro-preview-12-2025",
"background": true,
"stream": true,
"agent_config": {
"type": "deep-research",
"thinking_summaries": "auto"
}
}'
# Note: Look for the 'interaction.start' event to get the interaction ID.
מתבצעת התחברות מחדש לצפייה בסטרימינג
יכול להיות שיהיו שיבושים ברשת במהלך משימות מחקר ארוכות. כדי לטפל בבעיה בצורה חלקה, האפליקציה צריכה לזהות שגיאות חיבור ולהמשיך את הסטרימינג באמצעות client.interactions.get().
כדי להמשיך, צריך לציין שני ערכים:
- מזהה אינטראקציה: נרכש מהאירוע
interaction.startבזרם הראשוני. - מזהה האירוע האחרון: המזהה של האירוע האחרון שעבר עיבוד בהצלחה. הפקודה הזו אומרת לשרת להמשיך לשלוח אירועים אחרי הנקודה הספציפית הזו. אם לא תציינו את הפרמטר הזה, תקבלו את תחילת השידור.
בדוגמאות הבאות מוצג דפוס עמיד: ניסיון להזרים את הבקשה הראשונית create, וחזרה ללולאת get אם החיבור נכשל.
Python
import time
from google import genai
client = genai.Client()
# Configuration
agent_name = 'deep-research-pro-preview-12-2025'
prompt = 'Compare golang SDK test frameworks'
# State tracking
last_event_id = None
interaction_id = None
is_complete = False
def process_stream(event_stream):
"""Helper to process events from any stream source."""
global last_event_id, interaction_id, is_complete
for event in event_stream:
# Capture Interaction ID
if event.event_type == "interaction.start":
interaction_id = event.interaction.id
print(f"Interaction started: {interaction_id}")
# Capture Event ID
if event.event_id:
last_event_id = event.event_id
# Print content
if event.event_type == "content.delta":
if event.delta.type == "text":
print(event.delta.text, end="", flush=True)
elif event.delta.type == "thought_summary":
print(f"Thought: {event.delta.content.text}", flush=True)
# Check completion
if event.event_type in ['interaction.complete', 'error']:
is_complete = True
# 1. Attempt initial streaming request
try:
print("Starting Research...")
initial_stream = client.interactions.create(
input=prompt,
agent=agent_name,
background=True,
stream=True,
agent_config={
"type": "deep-research",
"thinking_summaries": "auto"
}
)
process_stream(initial_stream)
except Exception as e:
print(f"\nInitial connection dropped: {e}")
# 2. Reconnection Loop
# If the code reaches here and is_complete is False, we resume using .get()
while not is_complete and interaction_id:
print(f"\nConnection lost. Resuming from event {last_event_id}...")
time.sleep(2)
try:
resume_stream = client.interactions.get(
id=interaction_id,
stream=True,
last_event_id=last_event_id
)
process_stream(resume_stream)
except Exception as e:
print(f"Reconnection failed, retrying... ({e})")
JavaScript
let lastEventId;
let interactionId;
let isComplete = false;
// Helper to handle the event logic
const handleStream = async (stream) => {
for await (const chunk of stream) {
if (chunk.event_type === 'interaction.start') {
interactionId = chunk.interaction.id;
}
if (chunk.event_id) lastEventId = chunk.event_id;
if (chunk.event_type === 'content.delta') {
if (chunk.delta.type === 'text') {
process.stdout.write(chunk.delta.text);
} else if (chunk.delta.type === 'thought_summary') {
console.log(`Thought: ${chunk.delta.content.text}`);
}
} else if (chunk.event_type === 'interaction.complete') {
isComplete = true;
}
}
};
// 1. Start the task with streaming
try {
const stream = await client.interactions.create({
input: 'Compare golang SDK test frameworks',
agent: 'deep-research-pro-preview-12-2025',
background: true,
stream: true,
agent_config: {
type: 'deep-research',
thinking_summaries: 'auto'
}
});
await handleStream(stream);
} catch (e) {
console.log('\nInitial stream interrupted.');
}
// 2. Reconnect Loop
while (!isComplete && interactionId) {
console.log(`\nReconnecting to interaction ${interactionId} from event ${lastEventId}...`);
try {
const stream = await client.interactions.get(interactionId, {
stream: true,
last_event_id: lastEventId
});
await handleStream(stream);
} catch (e) {
console.log('Reconnection failed, retrying in 2s...');
await new Promise(resolve => setTimeout(resolve, 2000));
}
}
REST
# 1. Start the research task (Initial Stream)
# Watch for event: interaction.start to get the INTERACTION_ID
# Watch for "event_id" fields to get the LAST_EVENT_ID
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?alt=sse" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Compare golang SDK test frameworks",
"agent": "deep-research-pro-preview-12-2025",
"background": true,
"stream": true,
"agent_config": {
"type": "deep-research",
"thinking_summaries": "auto"
}
}'
# ... Connection interrupted ...
# 2. Reconnect (Resume Stream)
# Pass the INTERACTION_ID and the LAST_EVENT_ID you saved.
curl -X GET "https://generativelanguage.googleapis.com/v1beta/interactions/INTERACTION_ID?stream=true&last_event_id=LAST_EVENT_ID&alt=sse" \
-H "x-goog-api-key: $GEMINI_API_KEY"
שאלות המשך ואינטראקציות
אחרי שהנציג או הנציגה יחזרו עם הדוח הסופי, תוכלו להמשיך את השיחה באמצעות previous_interaction_id. כך תוכלו לבקש הבהרה, סיכום או פירוט של קטעים ספציפיים במחקר בלי להפעיל מחדש את כל המשימה.
Python
import time
from google import genai
client = genai.Client()
interaction = client.interactions.create(
input="Can you elaborate on the second point in the report?",
model="gemini-3-pro-preview",
previous_interaction_id="COMPLETED_INTERACTION_ID"
)
print(interaction.outputs[-1].text)
JavaScript
const interaction = await client.interactions.create({
input: 'Can you elaborate on the second point in the report?',
agent: 'deep-research-pro-preview-12-2025',
previous_interaction_id: 'COMPLETED_INTERACTION_ID'
});
console.log(interaction.outputs[-1].text);
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Can you elaborate on the second point in the report?",
"agent": "deep-research-pro-preview-12-2025",
"previous_interaction_id": "COMPLETED_INTERACTION_ID"
}'
מתי כדאי להשתמש ב-Gemini Agent Deep Research
Deep Research הוא סוכן, ולא רק מודל. הוא מתאים במיוחד לעומסי עבודה שדורשים גישה של "אנליסט בקופסה" ולא צ'אט עם זמן אחזור נמוך.
| תכונה | מודלים רגילים של Gemini | Gemini Deep Research Agent |
|---|---|---|
| זמן אחזור | שניות | דקות (אסינכרוני/ברקע) |
| Process | יצירה -> פלט | תכנון -> חיפוש -> קריאה -> חזרה על הפעולה -> פלט |
| פלט | טקסט שיחה, קוד, סיכומים קצרים | דוחות מפורטים, ניתוח ארוך, טבלאות השוואה |
| הכי מתאים ל | צ'אטבוטים, חילוץ, כתיבה יוצרת | ניתוח שוק, בדיקת נאותות, סקירת ספרות, ניתוח מצב התחרות |
זמינות ומחירים
אפשר לגשת לסוכן Deep Research של Gemini באמצעות Interactions API ב-Google AI Studio וב-Gemini API.
התמחור מבוסס על מודל של תשלום לפי שימוש, בהתאם למודל הבסיסי Gemini 3 Pro ולכלים הספציפיים שבהם הסוכן משתמש. בניגוד לבקשות צ'אט רגילות, שבהן בקשה מובילה לפלט אחד, משימת Deep Research היא תהליך עבודה מבוסס-סוכן. בקשה אחת מפעילה לולאה אוטונומית של תכנון, חיפוש, קריאה והסקת מסקנות.
עלויות משוערות
העלויות משתנות בהתאם לעומק המחקר הנדרש. הסוכן קובע באופן אוטונומי כמה קריאה וחיפוש נדרשים כדי לענות על ההנחיה.
- משימת מחקר רגילה: בשביל שאילתה טיפוסית שדורשת ניתוח מתון, יכול להיות שהסוכן ישתמש ב-80 שאילתות חיפוש, ב-250,000 טוקנים של קלט (כ-50-70% במטמון) וב-60,000 טוקנים של פלט.
- הסכום הכולל המשוער: כ-2.00$ – 3.00$ לכל משימה
- משימת מחקר מורכבת: כדי לבצע ניתוח מעמיק של הסביבה התחרותית או בדיקת נאותות מקיפה, הסוכן עשוי להשתמש בעד 160 שאילתות חיפוש, עד 900,000 טוקנים של קלט (כ-50-70% במטמון) ועד 80,000 טוקנים של פלט.
- הסכום הכולל המשוער: כ-3.00$עד 5.00$ לכל משימה
שיקולי בטיחות
כשנותנים לסוכן גישה לאינטרנט ולקבצים פרטיים, צריך לשקול היטב את סיכוני הבטיחות.
- החדרת הנחיה באמצעות קבצים: הסוכן קורא את התוכן של הקבצים שאתם מספקים. חשוב לוודא שהמסמכים שהועלו (קובצי PDF, קובצי טקסט) מגיעים ממקורות מהימנים. קובץ זדוני יכול להכיל טקסט מוסתר שנועד לתמרן את הפלט של הסוכן.
- סיכונים שקשורים לתוכן באינטרנט: הסוכן מחפש באינטרנט הציבורי. אנחנו מטמיעים מסנני בטיחות חזקים, אבל קיים סיכון שהסוכן ייתקל בדפי אינטרנט זדוניים ויעבד אותם. מומלץ לעיין ב
citationsשצוינו בתשובה כדי לאמת את המקורות. - העברת נתונים: חשוב להיזהר כשמבקשים מהסוכן לסכם נתונים פנימיים רגישים אם מאפשרים לו גם לגלוש באינטרנט.
שיטות מומלצות
- הנחיה לגבי נתונים לא ידועים: הנחיה של הסוכן לגבי אופן הטיפול בנתונים חסרים. לדוגמה, אפשר להוסיף את ההנחיה "אם נתונים ספציפיים לשנת 2025 לא זמינים, ציין במפורש שהם תחזיות או לא זמינים, במקום להעריך".
- מספקים הקשר: כדי שהסוכן יתמקד במחקר, כדאי לספק מידע רקע או מגבלות ישירות בהנחיית הקלט.
- קלט מרובה מצבים סוכן Deep Research תומך בקלט מרובה מצבים. חשוב להשתמש בזה בזהירות, כי זה מגדיל את העלויות ואת הסיכון לחריגה מחלון ההקשר.
מגבלות
- סטטוס בטא: ממשק Interactions API נמצא בגרסת בטא ציבורית. יכול להיות שיהיו שינויים בתכונות ובסכימות.
- כלים בהתאמה אישית: נכון לעכשיו, אי אפשר לספק לסוכן Deep Research כלים מותאמים אישית של Function Calling או שרתי MCP (Model Context Protocol) מרוחקים.
- פלט מובנה ואישור תוכנית: סוכן המחקר המתקדם לא תומך כרגע בתכנון שאושר על ידי בני אדם או בפלט מובנה.
- זמן המחקר המקסימלי: לסוכן Deep Research יש זמן מחקר מקסימלי של 60 דקות. רוב המשימות אמורות להסתיים תוך 20 דקות.
- דרישה לחנות: כדי להפעיל נציג באמצעות
background=True, צריךstore=True. - חיפוש Google: חיפוש Google מופעל כברירת מחדל, ויש הגבלות ספציפיות על התוצאות המבוססות על מידע.
- קלט אודיו: אין תמיכה בקלט אודיו.