Агент Gemini Deep Research автономно планирует, выполняет и анализирует многоэтапные исследовательские задачи. Работая на базе Gemini, он ориентируется в сложных информационных ландшафтах, создавая подробные отчеты с цитируемыми источниками. Новые возможности позволяют совместно планировать исследования с агентом, подключаться к внешним инструментам через серверы MCP, включать визуализации (например, диаграммы и графики) и предоставлять документы непосредственно в качестве входных данных.
Исследовательские задачи включают итеративный поиск и чтение и могут занимать несколько минут. Для асинхронного запуска агента и получения результатов или потоковой передачи обновлений необходимо использовать фоновое выполнение (установите 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-preview-04-2026",
background=True,
)
print(f"Research started: {interaction.id}")
while True:
interaction = client.interactions.get(interaction.id)
if interaction.status == "completed":
print(interaction.steps[-1].content[0].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-preview-04-2026',
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.steps.at(-1).content[0].text);
break;
} else if (result.status === 'failed') {
console.log(`Research failed: ${result.error}`);
break;
}
await new Promise(resolve => setTimeout(resolve, 10000));
}
ОТДЫХ
# 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-preview-04-2026",
"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 выпускается в двух версиях:
- Deep Research (
deep-research-preview-04-2026): Разработан для скорости и эффективности, идеально подходит для потоковой передачи данных обратно в пользовательский интерфейс клиента. - Deep Research Max (
deep-research-max-preview-04-2026): Максимальная всесторонность для автоматизированного сбора и синтеза контекста.
Совместное планирование
Совместное планирование позволяет контролировать направление исследования до начала работы агента, предоставляя возможность просмотреть и уточнить план исследования перед его выполнением. При включении этой функции агент возвращает предложенный план исследования вместо немедленного выполнения. Затем вы можете просмотреть, изменить или утвердить план в ходе многоэтапных взаимодействий.
Шаг 1: Запросите тарифный план
Установите collaborative_planning=True при первом взаимодействии. Агент вернет план исследования вместо полного отчета.
Python
from google import genai
client = genai.Client()
# First interaction: request a research plan
plan_interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Do some research on Google TPUs.",
agent_config={
"type": "deep-research",
"thinking_summaries": "auto",
"collaborative_planning": True,
},
background=True,
)
# Wait for and retrieve the plan
while (result := client.interactions.get(id=plan_interaction.id)).status != "completed":
time.sleep(5)
print(result.steps[-1].content[0].text)
JavaScript
const planInteraction = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'Do some research on Google TPUs.',
agent_config: {
type: 'deep-research',
thinking_summaries: 'auto',
collaborative_planning: true
},
background: true
});
let result;
while ((result = await client.interactions.get(planInteraction.id)).status !== 'completed') {
await new Promise(r => setTimeout(r, 5000));
}
console.log(result.steps.at(-1).content[0].text);
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "deep-research-preview-04-2026",
"input": "Do some research on Google TPUs.",
"agent_config": {
"type": "deep-research",
"thinking_summaries": "auto",
"collaborative_planning": true
},
"background": true
}'
Шаг 2: Уточните план (необязательно)
Используйте previous_interaction_id , чтобы продолжить обсуждение и доработать план. Оставьте collaborative_planning=True , чтобы оставаться в режиме планирования.
Python
# Second interaction: refine the plan
refined_plan = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Focus more on the differences between Google TPUs and competitor hardware, and less on the history.",
agent_config={
"type": "deep-research",
"thinking_summaries": "auto",
"collaborative_planning": True,
},
previous_interaction_id=plan_interaction.id,
background=True,
)
while (result := client.interactions.get(id=refined_plan.id)).status != "completed":
time.sleep(5)
print(result.steps[-1].content[0].text)
JavaScript
const refinedPlan = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'Focus more on the differences between Google TPUs and competitor hardware, and less on the history.',
agent_config: {
type: 'deep-research',
thinking_summaries: 'auto',
collaborative_planning: true
},
previous_interaction_id: planInteraction.id,
background: true
});
let result;
while ((result = await client.interactions.get(refinedPlan.id)).status !== 'completed') {
await new Promise(r => setTimeout(r, 5000));
}
console.log(result.steps.at(-1).content[0].text);
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "deep-research-preview-04-2026",
"input": "Focus more on the differences between Google TPUs and competitor hardware, and less on the history.",
"agent_config": {
"type": "deep-research",
"thinking_summaries": "auto",
"collaborative_planning": true
},
"previous_interaction_id": "PREVIOUS_INTERACTION_ID",
"background": true
}'
Шаг 3: Утвердить и выполнить
Установите параметр collaborative_planning=False (или опустите его), чтобы утвердить план и начать исследование.
Python
# Third interaction: approve the plan and kick off research
final_report = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Plan looks good!",
agent_config={
"type": "deep-research",
"thinking_summaries": "auto",
"collaborative_planning": False,
},
previous_interaction_id=refined_plan.id,
background=True,
)
while (result := client.interactions.get(id=final_report.id)).status != "completed":
time.sleep(5)
print(result.steps[-1].content[0].text)
JavaScript
const finalReport = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'Plan looks good!',
agent_config: {
type: 'deep-research',
thinking_summaries: 'auto',
collaborative_planning: false
},
previous_interaction_id: refinedPlan.id,
background: true
});
let result;
while ((result = await client.interactions.get(finalReport.id)).status !== 'completed') {
await new Promise(r => setTimeout(r, 5000));
}
console.log(result.steps.at(-1).content[0].text);
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "deep-research-preview-04-2026",
"input": "Plan looks good!",
"agent_config": {
"type": "deep-research",
"thinking_summaries": "auto",
"collaborative_planning": false
},
"previous_interaction_id": "PREVIOUS_INTERACTION_ID",
"background": true
}'
Визуализация
Когда visualization установлен режим "auto" , агент может создавать диаграммы, графики и другие визуальные элементы для подтверждения результатов исследования. Сгенерированные изображения включаются в этапы ответа и передаются в виде дельта image . Для достижения наилучших результатов явно укажите необходимость визуализации в запросе — например, «Включить диаграммы, показывающие тенденции во времени» или «Создать графики, сравнивающие долю рынка». Установка visualization в режим "auto" активирует эту возможность, но агент будет создавать визуализацию только тогда, когда это будет запрошено в запросе.
Python
import base64
import time
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Analyze global semiconductor market trends. Include graphics showing market share changes.",
agent_config={
"type": "deep-research",
"visualization": "auto",
},
background=True,
)
print(f"Research started: {interaction.id}")
while (result := client.interactions.get(id=interaction.id)).status != "completed":
time.sleep(5)
for step in result.steps:
if step.type == "model_output":
for content_item in step.content:
if content_item.type == "text":
print(content_item.text)
elif content_item.type == "image" and content_item.data:
image_bytes = base64.b64decode(content_item.data)
print(f"Received image: {len(image_bytes)} bytes")
JavaScript
import { GoogleGenAI } from '@google/genai';
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'Analyze global semiconductor market trends. Include graphics showing market share changes.',
agent_config: {
type: 'deep-research',
visualization: 'auto'
},
background: true
});
console.log(`Research started: ${interaction.id}`);
let result;
while ((result = await client.interactions.get(interaction.id)).status !== 'completed') {
await new Promise(r => setTimeout(r, 5000));
}
for (const step of result.steps) {
if (step.type === 'model_output') {
for (const contentItem of step.content) {
if (contentItem.type === 'text') {
console.log(contentItem.text);
} else if (contentItem.type === 'image' && contentItem.data) {
console.log(`[Image Output: ${contentItem.data.substring(0, 20)}...]`);
}
}
}
}
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "deep-research-preview-04-2026",
"input": "Analyze global semiconductor market trends. Include graphics showing market share changes.",
"agent_config": {
"type": "deep-research",
"visualization": "auto"
},
"background": true
}'
Поддерживаемые инструменты
Deep Research поддерживает множество встроенных и внешних инструментов. По умолчанию (если параметр tools не указан) агент имеет доступ к поиску Google, контексту URL и выполнению кода. Вы можете явно указать инструменты, чтобы ограничить или расширить возможности агента.
| Инструмент | Тип значения | Описание |
|---|---|---|
| Поиск Google | google_search | Поиск в открытом доступе в интернете. Включено по умолчанию. |
| Контекст URL | url_context | Чтение и краткое изложение содержимого веб-страницы. Включено по умолчанию. |
| Выполнение кода | code_execution | Выполнить код для проведения вычислений и анализа данных. Включено по умолчанию. |
| Сервер MCP | mcp_server | Для доступа к внешним инструментам подключитесь к удалённым серверам MCP. |
| Поиск файлов | file_search | Выполните поиск в загруженных вами корпусах документов. |
Поиск Google
Явно укажите Google Поиск в качестве единственного используемого инструмента:
Python
interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="What are the latest developments in quantum computing?",
tools=[{"type": "google_search"}],
background=True,
)
JavaScript
const interaction = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'What are the latest developments in quantum computing?',
tools: [{ type: 'google_search' }],
background: true
});
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "deep-research-preview-04-2026",
"input": "What are the latest developments in quantum computing?",
"tools": [{"type": "google_search"}],
"background": true
}'
Контекст URL
Предоставьте агенту возможность читать и кратко излагать содержание конкретных веб-страниц:
Python
interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Summarize the content of https://www.wikipedia.org/.",
tools=[{"type": "url_context"}],
background=True,
)
JavaScript
const interaction = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'Summarize the content of https://www.wikipedia.org/.',
tools: [{ type: 'url_context' }],
background: true
});
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "deep-research-preview-04-2026",
"input": "Summarize the content of https://www.wikipedia.org/.",
"tools": [{"type": "url_context"}],
"background": true
}'
Выполнение кода
Разрешите агенту выполнять код для вычислений и анализа данных:
Python
interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Calculate the 50th Fibonacci number.",
tools=[{"type": "code_execution"}],
background=True,
)
JavaScript
const interaction = await client.interactions.create({
agent: 'deep-research-preview-04-2026',
input: 'Calculate the 50th Fibonacci number.',
tools: [{ type: 'code_execution' }],
background: true
});
ОТДЫХ
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"input": "Calculate the 50th Fibonacci number.",
"agent": "deep-research-preview-04-2026",
"tools": [{"type": "code_execution"}],
"background": true
}'
Серверы MCP
Подключитесь к удаленным серверам MCP, чтобы предоставить агенту доступ к внешним инструментам и сервисам.
Укажите name и url сервера в конфигурации инструментов. Вы также можете передать учетные данные для аутентификации и ограничить доступ агента к определенным инструментам.
| Поле | Тип | Необходимый | Описание |
|---|---|---|---|
type | string | Да | Должно быть "mcp_server" . |
name | string | Нет | Отображаемое имя для сервера MCP. |
url | string | Нет | Полный URL-адрес конечной точки сервера MCP. |
headers | object | Нет | Пары ключ-значение отправляются в качестве HTTP-заголовков с каждым запросом к серверу (например, токены аутентификации). |
allowed_tools | array | Нет | Ограничьте доступ агента к определенным инструментам на сервере. |
Основное использование
Python
interaction = client.interactions.create(
agent="deep-research-preview-04-2026",
input="Check the status of my last server deployment.",
tools=[
{
"type": "mcp_server",
"name": "Deployment Tracker",
"url": "https://mcp.example.com/mcp",
"headers": {"Authorization": "Bearer my-token"},
}
],
background=True,
)
JavaScript
const interaction = await client.interactions.create({