{"slug": "give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token", "title": "Give Your AI Agent Live Web Search - Search Results as Clean Markdown with Token Limits (Standby API + MCP)", "summary": "A developer built RAG Web Browser, an Apify-hosted tool that takes a search query and returns the top web pages as clean, LLM-ready Markdown with token estimates and truncation flags, so agents can ground answers in fresh sources with citations. The tool runs in Apify's always-on Standby mode as an HTTP endpoint, uses Google search with automatic DuckDuckGo fallback, and can be wired into LangChain, CrewAI, OpenAI or Anthropic tool-calling APIs, n8n, or any MCP client via the Apify MCP server. Pricing is $1.80 per 1,000 pages read plus $0.003 per Google search, with no search fee on DuckDuckGo — roughly $5.40 for 1,000 questions reading three pages each.", "body_md": "LLMs don't know what happened yesterday, and they make things up when they don't know. The fix is **grounding**: let the model search the web, read the top pages and answer with citations.\n\nDoing that yourself means stitching together a search API, a scraper, HTML-to-Markdown conversion, boilerplate removal and a way to keep pages inside your context window. This guide shows a single tool that does all of it in one call. **Send a question and get the top results as clean, LLM-ready Markdown** with token estimates and truncation flags.\n\n```\n{\n  \"query\": \"best vector database for RAG\",\n  \"rank\": 1,\n  \"url\": \"https://www.braintrust.dev/articles/best-vector-databases-for-rag-2026\",\n  \"title\": \"Best vector databases for RAG in 2026\",\n  \"markdown\": \"# Best vector databases for RAG in 2026\\n\\nTL;DR...\",\n  \"tokenEstimate\": 1500,\n  \"truncated\": true,\n  \"renderedWith\": \"http\",\n  \"searchEngine\": \"duckduckgo\"\n}\n```\n\n`maxContentTokens`` truncated` tells you when it happened.`url` + `rank`\nOpen **[RAG Web Browser](https://apify.com/karioski/rag-web-search-browser)** on Apify:\n\n```\n{\n  \"query\": \"best vector database for RAG\",\n  \"maxResults\": 3,\n  \"maxContentTokens\": 1500,\n  \"outputFormat\": \"markdown\"\n}\n```\n\nOutput can be `markdown`, `text` or `html`. For batch research, pass many questions at once in `queries`.\n\nThe tool runs in **Standby mode**, an always-on HTTP endpoint, so your agent gets answers in seconds without waiting for a container to start:\n\n```\nGET https://<standby-url>/search?query=...&maxResults=3&maxContentTokens=2000\nAuthorization: Bearer <YOUR_APIFY_TOKEN>\n```\n\nIt returns a JSON array of pages. Wrap it as a tool in LangChain, CrewAI, the OpenAI or Anthropic tool-calling APIs, or an n8n HTTP node.\n\nAdd it through the **Apify MCP server**, and Claude Desktop, Cursor or any MCP client can call \"search the web and read the top 3 pages\" as a native tool.\n\n``` python\nfrom apify_client import ApifyClient\n\nclient = ApifyClient(\"YOUR_APIFY_TOKEN\")\nquestion = \"What changed in the EU AI Act timeline this year?\"\n\nrun = client.actor(\"karioski/rag-web-search-browser\").call(run_input={\n    \"query\": question,\n    \"maxResults\": 3,\n    \"maxContentTokens\": 1500,\n})\npages = list(client.dataset(run[\"defaultDatasetId\"]).iterate_items())\n\ncontext = \"\\n\\n\".join(f\"[{i+1}] {p['url']}\\n{p['markdown']}\" for i, p in enumerate(pages))\nprompt = f\"Answer using only the sources below and cite them as [n].\\n\\nQuestion: {question}\\n\\nSources:\\n{context}\"\n# -> send `prompt` to your LLM of choice\n```\n\nThe tool uses Google with **automatic DuckDuckGo fallback**, so searches don't come back empty. You can also force one engine.\n\n| What | Price on paid Apify plans | \n|---|---|\n| Page read and converted | $1.80 per 1,000 | \n| Google search (only when Google results are used) | $0.003 per search | \n\nDuckDuckGo queries have **no search fee**, so you pay only for pages read. Example: 1,000 agent questions reading 3 pages each cost about **$5.40** with DuckDuckGo.\n\n**Try it:** [RAG Web Browser on Apify →](https://apify.com/karioski/rag-web-search-browser)\n\n*Disclosure: I built this tool. Questions or feature requests are welcome on the Actor page.*", "url": "https://wpnews.pro/news/give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token", "canonical_source": "https://dev.to/rabah_karaouat_e35d5e348e/give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token-limits-standby-16c4", "published_at": "2026-11-28 18:10:07+00:00", "updated_at": "2026-11-28 18:13:55.133355+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "agent-protocols", "ai-search"], "entities": ["Apify", "RAG Web Browser", "DuckDuckGo", "Google", "LangChain", "CrewAI", "Claude Desktop", "Cursor"], "also_reported_by": [], "takeaway": "Wrapping a search-plus-scrape-plus-Markdown pipeline as a single tool call with a maxContentTokens cap and a truncated flag keeps retrieved pages inside the context window and lets the model cite sources by URL.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token", "markdown": "https://wpnews.pro/news/give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token.md", "text": "https://wpnews.pro/news/give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token.txt", "jsonld": "https://wpnews.pro/news/give-your-ai-agent-live-web-search-search-results-as-clean-markdown-with-token.jsonld"}}