← Back to Hub
🔧 TOOL USE

Groq Tool Use Demo

Sometimes models need backup. That's what tools are for — giving AI instant access to real-time data, code execution, and web automation. Try live demos below.

🛰️ Built-In Real-Time Tools

The compound and GPT-OSS series models have these tools baked in — no configuration required.

🔍

Web Search

Live internet searches for up-to-date facts, news, and research.

Built-in
⚡

Code Execution

Run Python, JS, and more in a sandboxed environment in real time.

Built-in
🌐

Browser Automation

Navigate pages, click links, extract content from the live web.

Built-in

⚙️ Groq: Flexible Tool Foundation

Want to use your own API or a different model? Groq is your flexible foundation. Drop in OpenAI-style tool definitions, get validated JSON back, and call multiple tools in parallel.

Compatibility
OpenAI-Compatible
Output Format
Structured JSON
Parallelism
Multi-Tool Calls
Primary Model
llama-3.3-70b

🔀 Parallel Tool Use — Weather + Stock Market

Ask a question that requires both a weather API and a stock market API simultaneously. Groq fires both tool calls at once, then synthesizes the live data into a natural-language answer.

tools = [ { "type": "function", "function": { "name": "get_weather", ... } }, { "type": "function", "function": { "name": "get_stock_price", ... } } ] // Model may call BOTH tools in a single response turn

🔌 OpenAI-Compatible Custom Tool

Drop any OpenAI-structured tool definition into Groq. Here we use a web_search tool with the exact same schema format.

// Exact same format as OpenAI — zero changes needed { "type": "function", "function": { "name": "web_search", "description": "Search the web for real-time information", "parameters": { "type": "object", "properties": { "query": { "type": "string" } }, "required": ["query"] } } }

📋 Structured JSON Output

Get a perfectly validated JSON object back from the model — no parsing hacks needed. Uses Groq's response_format or tool-return pattern.


⚡ Code Execution Tool

Define a execute_code tool that the model calls when it needs to run calculations or code. JavaScript runs in a sandboxed function; Python runs via Pyodide (WebAssembly — first run loads ~30 MB).

🔑 Configuration

Demos use the repository-wide Groq API key. You can also provide your own below.