An autonomous AI research agent that combines Ollama's web search with your local LLMs. Watch as your model reasons through complex queries, autonomously searches the web, and synthesizes intelligent answers with citations.
- Autonomous Agent - Local LLM decides when to search, fetch, and synthesize
- Clean Output - Shows final answers with a loading animation; optionally view full reasoning
- Smart Web Research - Autonomous web search and page fetching with context
- Fast & Efficient - Built with Rust for maximum performance
- Production Ready - Comprehensive error handling and logging
- Highly Configurable - Multiple models, output formats, and options
git clone https://github.com/guitaripod/weavex.git
cd weavex
cargo install --path .cargo install weavexYou need an Ollama API key to use this tool. Get one at ollama.com/settings/keys.
export OLLAMA_API_KEY="your_api_key_here"Or create a .env file:
echo "OLLAMA_API_KEY=your_api_key_here" > .envRun autonomous research with your local Ollama models:
# Use default model (gpt-oss:20b) - opens result in browser by default
weavex agent "What are the top 3 Rust developments from 2025?"
# Disable browser preview, show in terminal
weavex agent --no-preview "query"
# Specify a different model
weavex agent --model qwen3:14b "research quantum computing trends"
# Show thinking steps and reasoning process for transparency
weavex agent --show-thinking "query"
# Disable model reasoning mode
weavex agent --disable-reasoning "query"
# Custom Ollama server
weavex agent --ollama-url http://192.168.1.100:11434 "query"
# Limit agent iterations
weavex agent --max-iterations 5 "query"How it works:
- Agent uses your local Ollama model for reasoning
- Shows a loading animation (🧵 Weaving...) while working
- Autonomously decides when to search the web or fetch URLs
- Iterates until it has enough information
- Opens the final result in your browser with markdown rendering (use --no-preview for terminal output)
Agent Output:
- 🧵 Weaving...: Loading animation while agent works
- 🌐 Browser Preview: Opens result in browser by default (use --no-preview for terminal output)
With --show-thinking flag:
- 🧠 Reasoning: Shows the model's thinking process
- 🔎 Searching: Web search operations
- 🌐 Fetching: URL fetch operations
- 💬 Response: Model's synthesized content
Requirements:
- Local Ollama server running (
ollama serve) - Model downloaded locally (
ollama pull gpt-oss:20b) - Ollama API key for web search access
Recommended Models:
gpt-oss:20b- Best balance of speed and reasoning (default)qwen3:14b- Good tool-use capabilitiesqwen3:4b- Fastest, runs on laptops
For quick searches without the agent, you can use the direct API mode:
# Opens results in browser by default
weavex "what is rust programming"
# Show results in terminal
weavex --no-preview "what is rust programming"weavex --max-results 5 "best practices for async rust"weavex --json "machine learning trends 2025"weavex fetch https://example.com# Pass API key via flag
weavex --api-key YOUR_KEY "query here"
# Verbose logging
weavex --verbose "debugging query"Click to expand options
-k, --api-key <API_KEY> Ollama API key (can also use OLLAMA_API_KEY env var)
-m, --max-results <NUM> Maximum number of search results to return
-j, --json Output results as JSON
--no-preview Disable browser preview (preview is enabled by default)
-v, --verbose Enable verbose logging
--timeout <SECONDS> Request timeout in seconds [default: 30]
-h, --help Print help
-V, --version Print version
fetch Fetch and parse a specific URL
agent Run an AI agent with web search capabilities
help Print this message or the help of the given subcommand(s)
-m, --model <MODEL> Local Ollama model to use [default: gpt-oss:20b]
--ollama-url <URL> Local Ollama server URL [default: http://localhost:11434]
--max-iterations <NUM> Maximum agent iterations [default: 50]
--show-thinking Show agent thinking steps and reasoning process
--disable-reasoning Disable model reasoning (thinking mode)
--no-preview Disable browser preview (preview is enabled by default)
Click to expand environment variables
OLLAMA_API_KEY- Your Ollama API key (required)OLLAMA_BASE_URL- Base URL for the API (default:https://ollama.com/api)OLLAMA_TIMEOUT- Request timeout in seconds (default: 30)
# Opens result in browser by default
weavex agent "What are the latest benchmarks for Rust async runtimes?"The agent will autonomously:
- Display a loading animation while working
- Search for relevant benchmark articles
- Fetch specific benchmark results
- Compare data from multiple sources
- Open the final result in your browser with markdown rendering
Show the reasoning steps and full transparency:
weavex agent --show-thinking "What are the latest benchmarks for Rust async runtimes?"Disable browser preview to see output in terminal:
weavex agent --no-preview "What are the latest benchmarks for Rust async runtimes?"Disable reasoning mode for faster responses:
weavex agent --disable-reasoning "What are the latest benchmarks for Rust async runtimes?"weavex "latest rust async runtime benchmarks"weavex --max-results 10 "tokio vs async-std performance"weavex fetch https://blog.rust-lang.org/weavex --json "rust web frameworks" | jq '.results[0].url'Click to expand development info
cargo buildcargo testcargo build --releaseThe release binary will be optimized with LTO and stripped of debug symbols.
Click to expand project structure
src/
├── main.rs - Application entry point and orchestration
├── agent.rs - AI agent loop with tool execution
├── cli.rs - CLI argument parsing with clap
├── client.rs - Ollama web search API client
├── config.rs - Configuration management
├── error.rs - Custom error types with thiserror
├── formatter.rs - Output formatting (human & JSON)
└── ollama_local.rs - Local Ollama chat API client
Click to expand error handling details
The tool provides clear, actionable error messages:
- Missing API key → Instructions to set
OLLAMA_API_KEY - Network errors → Details about connection failures
- API errors → Status codes and error messages from Ollama
- Invalid responses → Clear parsing error descriptions
Click to expand security info
- API keys are never logged or printed
.envfiles are gitignored by default- Uses
rustls-tlsfor secure HTTPS connections - No hardcoded credentials or secrets
Contributions are welcome! Please feel free to submit a Pull Request.
Built with:
- clap - CLI argument parsing
- reqwest - HTTP client
- tokio - Async runtime
- serde - Serialization framework
Powered by Ollama's Web Search API.