Skip to content

TeichAI/searchbot

Repository files navigation

SearchBot

SearchBot is a TypeScript NPM package and CLI for running a small tool-calling search agent. It ships as @teichai/searchbot with:

  • a downloadable searchbot CLI
  • a ready-made OpenRouter + search tools preset
  • an importable base harness for custom agents
  • helpers for adding, replacing, and disabling tools

Built-in tools:

  • webSearch: DuckDuckGo HTML search with normalized JSON results.
  • pageSearch: page fetching and compact relevant text extraction.
  • pageFind: exact-term verification on fetched pages.

Install

npm install @teichai/searchbot

CLI quickstart

npx @teichai/searchbot init my-harness
OPENROUTER_API_KEY=sk-or-... npx @teichai/searchbot ask "What is OpenRouter?"
npx @teichai/searchbot web "latest TypeScript release" --max-results 5
npx @teichai/searchbot page "https://example.com" --query "domain examples"
npx @teichai/searchbot tools list

Library quickstart

import { createSearchBot } from '@teichai/searchbot';

const bot = createSearchBot({
  openRouterApiKey: process.env.OPENROUTER_API_KEY!,
  model: 'openai/gpt-oss-20b'
});

const result = await bot.ask('What is OpenRouter?');
console.log(result.finalAnswer);
console.log(result.trace.evidence);

Custom tools

import { createSearchBot, createTool } from '@teichai/searchbot';

const echoTool = createTool({
  name: 'echo',
  description: 'Echo text back to the model.',
  parameters: {
    type: 'object',
    properties: { text: { type: 'string' } },
    required: ['text']
  },
  async execute(input: { text: string }) {
    return { text: input.text };
  }
});

const bot = createSearchBot({
  openRouterApiKey: process.env.OPENROUTER_API_KEY!,
  tools: {
    includeDefaults: true,
    add: [echoTool],
    disable: ['pageFind']
  }
});

Docs

See docs/README.md for CLI, library, tool, provider, and package documentation.

OpenRouter attribution headers are sent with every built-in OpenRouter request:

  • HTTP-Referer: https://github.com/TeichAI/SearchBot
  • X-Title: SearchBot by Tei

About

searchbot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors