Skip to main content

Get API Key

Sign up at tavily.com

Introduction

OpenCode is an open-source AI coding agent for the terminal. It runs as a TUI that understands your codebase, edits files, runs shell commands, and supports plugins, custom agents, and skills. Tavily integrates with OpenCode through the official opencode-tavily plugin. The plugin registers the Tavily skill with OpenCode, giving the agent reliable web search, content extraction, crawling, URL discovery, and deep research with citations — powered by the Tavily CLI under the hood.

What the plugin adds

Once installed, the agent can:
  • Search the web with optional content extraction
  • Extract any webpage to clean markdown or text
  • Map all URLs on a website
  • Crawl entire websites recursively
  • Research — AI-powered deep research with citations
All output is written to a .tavily/ directory to avoid flooding the agent’s context.

Requirements

Setup

If OpenCode is not installed yet, install it first:
Or via npm:
The plugin drives Tavily through the tvly CLI:
Or via Python:
Add opencode-tavily to the plugin array in your opencode.json:
OpenCode installs npm plugins automatically on next launch.
Browser login is recommended — it opens Tavily’s OAuth flow automatically:
Alternatively, set an API key from the Tavily Dashboard:
If TAVILY_API_KEY is set in your environment, the plugin automatically passes it through to shell commands.
Start OpenCode and ask a current-events question, for example:
The agent should run tvly search and return grounded results with sources.

Example prompts

Troubleshooting

If the agent cannot access the web or Tavily commands fail, check these in order:
  1. Is the plugin listed in opencode.json?
  2. Is the Tavily CLI installed and authenticated?

Learn more