Skip to content

feat: add Exa AI-powered search tool#3

Open
tgonzalezc5 wants to merge 1 commit intocodeany-ai:mainfrom
tgonzalezc5:feat/exa-search
Open

feat: add Exa AI-powered search tool#3
tgonzalezc5 wants to merge 1 commit intocodeany-ai:mainfrom
tgonzalezc5:feat/exa-search

Conversation

@tgonzalezc5
Copy link
Copy Markdown

Summary

  • Adds an ExaSearch built-in tool that queries Exa, an AI-powered search engine that understands natural-language queries and returns high-quality web results.
  • Exposes Exa's key features: search types (auto, neural, fast, deep-lite, deep, deep-reasoning, instant), content modes (highlights, full text, summary), category filtering, include/exclude domain filters, published-date ranges, and user location.
  • Uses EXA_API_KEY for authentication (loaded lazily on each call) and sets x-exa-integration: open-agent-sdk-go so Exa can attribute traffic to this SDK.
  • Registered in tools.DefaultRegistry() alongside the existing WebSearch placeholder; fits the same types.Tool interface as every other built-in tool.
  • Pure net/http implementation, no new Go module dependencies.

Usage

package main

import (
    "context"
    "fmt"

    "github.com/codeany-ai/open-agent-sdk-go/tools"
    "github.com/codeany-ai/open-agent-sdk-go/types"
)

func main() {
    tool := tools.NewExaSearchTool()
    res, _ := tool.Call(context.Background(), map[string]interface{}{
        "query":              "latest research on retrieval-augmented generation",
        "num_results":        float64(5),
        "category":           "research paper",
        "include_highlights": true,
        "include_summary":    true,
    }, &types.ToolUseContext{})
    fmt.Println(res.Content[0].Text)
}

Set EXA_API_KEY before running. Get a key at https://exa.ai/.

Files Changed

  • tools/exasearch.go — new ExaSearchTool implementing the types.Tool interface.
  • tools/exasearch_test.go — unit tests covering request shape, response parsing, snippet fallback logic, API error handling, missing-key state, and registry registration.
  • tools/registry.go — register NewExaSearchTool() in GetAllBaseTools().
  • README.md — document EXA_API_KEY and add ExaSearch to the built-in tool list.

Test Plan

  • go build ./... passes
  • go vet ./... passes
  • go test ./... passes (full suite green, including pre-existing tests)
  • go test ./tools/ -run Exa -v passes (6 new tests, all subtests green)
  • gofmt -l clean on all new/modified files
  • Registered tool is discoverable via DefaultRegistry().Get("ExaSearch")
  • End-to-end smoke test against the real Exa API (manual, requires a valid EXA_API_KEY)

Adds an ExaSearch tool that queries Exa (https://exa.ai) and returns
high-quality web results with optional highlights, summaries, and full text.
Supports category filtering, domain filtering (include/exclude), published-date
ranges, user location, and all current Exa search types. Registered in the
default tool registry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant