Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat(agent-tools): add Keenable web search and fetch tools for AI agents (#738)

Ilya Bogin9e1e70433500
diff --git a/README.md b/README.md
index 82e726f6..e7168757 100644
--- a/README.md
+++ b/README.md
@@ -87,7 +87,7 @@ release.
- A run starts on an @mention in a comment on an issue or a document, on an assignment, or
on a schedule
- Tools for the services outside the tracker: Notion, Telegram, Threads, Instagram, Jina,
- Firecrawl, Gitea, and GitHub
+ Firecrawl, Keenable, Gitea, and GitHub
- Built-in chat with each agent, with its own conversation history
- Chat with an external agent too. The runner answers from your machine, streams the reply
and its tool calls, and resumes the same coding agent session on each message
diff --git a/packages/agent-tools/src/registry.ts b/packages/agent-tools/src/registry.ts
index 0e080bbf..f0d4bb9a 100644
--- a/packages/agent-tools/src/registry.ts
+++ b/packages/agent-tools/src/registry.ts
@@ -15,6 +15,7 @@ import { notion } from './tools/notion';
import { gitea } from './tools/gitea';
import { github } from './tools/github';
import { pdf } from './tools/pdf';
+import { keenable } from './tools/keenable';
// The core's tool integrations. Add an integration by creating its folder under tools/
// and listing it here.
@@ -28,6 +29,7 @@ export const INTEGRATIONS: Integration[] = [
gitea,
github,
pdf,
+ keenable,
];
type ToolIndex = Map<string, { integration: Integration; tool: CustomToolEntry }>;
diff --git a/packages/agent-tools/src/tools/keenable/__tests__/keenable.test.ts b/packages/agent-tools/src/tools/keenable/__tests__/keenable.test.ts
new file mode 100644
index 00000000..3c8a10c8
--- /dev/null
+++ b/packages/agent-tools/src/tools/keenable/__tests__/keenable.test.ts
@@ -0,0 +1,97 @@
+import { afterAll, afterEach, describe, expect, it, spyOn } from 'bun:test';
+import { getTool } from '../../../registry';
+import { keenableSearch } from '../search';
+import { keenableFetch } from '../fetch';
+
+const fetchSpy = spyOn(globalThis, 'fetch');
+
+// Each test makes one call per response, so one Response object is enough.
+function respond(status: number, body: unknown) {
+ fetchSpy.mockResolvedValue(Response.json(body, { status }));
+}
+
+function lastCall() {
+ const [url, init] = fetchSpy.mock.calls.at(-1)!;
+ return { url: String(url), init: init as RequestInit & { headers: Record<string, string> } };
+}
+
+describe('keenable', () => {
+ afterEach(() => fetchSpy.mockClear());
+ afterAll(() => fetchSpy.mockRestore());
+
+ it('is registered with no credential to configure', () => {
+ expect(getTool('keenable_search')?.integration.credentialSchema).toEqual([]);
+ expect(getTool('keenable_fetch')?.integration.key).toBe('keenable');
+ });
+
+ it('searches the public endpoint with the app header and maps the snippet', async () => {
+ respond(200, {
+ results: [
+ {
+ title: 'Rate limiting',
+ url: 'https://example.com/rate-limits',
+ description: '',
+ snippet: 'x'.repeat(5000),
+ },
+ ],
+ });
+ const result = (await keenableSearch.execute(
+ {},
+ { query: 'api rate limits', count: 3, site: 'example.com' },
+ )) as { results: { title: string; url: string; snippet: string }[] };
+
+ const { url, init } = lastCall();
+ expect(url).toBe('https://api.keenable.ai/v1/search/public');
+ expect(init.method).toBe('POST');
+ expect(init.headers).toMatchObject({ 'X-Keenable-Title': 'itsaplan' });
+ expect(JSON.parse(String(init.body))).toEqual({
+ query: 'api rate limits',
+ max_results: 3,
+ site: 'example.com',
+ });
+ expect(result.results).toEqual([
+ { title: 'Rate limiting', url: 'https://example.com/rate-limits', snippet: 'x'.repeat(4000) },
+ ]);
+ });
+
+ it('asks for five results and no site by default', async () => {
+ respond(200, { results: [] });
+ const result = await keenableSearch.execute({}, { query: 'itsaplan' });
+ expect(JSON.parse(String(lastCall().init.body))).toEqual({ query: 'itsaplan', max_results: 5 });
+ expect(result).toEqual({ results: [] });
+ });
+
+ it('fetches a page as markdown through the public endpoint', async () => {
+ respond(200, {
+ url: 'https://example.com/a?b=1',
+ title: 'Example',
+ content: '# Example',
+ description: '',
+ });
+ const result = await keenableFetch.execute({}, { url: 'https://example.com/a?b=1' });
+
+ const { url, init } = lastCall();
+ expect(url).toBe(
+ 'https://api.keenable.ai/v1/fetch/public?url=https%3A%2F%2Fexample.com%2Fa%3Fb%3D1',
+ );
+ expect(init.method).toBe('GET');
+ expect(init.body).toBeUndefined();
+ expect(init.headers).toMatchObject({ 'X-Keenable-Title': 'itsaplan' });
+ expect(result).toEqual({
+ title: 'Example',
+ url: 'https://example.com/a?b=1',
+ content: '# Example',
+ });
+ });
+
+ it('surfaces the status and body of a failed call', async () => {
+ respond(429, { detail: 'Rate limit exceeded' });
+ await expect(keenableSearch.execute({}, { query: 'x' })).rejects.toThrow(
+ 'Keenable search failed (429): {"detail":"Rate limit exceeded"}',
+ );
+ respond(502, { detail: 'upstream error' });
+ await expect(keenableFetch.execute({}, { url: 'https://example.com' })).rejects.toThrow(
+ 'Keenable fetch failed (502)',
+ );
+ });
+});
diff --git a/packages/agent-tools/src/tools/keenable/client.ts b/packages/agent-tools/src/tools/keenable/client.ts
new file mode 100644
index 00000000..79ed4ce7
--- /dev/null
+++ b/packages/agent-tools/src/tools/keenable/client.ts
@@ -0,0 +1,21 @@
+import { jsonOrThrow } from '../../http';
+
+const KEENABLE_BASE = 'https://api.keenable.ai/v1';
+
+export async function keenableRequest(
+ path: string,
+ body: Record<string, unknown> | null,
+ what: string,
+): Promise<unknown> {
+ const res = await fetch(`${KEENABLE_BASE}/${path}`, {
+ method: body ? 'POST' : 'GET',
+ headers: {
+ Accept: 'application/json',
+ // The public endpoints answer 400 to a call that does not name its app.
+ 'X-Keenable-Title': 'itsaplan',
+ ...(body ? { 'Content-Type': 'application/json' } : {}),
+ },
+ ...(body ? { body: JSON.stringify(body) } : {}),
+ });
+ return jsonOrThrow(res, what);
+}
diff --git a/packages/agent-tools/src/tools/keenable/fetch.ts b/packages/agent-tools/src/tools/keenable/fetch.ts
new file mode 100644
index 00000000..42e8d95e
--- /dev/null
+++ b/packages/agent-tools/src/tools/keenable/fetch.ts
@@ -0,0 +1,23 @@
+import { z } from 'zod';
+import type { CustomToolEntry } from '../../types';
+import { keenableRequest } from './client';
+
+export const keenableFetch: CustomToolEntry = {
+ key: 'keenable_fetch',
+ label: 'Keenable Fetch',
+ description:
+ 'Fetch a web page (via the Keenable API) and return its content as markdown. Use to read an article, documentation, or any single URL, such as a search result.',
+ inputSchema: z.object({ url: z.string().url().describe('The URL of the page to fetch.') }),
+ execute: async (_credential, input) => {
+ const body = (await keenableRequest(
+ `fetch/public?${new URLSearchParams({ url: String(input.url) })}`,
+ null,
+ 'Keenable fetch',
+ )) as { url?: string; title?: string; content?: string };
+ return {
+ title: body.title ?? '',
+ url: body.url ?? String(input.url),
+ content: body.content ?? '',
+ };
+ },
+};
diff --git a/packages/agent-tools/src/tools/keenable/index.ts b/packages/agent-tools/src/tools/keenable/index.ts
new file mode 100644
index 00000000..261489ef
--- /dev/null
+++ b/packages/agent-tools/src/tools/keenable/index.ts
@@ -0,0 +1,12 @@
+import type { Integration } from '../../types';
+import { keenableSearch } from './search';
+import { keenableFetch } from './fetch';
+
+// Keenable's public endpoints need no account or API key, so there is no credential to
+// configure.
+export const keenable: Integration = {
+ key: 'keenable',
+ label: 'Keenable',
+ credentialSchema: [],
+ tools: [keenableSearch, keenableFetch],
+};
diff --git a/packages/agent-tools/src/tools/keenable/search.ts b/packages/agent-tools/src/tools/keenable/search.ts
new file mode 100644
index 00000000..2b7e3bfa
--- /dev/null
+++ b/packages/agent-tools/src/tools/keenable/search.ts
@@ -0,0 +1,46 @@
+import { z } from 'zod';
+import type { CustomToolEntry } from '../../types';
+import { keenableRequest } from './client';
+
+// Per-result text is capped so a multi-result search does not flood the model's
+// context with full page dumps.
+const MAX_SNIPPET = 4000;
+
+export const keenableSearch: CustomToolEntry = {
+ key: 'keenable_search',
+ label: 'Keenable Search',
+ description:
+ 'Search the web (via the Keenable API) and return the top results with title, URL, and the matching text of each page. Use to find current information across the web.',
+ inputSchema: z.object({
+ query: z.string().min(1).describe('The search query.'),
+ count: z
+ .number()
+ .int()
+ .min(1)
+ .max(20)
+ .optional()
+ .describe('How many results to return (default 5).'),
+ site: z
+ .string()
+ .min(1)
+ .optional()
+ .describe('Limit the results to one domain, e.g. docs.example.com.'),
+ }),
+ execute: async (_credential, input) => {
+ const body = (await keenableRequest(
+ 'search/public',
+ {
+ query: String(input.query),
+ max_results: Number(input.count ?? 5),
+ ...(input.site ? { site: String(input.site) } : {}),
+ },
+ 'Keenable search',
+ )) as { results?: { title?: string; url?: string; snippet?: string }[] };
+ const results = (body.results ?? []).map((r) => ({
+ title: r.title ?? '',
+ url: r.url ?? '',
+ snippet: (r.snippet ?? '').slice(0, MAX_SNIPPET),
+ }));
+ return { results };
+ },
+};