Linkup
Explore Linkup’s search, fetch, and research APIs.
Hotel booking voice agent
See a Gradbot demo that books hotels using live web search.
Voice-controlled web search
A voice search agent built on Gradium and Linkup follows this loop:- The caller asks a spoken question, such as “Find me a boutique hotel in Lisbon under 150 euros a night.”
- Gradium Speech-to-Text transcribes the request in real time.
- The agent calls a search tool with a focused query built from the caller’s spoken preferences.
- Linkup returns ranked results with titles, sources, snippets, and images.
- The agent filters, compares, and summarizes the results.
- Gradium Text-to-Speech streams the answer back to the caller.
Core wiring
The hotel demo exposes search as voice-agent tools. Gradium handles the live STT and TTS session; the agent decides when to callsearch_hotels and get_hotel_details.
Search tool definition
Calling the Linkup Search API
The demo uses thelinkup-sdk package. Because the client is synchronous, the handler runs each search in a thread pool so it does not block the voice session. include_images=True returns image results alongside the text sources.
name, url, and content; image results carry a name and url. Two parameters shape the search:
depthtrades latency for thoroughness.fastis sub-second keyword search for latency-critical paths like voice,standardis single-iteration agentic search at roughly one to three seconds and suits most agent lookups, anddeepruns up to ten iterations at five to thirty seconds for complex, multi-source investigations. The demo usesstandard.output_typeshapes the return value.searchResultsreturns ranked URLs and snippets for the agent to reason over,sourcedAnswerreturns a generated answer with citations, andstructuredreturns JSON matching a schema you provide. The demo usessearchResultsso the agent can filter and summarize the sources itself.
Returning results to the agent
The tool handler streams the sources and images to the browser, swaps in a prompt built from the search results, and sends a compact summary back to the agent along with instructions for how to speak the answer. Keeping the payload small keeps the LLM leg of the turn fast.Agent session config
The session config wires the tools into a live Gradium voice session.Keep the voice loop fast
Latency is what makes voice search feel magical or broken. The demo applies a few rules worth copying:- Search off the event loop. The Linkup client is synchronous, so run it in a thread pool with
run_in_executorto avoid blocking audio while a query is in flight. - Match depth to the turn. The demo uses
standarddepth and covers the wait with conversation. For lookups that need to land inside a conversational pause,depth="fast"returns sub-second keyword results; reservedeepfor research-style questions where a few extra seconds is acceptable. - Cover the wait with conversation. Prompt the agent to keep chatting about the destination while the search runs, so the caller never hears dead air.
- Cap and truncate results. A handful of sources with snippets trimmed to about 300 characters give the LLM enough to answer without inflating the prompt.
- Stream sources to the screen. Send source cards and images to the browser as results arrive so the caller sees what the agent is talking about.
- Handle failures in the agent’s voice. If a search fails, return an empty result and tell the agent to say it could not reach the web right now, rather than letting the model guess.
Authentication
Get an API key from the Linkup dashboard. Pass it to theLinkupClient or set it as an environment variable alongside your Gradium key:
| Variable | Purpose |
|---|---|
LINKUP_API_KEY | Linkup search key |
GRADIUM_API_KEY | Gradium voice (STT and TTS) |
Why use Linkup with Gradium?
- Fresh answers in live voice sessions: give Gradium agents access to current web results without making callers leave the conversation.
- Search that follows spoken constraints: turn natural-language preferences like budget, location, style, or dates into focused Linkup queries.
- Sources and images together: results come back as clean structured data with text sources and images, ready to summarize, speak, and stream to the screen.
- Grounded spoken answers: the agent answers from live web results instead of stale model memory, and can cite the source naturally.