Tavily CLI
Command-line interface for Tavily search, extract, and crawl operations
Tavily CLI Usage
Use Tavily search capabilities directly from the command line.
Prerequisites
# Install praisonai-ts globally
npm install -g praisonai
# Set your API key
export TAVILY_API_KEY=your-api-keyCommands
List Available Tools
praisonai-ts tools listOutput:
AI SDK Tools Registry
Built-in Tools:
• tavily (Tavily)
Web search, content extraction, crawling, and site mapping powered by Tavily
Tags: search, web, extract, crawl | Package: @tavily/ai-sdk
...Get Tool Info
praisonai-ts tools info tavilyOutput:
Tool: Tavily
ID: tavily
Description: Web search, content extraction, crawling, and site mapping powered by Tavily
Package: @tavily/ai-sdk
Tags: search, web, extract, crawl
Docs: https://praison.ai/docs/js/tools/tavily
Required Environment Variables:
✓ TAVILY_API_KEY
Installation:
npm install @tavily/ai-sdk
Capabilities:
search, extract, crawlCheck Tool Health
praisonai-ts tools doctorOutput:
Tools Health Check
Summary: 3/12 packages installed, 5 with missing env vars
✓ tavily (Tavily)
✗ exa (Exa)
Package not installed: npm install @exalabs/ai-sdk
Missing env vars: EXA_API_KEY
...Show Usage Example
praisonai-ts tools example tavilyOutput:
import { Agent, tools } from 'praisonai';
const agent = new Agent({
name: 'Researcher',
instructions: 'Search the web for information.',
tools: [tools.tavily()],
});
const result = await agent.run('What are the latest AI developments?');
console.log(result.text);Test Tool (Dry Run)
praisonai-ts tools test tavilyOutput:
Dry run for tavily: OK
Tool is registered and ready
Use --live flag to run actual API testTest Tool (Live)
praisonai-ts tools test tavily --liveOutput:
Live test for tavily...
Test passed!
Result: {
"query": "test",
"results": [...],
"responseTime": 1.23
}Running Agents with Tavily
Simple Search Agent
praisonai-ts run --tools tavily "Search for latest AI news"With Configuration File
Create agent.yaml:
name: ResearchAgent
instructions: You are a research assistant that searches the web.
tools:
- tavily:
maxResults: 10
includeAnswer: true
searchDepth: advancedRun:
praisonai-ts run -c agent.yaml "What are the top AI frameworks in 2024?"JSON Output
praisonai-ts run --tools tavily --output json "Search for AI news" | jq .Environment Variables
| Variable | Required | Description |
|---|---|---|
TAVILY_API_KEY | Yes | Your Tavily API key |
OPENAI_API_KEY | Yes | OpenAI API key for the agent |
CLI Options
Global Options
| Option | Description |
|---|---|
--json | Output in JSON format |
--verbose | Enable verbose logging |
--output <format> | Output format: json, text, pretty |
Tools Subcommand Options
| Command | Options | Description |
|---|---|---|
tools list | --tag <tag> | Filter by tag |
tools info <id> | --verbose | Show detailed info |
tools doctor | – | Check all tools health |
tools test <id> | --live | Run live API test |
tools example <id> | – | Show usage example |
tools add <pkg> | – | Register npm package |
Examples
Search with Specific Options
# News search
praisonai-ts run --tools "tavily:topic=news,timeRange=day" "Latest tech news"
# Domain-specific search
praisonai-ts run --tools "tavily:includeDomains=github.com,stackoverflow.com" "How to use TypeScript generics"Multi-Tool Agent
praisonai-ts run --tools "tavily,exa" "Compare search results for AI frameworks"Batch Processing
# Search multiple queries
cat queries.txt | while read query; do
praisonai-ts run --tools tavily --output json "$query" >> results.jsonl
doneWith Custom Model
praisonai-ts run --model gpt-4o --tools tavily "Deep research on quantum computing"Troubleshooting
Missing API Key
Error: TAVILY_API_KEY environment variable is requiredSolution:
export TAVILY_API_KEY=your-api-keyPackage Not Installed
Error: Tool "tavily" requires package "@tavily/ai-sdk"Solution:
npm install @tavily/ai-sdkRate Limiting
Error: Rate limit exceededSolution: Wait and retry, or upgrade your Tavily plan.