Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for langchaingo: the
tools.Toolinterface makes it easy to drop a new search backend into an agent with a few lines.Summary
Adds
tools/outcrawl, two tools for the agent executor next toserpapi,duckduckgoandmetaphor: a web search tool and a scrape tool. Outcrawl is web infrastructure for AI agents. Its search API (POST https://api.outcrawl.ai/v1/search) returns ranked hits with title, URL and snippet, and its scrape API (POST https://api.outcrawl.ai/v1/scrape) returns the main content of a page as markdown, including pages that render with JavaScript. The free plan includes 1,000 credits a month. Nothing changes for existing users.Changes
tools/outcrawl/outcrawl.go:SearchTool(NewSearch, nameOutcrawlSearch) andScrapeTool(NewScrape, nameOutcrawlScrape), both implementingtools.Toolwith the sameCallbacksHandlerhandling as the serpapi tool. The API key comes fromOUTCRAWL_API_KEYorWithAPIKey; without oneNew*returnsErrMissingToken. Requests usehttputil.DefaultClientunlessWithHTTPClientis set. Search formats hits as a numbered list (title, URL, snippet); scrape sends{url, formats: ["markdown"], onlyMainContent}and returns the markdown. API errors surface the status, code and message; empty scrape content returnsErrNoResult.tools/outcrawl/options.go:WithAPIKey,WithHTTPClient,WithBaseURL,WithLimit(search hits),WithOnlyMainContent(scrape, default true).tools/outcrawl/doc.go: package docs with an agent example.tools/outcrawl/outcrawl_test.go: tests against anhttptestserver (request path, auth header and payload, result formatting, optional limit, API error, empty markdown, non-JSON error, missing key, key from env). No live key and no recordings needed.docs/parity_matrix.md: one row under Tools.Testing
go test -count=1 -v ./tools/outcrawl: 9 tests passed.go test -count=1 ./tools/...: all packages pass.go vet ./tools/outcrawlandgolangci-lint run ./tools/outcrawl/...: 0 issues.NewSearch(WithLimit(2)).Call(ctx, "langchaingo agents tools")returned two formatted hits, andNewScrape().Call(ctx, "https://example.com")returned 1,342 characters of markdown.Disclosure: I work on Outcrawl.
This PR was prepared with AI assistance (omp with Claude): the code, tests, docs line and this description were written with it, and the tests, lint and the live call above were run as part of preparing it.
PR Checklist
tools/serpapi.golangci-lintchecks.