You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(knowledge): Tavily connector + web-research wrapper with caching (#1234)
### Why this matters
GAIA agents could only reach the web through keyless DuckDuckGo HTML
scraping — no
Tavily, no result caching, and no way to track or cap API spend. This PR
is the Phase 1
foundation for the Knowledge Agent: a `_TAVILY` connector that exposes
Tavily
`search`/`extract` as MCP tools to **all** agents from one
keyring-stored API key, plus a
`gaia.web.tavily` wrapper giving cached, credit-budgeted
search/extract/crawl with an
automatic DuckDuckGo fallback when Tavily isn't configured. Agents get
higher-quality web
research without re-paying for repeat queries or silently blowing past a
credit budget.
### Test plan
- [ ] `python -m pytest tests/unit/test_tavily_wrapper.py` — 16 tests
(mocked SDK): cache hit/TTL, credit ledger, budget warn/block,
DuckDuckGo fallback
- [ ] `python -m pytest tests/unit/connectors/test_catalog_docs_url.py`
— the new connector's `docs_url` resolves
- [ ] `python util/lint.py --black --isort` — clean
- [ ] With a key: `gaia connectors configure mcp-tavily --set
TAVILY_API_KEY=tvly-…` then `gaia knowledge search "…"` returns Tavily
results; without it, the same command falls back to DuckDuckGo
- [ ] `gaia knowledge usage` prints the credit ledger
### Open questions for reviewers
- **Catalog scope:** `_TAVILY` has no built-in agent consumer yet (the
Knowledge Agent lands in a later phase), so there's no
`REQUIRED_CONNECTORS` wiring. Acceptable for a foundation PR, or should
the entry wait? (@kovtcharov-amd)
- **Async `crawl`:** sync `TavilyClient` has `crawl`;
`AsyncTavilyClient` doesn't yet — deferred unless you want parity now.
Phase 1 of #1141.
---------
Co-authored-by: Tomasz Iniewicz <itomek@users.noreply.github.com>
If the connector isn't configured, `gaia knowledge search` and the wrapper
70
+
fall back to a keyless DuckDuckGo search — so search works out of the box,
71
+
and Tavily simply upgrades its quality and adds `extract`/`crawl`.
72
+
</Note>
73
+
74
+
## Common issues
75
+
76
+
### `Unauthorized` / `401` from the MCP server
77
+
78
+
The key in your keyring is wrong or revoked. Click **Disconnect** on the tile
79
+
(or `gaia connectors disconnect mcp-tavily`) and re-add a fresh key.
80
+
81
+
### `npx: command not found`
82
+
83
+
`tavily-mcp` is launched via `npx`. Install Node 18+ and ensure `npx` is on
84
+
your `PATH`:
85
+
86
+
```bash
87
+
node --version # must be >= 18
88
+
which npx # must resolve to a real path
89
+
```
90
+
91
+
### Budget exceeded
92
+
93
+
`gaia knowledge` warns (if nearing the budget) then blocks once a session passes its `--budget` credit cap. Raise the cap, or pass `--no-block` to warn and proceed instead of blocking.
0 commit comments