feat: add @agentic/stdlib convenience package

pull/657/head
Travis Fischer 2024-08-04 05:34:47 -05:00
rodzic a1ebc9ddbf
commit c26fc15783
21 zmienionych plików z 519 dodań i 130 usunięć

Wyświetl plik

@ -2,9 +2,7 @@
import 'dotenv/config'
import { createDexterFunctions } from '@agentic/dexter'
import { DiffbotClient } from '@agentic/diffbot'
import { SearchAndCrawl } from '@agentic/search-and-crawl'
import { SerpAPIClient } from '@agentic/serpapi'
import { DiffbotClient, SearchAndCrawl, SerpAPIClient } from '@agentic/stdlib'
import { ChatModel, createAIRunner } from '@dexaai/dexter'
async function main() {

Wyświetl plik

@ -10,12 +10,10 @@
"dependencies": {
"@agentic/core": "workspace:*",
"@agentic/dexter": "workspace:*",
"@agentic/diffbot": "workspace:*",
"@agentic/e2b": "workspace:*",
"@agentic/perigon": "workspace:*",
"@agentic/search-and-crawl": "workspace:*",
"@agentic/serpapi": "workspace:*",
"@agentic/serper": "workspace:*",
"@agentic/stdlib": "workspace:*",
"@agentic/weather": "workspace:*",
"@dexaai/dexter": "^2.1.0",
"zod": "^3.23.8"

Wyświetl plik

@ -2,7 +2,7 @@
import 'dotenv/config'
import { createGenkitTools } from '@agentic/genkit'
import { WeatherClient } from '@agentic/weather'
import { WeatherClient } from '@agentic/stdlib'
import { generate } from '@genkit-ai/ai'
import { configureGenkit } from '@genkit-ai/core'
import { gpt4o, openAI } from 'genkitx-openai'

Wyświetl plik

@ -8,10 +8,9 @@
"test:typecheck": "tsc --noEmit"
},
"dependencies": {
"@agentic/ai-sdk": "workspace:*",
"@agentic/core": "workspace:*",
"@agentic/genkit": "workspace:*",
"@agentic/weather": "workspace:*",
"@agentic/stdlib": "workspace:*",
"@genkit-ai/ai": "^0.5.9",
"@genkit-ai/core": "^0.5.9",
"genkitx-openai": "^0.10.0",

Wyświetl plik

@ -2,7 +2,7 @@
import 'dotenv/config'
import { createLangChainTools } from '@agentic/langchain'
import { WeatherClient } from '@agentic/weather'
import { WeatherClient } from '@agentic/stdlib'
import { ChatPromptTemplate } from '@langchain/core/prompts'
import { ChatOpenAI } from '@langchain/openai'
import { AgentExecutor, createToolCallingAgent } from 'langchain/agents'

Wyświetl plik

@ -10,7 +10,7 @@
"dependencies": {
"@agentic/core": "workspace:*",
"@agentic/langchain": "workspace:*",
"@agentic/weather": "workspace:*",
"@agentic/stdlib": "workspace:*",
"@langchain/core": "^0.2.20",
"@langchain/openai": "^0.2.5",
"langchain": "^0.2.12",

Wyświetl plik

@ -2,7 +2,7 @@
import 'dotenv/config'
import { createLlamaIndexTools } from '@agentic/llamaindex'
import { WeatherClient } from '@agentic/weather'
import { WeatherClient } from '@agentic/stdlib'
import { OpenAI, OpenAIAgent } from 'llamaindex'
async function main() {

Wyświetl plik

@ -10,7 +10,7 @@
"dependencies": {
"@agentic/core": "workspace:*",
"@agentic/llamaindex": "workspace:*",
"@agentic/weather": "workspace:*",
"@agentic/stdlib": "workspace:*",
"llamaindex": "^0.5.13",
"zod": "^3.23.8"
},

Wyświetl plik

@ -2,7 +2,7 @@
import 'dotenv/config'
import { assert } from '@agentic/core'
import { WeatherClient } from '@agentic/weather'
import { WeatherClient } from '@agentic/stdlib'
import OpenAI from 'openai'
async function main() {

Wyświetl plik

@ -9,7 +9,7 @@
},
"dependencies": {
"@agentic/core": "workspace:*",
"@agentic/weather": "workspace:*",
"@agentic/stdlib": "workspace:*",
"openai": "^4.49.0",
"zod": "^3.23.8"
},

Wyświetl plik

@ -1,7 +1,7 @@
#!/usr/bin/env node
import 'dotenv/config'
import { SerperClient } from '@agentic/serper'
import { SerperClient } from '@agentic/stdlib'
import restoreCursor from 'restore-cursor'
/**

Wyświetl plik

@ -9,7 +9,7 @@
},
"dependencies": {
"@agentic/core": "workspace:*",
"@agentic/serper": "workspace:*",
"@agentic/stdlib": "workspace:*",
"restore-cursor": "^5.1.0",
"zod": "^3.23.8"
},

Wyświetl plik

@ -1,7 +1,7 @@
{
"name": "@agentic/core",
"version": "6.6.1",
"description": "AI function stdlib that works with any LLM and TypeScript AI SDK.",
"description": "Core agentic AI utils which work with any LLM and TypeScript AI SDK.",
"author": "Travis Fischer <travis@transitivebullsh.it>",
"license": "MIT",
"repository": {

Wyświetl plik

@ -32,17 +32,16 @@
},
"dependencies": {
"ky": "^1.5.0",
"octokit": "^4.0.2",
"p-throttle": "^6.1.0"
},
"peerDependencies": {
"@agentic/core": "workspace:*",
"octokit": "^4.0.2",
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/core": "workspace:*",
"@agentic/tsconfig": "workspace:*",
"octokit": "^4.0.2"
"@agentic/tsconfig": "workspace:*"
},
"publishConfig": {
"access": "public"

Wyświetl plik

@ -0,0 +1,84 @@
{
"name": "@agentic/stdlib",
"version": "6.6.1",
"description": "Standard library of AI functions which work with any LLM and TypeScript AI SDK.",
"author": "Travis Fischer <travis@transitivebullsh.it>",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/transitive-bullshit/agentic.git"
},
"type": "module",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"files": [
"dist"
],
"scripts": {
"build": "tsup --config ../../tsup.config.ts",
"dev": "tsup --config ../../tsup.config.ts --watch",
"clean": "del dist",
"test": "run-s test:*",
"test:lint": "eslint .",
"test:typecheck": "tsc --noEmit"
},
"dependencies": {
"@agentic/ai-sdk": "workspace:*",
"@agentic/bing": "workspace:*",
"@agentic/calculator": "workspace:*",
"@agentic/clearbit": "workspace:*",
"@agentic/dexa": "workspace:*",
"@agentic/dexter": "workspace:*",
"@agentic/diffbot": "workspace:*",
"@agentic/e2b": "workspace:*",
"@agentic/exa": "workspace:*",
"@agentic/firecrawl": "workspace:*",
"@agentic/genkit": "workspace:*",
"@agentic/github": "workspace:*",
"@agentic/hacker-news": "workspace:*",
"@agentic/hunter": "workspace:*",
"@agentic/jina": "workspace:*",
"@agentic/langchain": "workspace:*",
"@agentic/llamaindex": "workspace:*",
"@agentic/midjourney": "workspace:*",
"@agentic/novu": "workspace:*",
"@agentic/people-data-labs": "workspace:*",
"@agentic/perigon": "workspace:*",
"@agentic/polygon": "workspace:*",
"@agentic/predict-leads": "workspace:*",
"@agentic/proxycurl": "workspace:*",
"@agentic/search-and-crawl": "workspace:*",
"@agentic/searxng": "workspace:*",
"@agentic/serpapi": "workspace:*",
"@agentic/serper": "workspace:*",
"@agentic/slack": "workspace:*",
"@agentic/social-data": "workspace:*",
"@agentic/tavily": "workspace:*",
"@agentic/twilio": "workspace:*",
"@agentic/twitter": "workspace:*",
"@agentic/weather": "workspace:*",
"@agentic/wikidata": "workspace:*",
"@agentic/wikipedia": "workspace:*",
"@agentic/wolfram-alpha": "workspace:*",
"@e2b/code-interpreter": "^0.0.8"
},
"peerDependencies": {
"@agentic/core": "workspace:*",
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/core": "workspace:*",
"@agentic/tsconfig": "workspace:*"
},
"publishConfig": {
"access": "public"
}
}

Wyświetl plik

@ -0,0 +1,32 @@
export * from '@agentic/bing'
export * from '@agentic/calculator'
export * from '@agentic/clearbit'
export * from '@agentic/dexa'
export * from '@agentic/diffbot'
export * from '@agentic/e2b'
export * from '@agentic/exa'
export * from '@agentic/firecrawl'
export * from '@agentic/github'
export * from '@agentic/hacker-news'
export * from '@agentic/hunter'
export * from '@agentic/jina'
export * from '@agentic/midjourney'
export * from '@agentic/novu'
export * from '@agentic/people-data-labs'
export * from '@agentic/perigon'
export * from '@agentic/polygon'
export * from '@agentic/predict-leads'
export * from '@agentic/proxycurl'
export * from '@agentic/search-and-crawl'
export * from '@agentic/searxng'
export * from '@agentic/serpapi'
export * from '@agentic/serper'
export * from '@agentic/slack'
export * from '@agentic/social-data'
export * from '@agentic/tavily'
export * from '@agentic/twilio'
export * from '@agentic/twitter'
export * from '@agentic/weather'
export * from '@agentic/wikidata'
export * from '@agentic/wikipedia'
export * from '@agentic/wolfram-alpha'

Wyświetl plik

@ -0,0 +1,5 @@
{
"extends": "@agentic/tsconfig/base.json",
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

Wyświetl plik

@ -31,21 +31,19 @@
"test:typecheck": "tsc --noEmit"
},
"dependencies": {
"@nangohq/node": "^0.42.2",
"ky": "^1.5.0",
"p-throttle": "^6.1.0",
"twitter-api-sdk": "^1.2.1",
"type-fest": "^4.21.0"
},
"peerDependencies": {
"@agentic/core": "workspace:*",
"zod": "^3.23.8",
"@nangohq/node": "^0.42.2",
"twitter-api-sdk": "^1.2.1"
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/core": "workspace:*",
"@agentic/tsconfig": "workspace:*",
"@nangohq/node": "^0.42.2",
"twitter-api-sdk": "^1.2.1"
"@agentic/tsconfig": "workspace:*"
},
"publishConfig": {
"access": "public"

Wyświetl plik

@ -32,17 +32,16 @@
},
"dependencies": {
"ky": "^1.5.0",
"p-throttle": "^6.1.0"
"p-throttle": "^6.1.0",
"wikibase-sdk": "^10.0.3"
},
"peerDependencies": {
"@agentic/core": "workspace:*",
"zod": "^3.23.8",
"wikibase-sdk": "^10.0.3"
"zod": "^3.23.8"
},
"devDependencies": {
"@agentic/core": "workspace:*",
"@agentic/tsconfig": "workspace:*",
"wikibase-sdk": "^10.0.3"
"@agentic/tsconfig": "workspace:*"
},
"publishConfig": {
"access": "public"

Wyświetl plik

@ -102,24 +102,18 @@ importers:
'@agentic/dexter':
specifier: workspace:*
version: link:../../packages/dexter
'@agentic/diffbot':
specifier: workspace:*
version: link:../../packages/diffbot
'@agentic/e2b':
specifier: workspace:*
version: link:../../packages/e2b
'@agentic/perigon':
specifier: workspace:*
version: link:../../packages/perigon
'@agentic/search-and-crawl':
specifier: workspace:*
version: link:../../packages/search-and-crawl
'@agentic/serpapi':
specifier: workspace:*
version: link:../../packages/serpapi
'@agentic/serper':
specifier: workspace:*
version: link:../../packages/serper
'@agentic/stdlib':
specifier: workspace:*
version: link:../../packages/stdlib
'@agentic/weather':
specifier: workspace:*
version: link:../../packages/weather
@ -136,18 +130,15 @@ importers:
examples/genkit:
dependencies:
'@agentic/ai-sdk':
specifier: workspace:*
version: link:../../packages/ai-sdk
'@agentic/core':
specifier: workspace:*
version: link:../../packages/core
'@agentic/genkit':
specifier: workspace:*
version: link:../../packages/genkit
'@agentic/weather':
'@agentic/stdlib':
specifier: workspace:*
version: link:../../packages/weather
version: link:../../packages/stdlib
'@genkit-ai/ai':
specifier: ^0.5.9
version: 0.5.9
@ -173,9 +164,9 @@ importers:
'@agentic/langchain':
specifier: workspace:*
version: link:../../packages/langchain
'@agentic/weather':
'@agentic/stdlib':
specifier: workspace:*
version: link:../../packages/weather
version: link:../../packages/stdlib
'@langchain/core':
specifier: ^0.2.20
version: 0.2.20(langchain@0.2.12(@aws-sdk/credential-provider-node@3.623.0)(@browserbasehq/sdk@1.4.2)(@notionhq/client@2.2.15)(@pinecone-database/pinecone@3.0.0)(assemblyai@4.6.1)(axios@1.7.3)(chromadb@1.8.1(openai@4.54.0))(fast-xml-parser@4.4.1)(ignore@5.3.1)(mammoth@1.8.0)(mongodb@6.8.0)(openai@4.54.0)(ws@8.18.0))(openai@4.54.0)
@ -201,9 +192,9 @@ importers:
'@agentic/llamaindex':
specifier: workspace:*
version: link:../../packages/llamaindex
'@agentic/weather':
'@agentic/stdlib':
specifier: workspace:*
version: link:../../packages/weather
version: link:../../packages/stdlib
llamaindex:
specifier: ^0.5.13
version: 0.5.13(@aws-sdk/client-sso-oidc@3.623.0(@aws-sdk/client-sts@3.623.0))(@aws-sdk/credential-providers@3.623.0(@aws-sdk/client-sso-oidc@3.623.0(@aws-sdk/client-sts@3.623.0)))(@notionhq/client@2.2.15(encoding@0.1.13))(bufferutil@4.0.8)(encoding@0.1.13)(socks@2.8.3)(typescript@5.5.4)(utf-8-validate@6.0.4)
@ -220,9 +211,9 @@ importers:
'@agentic/core':
specifier: workspace:*
version: link:../../packages/core
'@agentic/weather':
'@agentic/stdlib':
specifier: workspace:*
version: link:../../packages/weather
version: link:../../packages/stdlib
openai:
specifier: ^4.49.0
version: 4.54.0(encoding@0.1.13)
@ -239,9 +230,9 @@ importers:
'@agentic/core':
specifier: workspace:*
version: link:../../packages/core
'@agentic/serper':
'@agentic/stdlib':
specifier: workspace:*
version: link:../../packages/serper
version: link:../../packages/stdlib
restore-cursor:
specifier: ^5.1.0
version: 5.1.0
@ -492,6 +483,9 @@ importers:
ky:
specifier: ^1.5.0
version: 1.5.0
octokit:
specifier: ^4.0.2
version: 4.0.2
p-throttle:
specifier: ^6.1.0
version: 6.1.0
@ -505,9 +499,6 @@ importers:
'@agentic/tsconfig':
specifier: workspace:*
version: link:../tsconfig
octokit:
specifier: ^4.0.2
version: 4.0.2
packages/hacker-news:
dependencies:
@ -813,6 +804,133 @@ importers:
specifier: workspace:*
version: link:../tsconfig
packages/stdlib:
dependencies:
'@agentic/ai-sdk':
specifier: workspace:*
version: link:../ai-sdk
'@agentic/bing':
specifier: workspace:*
version: link:../bing
'@agentic/calculator':
specifier: workspace:*
version: link:../calculator
'@agentic/clearbit':
specifier: workspace:*
version: link:../clearbit
'@agentic/dexa':
specifier: workspace:*
version: link:../dexa
'@agentic/dexter':
specifier: workspace:*
version: link:../dexter
'@agentic/diffbot':
specifier: workspace:*
version: link:../diffbot
'@agentic/e2b':
specifier: workspace:*
version: link:../e2b
'@agentic/exa':
specifier: workspace:*
version: link:../exa
'@agentic/firecrawl':
specifier: workspace:*
version: link:../firecrawl
'@agentic/genkit':
specifier: workspace:*
version: link:../genkit
'@agentic/github':
specifier: workspace:*
version: link:../github
'@agentic/hacker-news':
specifier: workspace:*
version: link:../hacker-news
'@agentic/hunter':
specifier: workspace:*
version: link:../hunter
'@agentic/jina':
specifier: workspace:*
version: link:../jina
'@agentic/langchain':
specifier: workspace:*
version: link:../langchain
'@agentic/llamaindex':
specifier: workspace:*
version: link:../llamaindex
'@agentic/midjourney':
specifier: workspace:*
version: link:../midjourney
'@agentic/novu':
specifier: workspace:*
version: link:../novu
'@agentic/people-data-labs':
specifier: workspace:*
version: link:../people-data-labs
'@agentic/perigon':
specifier: workspace:*
version: link:../perigon
'@agentic/polygon':
specifier: workspace:*
version: link:../polygon
'@agentic/predict-leads':
specifier: workspace:*
version: link:../predict-leads
'@agentic/proxycurl':
specifier: workspace:*
version: link:../proxycurl
'@agentic/search-and-crawl':
specifier: workspace:*
version: link:../search-and-crawl
'@agentic/searxng':
specifier: workspace:*
version: link:../searxng
'@agentic/serpapi':
specifier: workspace:*
version: link:../serpapi
'@agentic/serper':
specifier: workspace:*
version: link:../serper
'@agentic/slack':
specifier: workspace:*
version: link:../slack
'@agentic/social-data':
specifier: workspace:*
version: link:../social-data
'@agentic/tavily':
specifier: workspace:*
version: link:../tavily
'@agentic/twilio':
specifier: workspace:*
version: link:../twilio
'@agentic/twitter':
specifier: workspace:*
version: link:../twitter
'@agentic/weather':
specifier: workspace:*
version: link:../weather
'@agentic/wikidata':
specifier: workspace:*
version: link:../wikidata
'@agentic/wikipedia':
specifier: workspace:*
version: link:../wikipedia
'@agentic/wolfram-alpha':
specifier: workspace:*
version: link:../wolfram-alpha
'@e2b/code-interpreter':
specifier: ^0.0.8
version: 0.0.8(bufferutil@4.0.8)(utf-8-validate@6.0.4)
zod:
specifier: ^3.23.8
version: 3.23.8
devDependencies:
'@agentic/core':
specifier: workspace:*
version: link:../core
'@agentic/tsconfig':
specifier: workspace:*
version: link:../tsconfig
packages/tavily:
dependencies:
ky:
@ -852,12 +970,18 @@ importers:
packages/twitter:
dependencies:
'@nangohq/node':
specifier: ^0.42.2
version: 0.42.2
ky:
specifier: ^1.5.0
version: 1.5.0
p-throttle:
specifier: ^6.1.0
version: 6.1.0
twitter-api-sdk:
specifier: ^1.2.1
version: 1.2.1(encoding@0.1.13)
type-fest:
specifier: ^4.21.0
version: 4.23.0
@ -871,12 +995,6 @@ importers:
'@agentic/tsconfig':
specifier: workspace:*
version: link:../tsconfig
'@nangohq/node':
specifier: ^0.42.2
version: 0.42.2
twitter-api-sdk:
specifier: ^1.2.1
version: 1.2.1(encoding@0.1.13)
packages/weather:
dependencies:
@ -902,6 +1020,9 @@ importers:
p-throttle:
specifier: ^6.1.0
version: 6.1.0
wikibase-sdk:
specifier: ^10.0.3
version: 10.0.3
zod:
specifier: ^3.23.8
version: 3.23.8
@ -912,9 +1033,6 @@ importers:
'@agentic/tsconfig':
specifier: workspace:*
version: link:../tsconfig
wikibase-sdk:
specifier: ^10.0.3
version: 10.0.3
packages/wikipedia:
dependencies:

287
readme.md
Wyświetl plik

@ -17,9 +17,15 @@
- [Intro](#intro)
- [Install](#install)
- [AI SDKs](#ai-sdks)
- [Vercel AI SDk](#vercel-ai-sdk)
- [LangChain](#langchain)
- [LlamaIndex](#llamaindex)
- [Firebase Genkit](#firebase-genkit)
- [Dexa Dexter](#dexa-dexter)
- [OpenAI SDK](#openai-sdk)
- [Optimized Imports](#optimized-imports)
- [Services](#services)
- [Compound Tools](#compound-tools)
- [AI SDKs](#ai-sdks)
- [Client Goals](#client-goals)
- [TODO](#todo)
- [Contributors](#contributors)
@ -44,13 +50,13 @@ console.log(result)
Or you can use these clients as **LLM-based tools** where the LLM decides when and how to invoke the underlying functions for you.
This works across all of the major AI SDKs via adaptors. Here's an example using [Vercel's AI SDK](https://github.com/vercel/ai):
This works across all of the major AI SDKs via adapters. Here's an example using [Vercel's AI SDK](https://github.com/vercel/ai):
```ts
// sdk-specific imports
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'
import { createAISDKTools } from '@agentic/stdlib/ai-sdk'
import { createAISDKTools } from '@agentic/ai-sdk'
// sdk-agnostic imports
import { WeatherClient } from '@agentic/stdlib'
@ -59,7 +65,7 @@ const weather = new WeatherClient()
const result = await generateText({
model: openai('gpt-4o'),
// this is the key line which uses the `@agentic/stdlib/ai-sdk` adaptor
// this is the key line which uses the `@agentic/ai-sdk` adapter
tools: createAISDKTools(weather),
toolChoice: 'required',
prompt: 'What is the weather in San Francisco?'
@ -75,7 +81,7 @@ Here's a slightly more complex example which uses multiple clients and selects a
```ts
// sdk-specific imports
import { ChatModel, createAIRunner } from '@dexaai/dexter'
import { createDexterFunctions } from '@agentic/stdlib/dexter'
import { createDexterFunctions } from '@agentic/dexter'
// sdk-agnostic imports
import { PerigonClient, SerperClient } from '@agentic/stdlib'
@ -105,7 +111,7 @@ async function main() {
Here we've exposed 2 functions to the LLM, `search_news_stories` (which comes from the `PerigonClient.searchStories` method) and `serper_google_search` (which implicitly comes from the `SerperClient.search` method).
All of the SDK adaptors like `createDexterFunctions` accept very flexible in what they accept. `AIFunctionLike` objects include:
All of the SDK adapters like `createDexterFunctions` accept very flexible in what they accept. `AIFunctionLike` objects include:
- `AIFunctionSet` - Sets of AI functions (like `perigon.functions.pick('search_news_stories')` or `perigon.functions` or `serper.functions`)
- `AIFunctionsProvider` - Client classes which expose an `AIFunctionSet` via the `.functions` property (like `perigon` or `serper`)
@ -116,7 +122,7 @@ You can pass as many of these `AIFunctionLike` objects as you'd like and you can
## Install
```sh
npm install @agentic/stdlib
npm install @agentic/stdlib @agentic/core zod
```
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) and requires `Node.js >= 18` or an equivalent environment (bun, deno, CF workers, etc).
@ -126,64 +132,218 @@ This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908
Depending on the AI SDK and tool you want to use, you'll also need to install the required peer dependencies.
### AI SDKs
Each AI SDK adapter is available from it's own package and needs to be installed in addition to the packages above.
<details>
<summary>
#### Vercel AI SDk
</summary>
```sh
npm install @agentic/ai-sdk
```
```ts
import { createAISDKTools } from '@agentic/ai-sdk'
```
</details>
<details>
<summary>
#### LangChain
</summary>
```sh
npm install @agentic/langchain
```
```ts
import { createLangChainTools } from '@agentic/langchain'
```
</details>
<details>
<summary>
#### LlamaIndex
</summary>
```sh
npm install @agentic/llamaindex
```
```ts
import { createLlamaIndexTools } from '@agentic/llamaindex'
```
</details>
<details>
<summary>
#### Firebase Genkit
</summary>
```sh
npm install @agentic/genkit
```
```ts
import { createGenkitTools } from '@agentic/genkit'
```
</details>
<details>
<summary>
#### Dexa Dexter
</summary>
```sh
npm install @agentic/dexter
```
```ts
import { createDexterFunctions } from '@agentic/dexter'
```
</details>
<details>
<summary>
#### OpenAI SDK
</summary>
```sh
npm install openai
```
There's no need for an adapter with the OpenAI SDK since all agentic tools are compatible with OpenAI by default. You can use `AIFunctionSet.specs` for function calling or `AIFunctionSet.toolSpecs` for parallel tool calling. For example:
```ts
import { WeatherClient } from '@agentic/stdlib'
import OpenAI from 'openai'
const weather = new WeatherClient()
const openai = new OpenAI()
const messages: OpenAI.ChatCompletionMessageParam[] = [
{
role: 'system',
content: 'You are a helpful assistant. Be as concise as possible.'
},
{ role: 'user', content: 'What is the weather in San Francisco?' }
]
{
// First call to OpenAI to invoke the weather tool
const res = await openai.chat.completions.create({
messages,
model: 'gpt-4o',
temperature: 0,
tools: weather.functions.toolSpecs,
tool_choice: 'required'
})
const message = res.choices[0]?.message!
console.log(JSON.stringify(message, null, 2))
assert(message.tool_calls?.[0]?.function?.name === 'get_current_weather')
const fn = weather.functions.get('get_current_weather')!
assert(fn)
const toolParams = message.tool_calls[0].function.arguments
const toolResult = await fn(toolParams)
messages.push(message)
messages.push({
role: 'tool',
tool_call_id: message.tool_calls[0].id,
content: JSON.stringify(toolResult)
})
}
{
// Second call to OpenAI to generate a text response
const res = await openai.chat.completions.create({
messages,
model: 'gpt-4o',
temperature: 0,
tools: weather.functions.toolSpecs
})
const message = res.choices?.[0]?.message
console.log(JSON.stringify(message, null, 2))
}
```
</details>
See the [examples](./examples) directory for examples of how to use each of these adapters.
### Optimized Imports
`@agentic/stdlib` is just a convenience wrapper which re-exports all of the built-in AI tool packages. If you want to optimize your imports, you can replace `@agentic/stdlib` with the specific AI tools you want. For example:
```sh
npm install @agentic/weather @agentic/core zod
```
```ts
import { WeatherClient } from '@agentic/weather'
```
Some of these individual tool packages have peer dependencies if they depend on large, external packages. If so, you'll need to install their peer deps as well.
Take `e2b`, for example, which requires `@e2b/code-interpreter` as a peer dep:
```sh
npm install @agentic/e2b @agentic/core zod @e2b/code-interpreter
```
```ts
import { e2b } from '@agentic/e2b'
```
> [!NOTE]
> There is no functional difference between using `@agentic/stdlib` versus using the individual packages directly. The only difference is if you want to optimize your install size (when running on serverless functions, for instance), in which case installing and using the individual packages directly will be more optimal. The default examples use `@agentic/stdlib` because it provides a simpler DX.
## Services
| Service | Client | Description |
| ------------------------------------------------------------------------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Bing](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) | `BingClient` | Bing web search. |
| [Calculator](https://github.com/josdejong/mathjs) | `calculator` | Basic calculator for simple mathematical expressions. |
| [Clearbit](https://dashboard.clearbit.com/docs) | `ClearbitClient` | Resolving and enriching people and company datae. |
| [Dexa](https://dexa.ai) | `DexaClient` | Answers questions from the world's best podcasters. |
| [Diffbot](https://docs.diffbot.com) | `DiffbotClient` | Web page classification and scraping; person and company data enrichment. |
| [E2B](https://e2b.dev) | `e2b` | Hosted Python code intrepreter sandbox which is really useful for data analysis, flexible code execution, and advanced reasoning on-the-fly. |
| [Exa](https://docs.exa.ai) | `ExaClient` | Web search tailored for LLMs. |
| [Firecrawl](https://www.firecrawl.dev) | `FirecrawlClient` | Website scraping and sanitization. |
| [HackerNews](https://github.com/HackerNews/API) | `HackerNewsClient` | Official HackerNews API. |
| [Hunter](https://hunter.io) | `HunterClient` | Email finder, verifier, and enrichment. |
| [Jina](https://jina.ai/reader) | `JinaClient` | Clean URL reader and web search + URL top result reading with a generous free tier. |
| [Midjourney](https://www.imagineapi.dev) | `MidjourneyClient` | Unofficial Midjourney client for generative images. |
| [Novu](https://novu.co) | `NovuClient` | Sending notifications (email, SMS, in-app, push, etc). |
| [People Data Labs](https://www.peopledatalabs.com) | `PeopleDataLabsClient` | People & company data (WIP). |
| [Perigon](https://www.goperigon.com/products/news-api) | `PerigonClient` | Real-time news API and web content data from 140,000+ sources. Structured and enriched by AI, primed for LLMs. |
| [Polygon](https://polygon.io) | `PolygonClient` | Stock market and company financial data. |
| [PredictLeads](https://predictleads.com) | `PredictLeadsClient` | In-depth company data including signals like fundraising events, hiring news, product launches, technologies used, etc. |
| [Proxycurl](https://nubela.co/proxycurl) | `ProxycurlClient` | People and company data from LinkedIn & Crunchbase. |
| Scraper | `ScraperClient` | Scrapes URLs into clean html/markdown/text content (TODO: currently closed beta). |
| [Searxng](https://docs.searxng.org) | `SearxngClient` | OSS meta search engine capable of searching across many providers like Reddit, Google, Brave, Arxiv, Genius, IMDB, Rotten Tomatoes, Wikidata, Wolfram Alpha, YouTube, GitHub, [etc](https://docs.searxng.org/user/configured_engines.html#configured-engines). |
| [SerpAPI](https://serpapi.com/search-api) | `SerpAPIClient` | Lightweight wrapper around SerpAPI for Google search. |
| [Serper](https://serper.dev) | `SerperClient` | Lightweight wrapper around Serper for Google search. |
| [Slack](https://api.slack.com/docs) | `SlackClient` | Send and receive Slack messages. |
| [SocialData](https://socialdata.tools) | `SocialDataClient` | Unofficial Twitter / X client (readonly) which is much cheaper than the official Twitter API. |
| [Tavily](https://tavily.com) | `TavilyClient` | Web search API tailored for LLMs. |
| [Twilio](https://www.twilio.com/docs/conversations/api) | `TwilioClient` | Twilio conversation API to send and receive SMS messages. |
| [Twitter](https://developer.x.com/en/docs/twitter-api) | `TwitterClient` | Basic Twitter API methods for fetching users, tweets, and searching recent tweets. Includes support for plan-aware rate-limiting. Uses [Nango](https://www.nango.dev) for OAuth support. |
| [WeatherAPI](https://www.weatherapi.com) | `WeatherClient` | Basic access to current weather data based on location. |
| [Wikidata](https://www.wikidata.org/wiki/Wikidata:Data_access) | `WikidataClient` | Basic Wikidata client. |
| [Wikipedia](https://www.mediawiki.org/wiki/API) | `WikipediaClient` | Wikipedia page search and summaries. |
| [Wolfram Alpha](https://products.wolframalpha.com/llm-api/documentation) | `WolframAlphaClient` | Wolfram Alpha LLM API client for answering computational, mathematical, and scientific questions. |
| Service | Package | Named export | Description |
| ------------------------------------------------------------------------ | --------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Bing](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) | `@agentic/bing` | `BingClient` | Bing web search. |
| [Calculator](https://github.com/josdejong/mathjs) | `@agentic/calculator` | `calculator` | Basic calculator for simple mathematical expressions. |
| [Clearbit](https://dashboard.clearbit.com/docs) | `@agentic/clearbit` | `ClearbitClient` | Resolving and enriching people and company datae. |
| [Dexa](https://dexa.ai) | `@agentic/dexa` | `DexaClient` | Answers questions from the world's best podcasters. |
| [Diffbot](https://docs.diffbot.com) | `@agentic/diffbot` | `DiffbotClient` | Web page classification and scraping; person and company data enrichment. |
| [E2B](https://e2b.dev) | `@agentic/e2b` | `e2b` | Hosted Python code intrepreter sandbox which is really useful for data analysis, flexible code execution, and advanced reasoning on-the-fly. (_peer dep_ `@e2b/code-interpreter`) |
| [Exa](https://docs.exa.ai) | `@agentic/exa` | `ExaClient` | Web search tailored for LLMs. |
| [Firecrawl](https://www.firecrawl.dev) | `@agentic/firecrawl` | `FirecrawlClient` | Website scraping and sanitization. |
| [HackerNews](https://github.com/HackerNews/API) | `@agentic/hacker-news` | `HackerNewsClient` | Official HackerNews API. |
| [Hunter](https://hunter.io) | `@agentic/hunter` | `HunterClient` | Email finder, verifier, and enrichment. |
| [Jina](https://jina.ai/reader) | `@agentic/jina` | `JinaClient` | Clean URL reader and web search + URL top result reading with a generous free tier. |
| [Midjourney](https://www.imagineapi.dev) | `@agentic/midjourney` | `MidjourneyClient` | Unofficial Midjourney client for generative images. |
| [Novu](https://novu.co) | `@agentic/novu` | `NovuClient` | Sending notifications (email, SMS, in-app, push, etc). |
| [People Data Labs](https://www.peopledatalabs.com) | `@agentic/people-data-labs` | `PeopleDataLabsClient` | People & company data (WIP). |
| [Perigon](https://www.goperigon.com/products/news-api) | `@agentic/perigon` | `PerigonClient` | Real-time news API and web content data from 140,000+ sources. Structured and enriched by AI, primed for LLMs. |
| [Polygon](https://polygon.io) | `@agentic/polygon` | `PolygonClient` | Stock market and company financial data. |
| [PredictLeads](https://predictleads.com) | `@agentic/predict-leads` | `PredictLeadsClient` | In-depth company data including signals like fundraising events, hiring news, product launches, technologies used, etc. |
| [Proxycurl](https://nubela.co/proxycurl) | `@agentic/proxycurl` | `ProxycurlClient` | People and company data from LinkedIn & Crunchbase. |
| [Searxng](https://docs.searxng.org) | `@agentic/searxng` | `SearxngClient` | OSS meta search engine capable of searching across many providers like Reddit, Google, Brave, Arxiv, Genius, IMDB, Rotten Tomatoes, Wikidata, Wolfram Alpha, YouTube, GitHub, [etc](https://docs.searxng.org/user/configured_engines.html#configured-engines). |
| [SerpAPI](https://serpapi.com/search-api) | `@agentic/serpapi` | `SerpAPIClient` | Lightweight wrapper around SerpAPI for Google search. |
| [Serper](https://serper.dev) | `@agentic/serper` | `SerperClient` | Lightweight wrapper around Serper for Google search. |
| [Slack](https://api.slack.com/docs) | `@agentic/slack` | `SlackClient` | Send and receive Slack messages. |
| [SocialData](https://socialdata.tools) | `@agentic/social-data` | `SocialDataClient` | Unofficial Twitter / X client (readonly) which is much cheaper than the official Twitter API. |
| [Tavily](https://tavily.com) | `@agentic/tavily` | `TavilyClient` | Web search API tailored for LLMs. |
| [Twilio](https://www.twilio.com/docs/conversations/api) | `@agentic/twilio` | `TwilioClient` | Twilio conversation API to send and receive SMS messages. |
| [Twitter](https://developer.x.com/en/docs/twitter-api) | `@agentic/twitter` | `TwitterClient` | Basic Twitter API methods for fetching users, tweets, and searching recent tweets. Includes support for plan-aware rate-limiting. Uses [Nango](https://www.nango.dev) for OAuth support. |
| [Weather](https://www.weatherapi.com) | `@agentic/weather` | `WeatherClient` | Basic access to current weather data based on location. |
| [Wikidata](https://www.wikidata.org/wiki/Wikidata:Data_access) | `@agentic/wikidata` | `WikidataClient` | Basic Wikidata client. |
| [Wikipedia](https://www.mediawiki.org/wiki/API) | `@agentic/wikipedia` | `WikipediaClient` | Wikipedia page search and summaries. |
| [Wolfram Alpha](https://products.wolframalpha.com/llm-api/documentation) | `@agentic/wolfram-alpha` | `WolframAlphaClient` | Wolfram Alpha LLM API client for answering computational, mathematical, and scientific questions. |
Note that many of these clients expose multiple AI functions.
## Compound Tools
- `SearchAndCrawl`
## AI SDKs
- OpenAI SDK
- no need for an adaptor; use `AIFunctionSet.specs` or `AIFunctionSet.toolSpecs`
- Vercel AI SDK
- `import { createAISDKTools } from '@agentic/stdlib/ai-sdk'`
- LangChain
- `import { createLangChainTools } from '@agentic/stdlib/langchain'`
- LlamaIndex
- `import { createLlamaIndexTools } from '@agentic/stdlib/llamaindex'`
- Firebase Genkit
- `import { createGenkitTools } from '@agentic/stdlib/genkit'`
- Dexa Dexter
- `import { createDexterFunctions } from '@agentic/stdlib/dexter'`
See the [examples](./examples) directory for examples of how to use each of these adaptors.
Note that you can import any of these AI tools from `@agentic/stdlib` OR from their individual packages. Installing and importing from their individual packages is more efficient, but it's less convenient so it isn't the default.
## Client Goals
@ -194,7 +354,6 @@ See the [examples](./examples) directory for examples of how to use each of thes
- `inputSchema` zod schemas should be as minimal as possible with descriptions prompt engineered specifically for use with LLMs
- clients and AIFunctions should be composable via `AIFunctionSet`
- clients should work with all major TS AI SDKs
- SDK adaptors should be as lightweight as possible and be optional peer dependencies of `@agentic/stdlib`
## TODO