grok_agent
Process tasks using an AI agent that combines file analysis, vision capabilities, web and X search, and code execution to generate comprehensive answers.
Instructions
All-in-one Grok agent combining files, vision, web/X search, and code execution.
Enable any subset of tools and attach any mix of uploaded files and images.
The agent decides which tools to use per turn. Supports optional local
session history and multi-agent research via `agent_count`.
Args:
prompt: Task or question for the agent.
session: Optional session name for persistent history in `chats/{session}.json`.
model: Grok model driving the agent (default `grok-4-1-fast-reasoning`).
file_ids: IDs of previously uploaded files to attach as context.
image_urls: Public image URLs to attach.
image_paths: Local image files to attach (sent as base64 data URIs).
use_web_search: Enable the agentic web search tool.
use_x_search: Enable the agentic X (Twitter) search tool.
use_code_execution: Enable the Python code execution tool.
allowed_domains: Web search allow-list (max 5, mutually exclusive with excluded).
excluded_domains: Web search deny-list (max 5).
allowed_x_handles: X search handle allow-list (max 10, mutually exclusive with excluded).
excluded_x_handles: X search handle deny-list (max 10).
from_date: X search inclusive start date as `DD-MM-YYYY`.
to_date: X search inclusive end date as `DD-MM-YYYY`.
enable_image_understanding: Let search tools analyze images they encounter.
enable_video_understanding: Let X search analyze videos in posts.
include_inline_citations: Embed `[1]`-style citation markers into the answer.
system_prompt: Optional system instruction prepended to the conversation.
max_turns: Cap the agent's reasoning/tool turns.
agent_count: 4 or 16. Only valid with `grok-4.20-multi-agent`.
Returns:
Markdown with the answer body followed by a `**Sources:**` list when citations exist.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| session | No | ||
| model | No | grok-4-1-fast-reasoning | |
| file_ids | No | ||
| image_urls | No | ||
| image_paths | No | ||
| use_web_search | No | ||
| use_x_search | No | ||
| use_code_execution | No | ||
| allowed_domains | No | ||
| excluded_domains | No | ||
| allowed_x_handles | No | ||
| excluded_x_handles | No | ||
| from_date | No | ||
| to_date | No | ||
| enable_image_understanding | No | ||
| enable_video_understanding | No | ||
| include_inline_citations | No | ||
| system_prompt | No | ||
| max_turns | No | ||
| agent_count | No |