tavily
v0.1.0 · compiled with katari 0.1.0
Overview
from the package READMEtavily — web search as a Katari tool
A single module, tavily: web search over the Tavily API, exposed as a tool
the model can call. Pure Katari — the request body is built as json, the POST is the prelude's
http.post_json, and the response is parsed as json. No FFI sidecar.
tavily.search(query)— the tool: returns the top results as a compact digest (title, URL, and a content snippet per hit), small enough to feed straight back to the model.tavily.provider(api_key = ...)— provides the API key capability for the extent of a continuation, sosearchnever takes the key as an argument.
Secrets / env
TAVILY_API_KEY— your Tavily API key. Store it in the runtime:katari env set TAVILY_API_KEY --secret. It is astring of private, riding the search call'sAuthorizationheader and never leaving as anything else.
Usage
import tavily
agent search_the_web(query: string) -> string with io {
use tavily.provider(api_key = env.get_secret(key = "TAVILY_API_KEY"))
tavily.search(query = query)
}Hand tavily.search to an AI loop's tool list to let the model search on its own.
tavily
4 declarationsget_tavily_key#
requestrequest get_tavily_key() -> string of privateThe Tavily API key capability (provided once at the root by use tavily.provider(...)).
Returns
Wire view (JSON Schema)
provider#
agentagent provider[R, effect E](api_key: string of private, continuation: agent(value: null) -> R with {...E, get_tavily_key}) -> R with EProvide the Tavily API key capability for the extent of the continuation.
Generics
Parameters
Returns
Effects
Inferred type
agent(api_key: string of private, continuation: agent(value: null) -> T0 with get_tavily_key | E1) -> T0 with E1
Wire view — the wire shape is fixed at the call site, where the generic parameters are instantiated.
search#
agentagent search(query: string) -> stringTool: search the web and return the top results as a compact digest (title, URL, content snippet per hit — small enough to feed straight back to the model).
Parameters
Returns
Inferred type
agent(query: string) -> string with throw[fetch_error | status_error | parse_error] | get_tavily_key | io
Wire view (JSON Schema)
render_results#
agentagent render_results(parsed: unknown) -> stringOne digest line per result; a shape the API never promised (no results array) degrades to a note rather than an error — the model can rephrase and retry.
Parameters
Returns