readme.md
AI agent stdlib that works with any AI SDK and LLM
Agentic
[!WARNING]
TODO: this project is not published yet and is an active WIP.
The goal of this project is to create a set of standard AI functions / tools which are optimized for both normal TS-usage as well as LLM-based apps that work with all of the major AI SDKs (LangChain, LlamaIndex, Vercel AI SDK, OpenAI SDK, etc).
For a simple example, stdlib clients like WeatherClient
can be used normally as a fully-typed TS client:
import { WeatherClient } from '@agentic/stdlib'
const weather = new WeatherClient() // (requires `WEATHER_API_KEY` env var)
const result = await clearbit.getCurrentWeather({
q: 'San Francisco'
})
console.log(result)
Or you can use this same function an LLM-based tool which works across all of the major AI SDKs via adaptors.
Here's an example using Vercel's AI SDK:
// sdk-specific imports
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'
import { createAISDKTools } from '@agentic/stdlib/ai-sdk'
// sdk-agnostic imports
import { WeatherClient } from '@agentic/stdlib'
const weather = new WeatherClient()
const result = await generateText({
model: openai('gpt-4o'),
// this is the key line which uses the ai-sdk adaptor
tools: createAISDKTools(weather),
toolChoice: 'required',
prompt: 'What is the weather in San Francisco?'
})
console.log(result.toolResults[0])
You can use all of our thoroughly tested stdlib AI functions with your favorite AI SDK – without having to write any glue code!
Here's a slightly more complex example which uses multiple clients and selects a subset of their functions using the AIFunctionSet.pick
method:
// sdk-specific imports
import { ChatModel, createAIRunner } from '@dexaai/dexter'
import { createDexterFunctions } from '@agentic/stdlib/dexter'
// sdk-agnostic imports
import { PerigonClient, SerperClient } from '@agentic/stdlib'
async function main() {
const perigon = new PerigonClient()
const serper = new SerperClient()
const runner = createAIRunner({
chatModel: new ChatModel({
params: { model: 'gpt-4o', temperature: 0 }
}),
functions: createDexterFunctions(
perigon.functions.pick('search_news_stories'),
serper
),
systemMessage: `You are a helpful assistant. Be as concise as possible.`
})
const result = await runner(
'Summarize the latest news stories about the upcoming US election.'
)
console.log(result)
}
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:
AIFunctionSet
- Sets of AI functions (likeperigon.functions.pick('search_news_stories')
orperigon.functions
orserper.functions
)AIFunctionsProvider
- Client classes which expose anAIFunctionSet
via the.functions
property (likeperigon
orserper
)AIFunction
- Individual functions (likeperigon.functions.get('search_news_stories')
orserper.functions.get('serper_google_search')
or AI functions created directly via thecreateAIFunction
utility function)
You can pass as many of these AIFunctionLike
objects as you'd like and you can manipulate them as AIFunctionSet
sets via .pick
, .omit
, .get
, .map
, etc.
All heavy third-party imports are isolated as optional peer dependencies to keep the main @agentic/stdlib
package as lightweight as possible.
Services
Service | Client | Description |
---|---|---|
Bing | BingClient |
Bing web search. |
Clearbit | ClearbitClient |
Resolving and enriching people and company datae. |
Dexa | DexaClient |
Answers questions from the world's best podcasters. |
Diffbot | DiffbotClient |
Web page classification and scraping; person and company data enrichment. |
Exa | ExaClient |
Web search tailored for LLMs. |
Firecrawl | FirecrawlClient |
Website scraping and sanitization. |
Midjourney | MidjourneyClient |
Unofficial Midjourney client for generative images. |
Novu | NovuClient |
Sending notifications (email, SMS, in-app, push, etc). |
People Data Labs | PeopleDataLabsClient |
People & company data (WIP). |
Perigon | PerigonClient |
Real-time news API and web content data from 140,000+ sources. Structured and enriched by AI, primed for LLMs. |
Polygon | PolygonClient |
Stock market and company financial data. |
PredictLeads | PredictLeadsClient |
In-depth company data including signals like fundraising events, hiring news, product launches, technologies used, etc. |
Proxycurl | ProxycurlClient |
People and company data from LinkedIn & Crunchbase. |
Scraper | ScraperClient |
Scrapes URLs into clean html/markdown/text content (TODO: currently closed beta). |
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. |
SerpAPI | SerpAPIClient |
Lightweight wrapper around SerpAPI for Google search. |
Serper | SerperClient |
Lightweight wrapper around Serper for Google search. |
TwitterClient |
Basic Twitter API methods for fetching users, tweets, and searching recent tweets. Includes support for plan-aware rate-limiting. | |
WeatherAPI | WeatherClient |
Basic access to current weather data based on location. |
Wikipedia | WikipediaClient |
Wikipedia page search and summaries. |
Wolfram Alpha | WolframAlphaClient |
Wolfram Alpha LLM API client for answering computational, mathematical, and scientific questions. |
Non-service Tools
- calculator
- e2b (code interpreter)
- search and scrape
AI SDKs
- OpenAI SDK
- no need for an adaptor; use
AIFunctionSet.specs
orAIFunctionSet.toolSpecs
- no need for an adaptor; use
- 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'
Client Goals
- clients should be as minimal as possible
- clients should use
ky
andzod
where possible - clients must have a strongly-typed TS DX
- clients should expose select methods via the
@aiFunction(...)
decorator - clients and AIFunctions should be composable via
AIFunctionSet
- clients must work with all major TS AI SDKs
- SDK adaptors should be as lightweight as possible and be optional peer dependencies of
@agentic/stdlib
- SDK adaptors should be as lightweight as possible and be optional peer dependencies of
TODO
- rename this repo to agentic
- sdks
- modelfusion
- services
- perplexity
- replicate
- huggingface
- skyvern
- unstructured
- pull from langchain
- provide a converter for langchain
DynamicStructuredTool
- provide a converter for langchain
- pull from nango
- pull from activepieces
- general openapi support ala workgpt
- tools / chains / flows / runnables
- market maps
- https://github.com/causaly/zod-validation-error
- investigate autotool
- investigate data connectors
License
MIT © Travis Fischer
To stay up to date or learn more, follow @transitive_bs on Twitter.