web-search

Implement web search functionality using the z-ai-web-dev-sdk to retrieve structured search results.

Updated Jul 11, 2026
One-click install
npx skills add https://github.com/mukaddam-ali/Anadolu-Kitchen --skill web-search-mukaddam-ali
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: web-search
Source: https://github.com/mukaddam-ali/Anadolu-Kitchen/tree/main/skills/web-search
Command: npx skills add https://github.com/mukaddam-ali/Anadolu-Kitchen --skill web-search-mukaddam-ali

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires z-ai-web-dev-sdk, and includes scripts (resource) components.

What problem does it solve? Applications often need access to current, real-time information from the web, but integrating search capabilities requires handling APIs, result parsing, and error handling. This Skill provides ready-to-use patterns for adding web search to backend applications using the z-ai-web-dev-sdk. ## Core Features & Use Cases - Web Search via SDK or CLI: Invoke the web_search function programmatically in backend code or run quick queries from the command line with the z-ai CLI. - Structured Results: Receive results with URL, title, snippet, domain, rank, date, and favicon for each match, with options to control result count and recency. - Advanced Patterns: Includes examples for result caching, rate limiting, quality validation, news search, research assistance, and combining search with AI summarization. - Use Case: Build an Express.js search API endpoint that accepts a query parameter, searches the web, and returns formatted JSON results to a frontend application. ## Quick Start Ask the AI to search the web for a topic like "latest AI news" using the web-search skill and return the top five results with titles and URLs.

Frequently Asked Questions about web-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add web search to a Node.js application?

Import ZAI from z-ai-web-dev-sdk, create an instance with ZAI.create(), then call zai.functions.invoke with the web_search function name, passing a query and optional result count. Results return as an array of items with URL, title, snippet, and date.

How to run a web search from the command line?

Use the z-ai CLI with the function command: z-ai function -n web_search -a '{"query": "your topic", "num": 5}'. Add the -o flag with a file path to save results as JSON, and use recency_days to filter by date.

Can I use z-ai-web-dev-sdk in client-side browser code?

No, the z-ai-web-dev-sdk must only be used in backend code. Importing it in client-side code will fail and could expose credentials. Call it from server-side routes or API endpoints instead.

What data does each web search result contain?

Each result is a SearchFunctionResultItem containing url, name (page title), snippet (preview text), host_name (domain), rank, date, and favicon. You can map these fields into custom formats for display or further processing.

Why does my web search return empty or no results?

Empty results usually come from overly vague query terms, connectivity issues, or API problems. Refine the query with specific keywords, verify the response is an array, and implement retry logic with exponential backoff for transient failures.

How do I avoid rate limits when making many search requests?

Implement a rate limiter that tracks request timestamps and waits when the per-minute threshold is reached. Combine this with result caching using a Map keyed by query, so repeated searches within the cache window skip the API call entirely.