Convert Figma logo to code with AI

transitive-bullshit logoagentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.

17,424
2,217
17,424
12

Top Related Projects

Examples and guides for using the OpenAI API

106,456

🦜🔗 Build context-aware reasoning applications

Integrate cutting-edge LLM technology quickly and easily into your apps

20,093

A guidance language for controlling large language models.

173,689

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Quick Overview

Agentic is an open-source TypeScript library for building AI agents and workflows. It provides a flexible framework for creating, composing, and executing AI-powered tasks and agents, with a focus on modularity and extensibility.

Pros

  • Modular and extensible architecture for building complex AI workflows
  • Strong typing with TypeScript for improved developer experience
  • Supports various AI models and integrations (e.g., OpenAI, Anthropic)
  • Built-in support for memory, tools, and multi-agent systems

Cons

  • Relatively new project, may have limited community support
  • Documentation could be more comprehensive
  • Potential learning curve for developers new to AI agent frameworks
  • Limited examples and use cases provided in the repository

Code Examples

  1. Creating a simple agent:
import { Agent, OpenAILanguageModel } from 'agentic'

const agent = new Agent({
  name: 'My Agent',
  description: 'A simple agent',
  model: new OpenAILanguageModel()
})

const result = await agent.run('What is the capital of France?')
console.log(result)
  1. Using a tool with an agent:
import { Agent, OpenAILanguageModel, WebSearchTool } from 'agentic'

const agent = new Agent({
  name: 'Research Agent',
  description: 'An agent that can search the web',
  model: new OpenAILanguageModel(),
  tools: [new WebSearchTool()]
})

const result = await agent.run('Find the latest news about AI')
console.log(result)
  1. Creating a multi-agent system:
import { MultiAgentSystem, Agent, OpenAILanguageModel } from 'agentic'

const agent1 = new Agent({ name: 'Agent 1', model: new OpenAILanguageModel() })
const agent2 = new Agent({ name: 'Agent 2', model: new OpenAILanguageModel() })

const mas = new MultiAgentSystem({
  agents: [agent1, agent2],
  name: 'My Multi-Agent System'
})

const result = await mas.run('Solve this problem collaboratively')
console.log(result)

Getting Started

To get started with Agentic, follow these steps:

  1. Install the library:
npm install agentic
  1. Set up your OpenAI API key:
import { config } from 'agentic'

config.openaiApiKey = 'your-api-key-here'
  1. Create and run a simple agent:
import { Agent, OpenAILanguageModel } from 'agentic'

const agent = new Agent({
  name: 'My First Agent',
  model: new OpenAILanguageModel()
})

const result = await agent.run('Hello, world!')
console.log(result)

Competitor Comparisons

Examples and guides for using the OpenAI API

Pros of openai-cookbook

  • Comprehensive collection of examples and best practices for using OpenAI's APIs
  • Official repository maintained by OpenAI, ensuring up-to-date and accurate information
  • Covers a wide range of use cases and applications for AI technologies

Cons of openai-cookbook

  • Focused solely on OpenAI's products, limiting its applicability to other AI frameworks
  • Less emphasis on creating autonomous agents or complex AI systems
  • May not provide as much flexibility for customization and experimentation

Code Comparison

openai-cookbook:

import openai

response = openai.Completion.create(
  engine="text-davinci-002",
  prompt="Translate the following English text to French: '{}'",
  max_tokens=60
)

agentic:

from agentic import Agent, Task

agent = Agent()
task = Task("Translate the following English text to French: '{}'")
result = agent.complete(task)

The openai-cookbook example directly uses the OpenAI API, while agentic provides a higher-level abstraction for working with AI agents and tasks.

106,456

🦜🔗 Build context-aware reasoning applications

Pros of LangChain

  • More mature and widely adopted project with a larger community
  • Extensive documentation and examples for various use cases
  • Supports multiple programming languages (Python, JavaScript)

Cons of LangChain

  • Can be complex and overwhelming for beginners
  • Heavier dependency footprint
  • May require more setup and configuration for simple tasks

Code Comparison

LangChain:

from langchain import OpenAI, LLMChain, PromptTemplate

llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(input_variables=["product"], template="What is a good name for a company that makes {product}?")
chain = LLMChain(llm=llm, prompt=prompt)

print(chain.run("colorful socks"))

Agentic:

from agentic import Agent

agent = Agent()
response = agent.run("What is a good name for a company that makes colorful socks?")
print(response)

LangChain offers more flexibility and control over the prompt and model parameters, while Agentic provides a simpler, more straightforward interface for basic tasks. LangChain's approach allows for more complex chains and workflows, whereas Agentic focuses on ease of use for common AI interactions.

Integrate cutting-edge LLM technology quickly and easily into your apps

Pros of Semantic Kernel

  • More comprehensive and feature-rich, offering a wide range of AI integration capabilities
  • Better documentation and extensive examples for various use cases
  • Stronger community support and backing from Microsoft

Cons of Semantic Kernel

  • Steeper learning curve due to its complexity and extensive features
  • Heavier and potentially more resource-intensive compared to Agentic

Code Comparison

Semantic Kernel (C#):

var kernel = Kernel.Builder.Build();
var function = kernel.CreateSemanticFunction("Generate a story about {{$input}}");
var result = await function.InvokeAsync("a brave knight");
Console.WriteLine(result);

Agentic (JavaScript):

const agent = new Agent();
const result = await agent.run('Generate a story about a brave knight');
console.log(result);

Summary

Semantic Kernel offers a more robust and feature-rich solution for AI integration, backed by Microsoft's resources and community support. It provides extensive documentation and examples but may have a steeper learning curve. Agentic, on the other hand, presents a simpler and more lightweight approach, potentially easier to get started with but offering fewer features out of the box. The choice between the two depends on the project's requirements, scale, and the developer's familiarity with AI integration concepts.

20,093

A guidance language for controlling large language models.

Pros of guidance

  • More mature and actively maintained project with regular updates
  • Extensive documentation and examples for various use cases
  • Supports multiple language models and providers (OpenAI, Anthropic, HuggingFace)

Cons of guidance

  • Steeper learning curve due to its more complex syntax and concepts
  • Less focus on autonomous agent-like behavior compared to agentic

Code comparison

guidance:

with guidance.models.OpenAI('text-davinci-003') as model:
    prompt = guidance('''
    Human: Write a haiku about {{subject}}
    AI: Here's a haiku about {{subject}}:
    {{~#geneach 'line' num_iterations=3}}
    {{gen 'line' temperature=0.7 max_tokens=10}}
    {{~/geneach}}
    ''')
    result = prompt(subject='autumn leaves')

agentic:

from agentic import Agent, Task

agent = Agent()
task = Task("Write a haiku about autumn leaves")
result = agent.complete(task)

Summary

Guidance offers a more comprehensive and flexible framework for working with language models, while agentic provides a simpler, more intuitive approach focused on agent-like interactions. Guidance is better suited for complex, structured prompts across multiple providers, whereas agentic excels in straightforward, autonomous task completion scenarios.

173,689

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Pros of AutoGPT

  • More comprehensive and feature-rich, offering a wider range of functionalities
  • Larger community and more active development, resulting in frequent updates and improvements
  • Better documentation and examples, making it easier for users to get started

Cons of AutoGPT

  • More complex and potentially overwhelming for beginners
  • Heavier resource requirements due to its extensive features
  • May be overkill for simpler AI agent tasks

Code Comparison

AutoGPT:

def execute_command(command_name, arguments):
    command_name = command_name.lower()
    if command_name in COMMAND_CATEGORIES:
        return COMMAND_CATEGORIES[command_name].execute(arguments)
    return None

Agentic:

async def execute(self, task: str) -> str:
    response = await self.llm.complete(task)
    return response.text

The code snippets show that AutoGPT has a more structured approach to command execution, while Agentic has a simpler, more straightforward implementation. This reflects the overall difference in complexity and feature set between the two projects.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Agentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.

Build Status NPM MIT License Prettier Code Formatting

Agentic

Intro

Agentic is a standard library of AI functions / tools which are optimized for both normal TS-usage as well as LLM-based usage. Agentic works with all of the major TS AI SDKs (Vercel AI SDK, Mastra, LangChain, LlamaIndex, OpenAI SDK, MCP, etc).

Agentic clients like WeatherClient can be used as normal TS classes:

import { WeatherClient } from '@agentic/stdlib'

// Requires `process.env.WEATHER_API_KEY` (free from weatherapi.com)
const weather = new WeatherClient()

const result = await weather.getCurrentWeather({
  q: 'San Francisco'
})
console.log(result)

Or you can use these clients as LLM-based tools. 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/ai-sdk'

// sdk-agnostic imports
import { WeatherClient } from '@agentic/stdlib'

const weather = new WeatherClient()

const result = await generateText({
  model: openai('gpt-4o-mini'),
  // 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?'
})

console.log(result.toolResults[0])

You can use our standard library of thoroughly tested AI functions with your favorite AI SDK – without having to write any glue code!

Using Multiple Tools

All adapters (like createAISDKTools) accept a very flexible var args of AIFunctionLike parameters, so you can pass as many tools as you'd like.

They also expose a .functions property which is an AIFunctionSet. This combination makes it really easy to mix & match different tools together.

import { SerperClient, WikipediaClient, FirecrawlClient } from '@agentic/stdlib'
import { createAIFunction } from '@agentic/core'
import { z } from 'zod'

const googleSearch = new SerperClient()
const wikipedia = new WikipediaClient()
const firecrawl = new FirecrawlClient()

const result = await generateText({
  model: openai('gpt-4o-mini'),
  // This example uses tools from 4 different sources. You can pass as many
  // AIFunctionLike objects as you want.
  tools: createAISDKTools(
    googleSearch,
    wikipedia,
    // Pick a single function from the firecrawl client's set of AI functions
    firecrawl.functions.pick('firecrawl_search'),
    // Create a custom AI function (based off of Anthropic's think tool: https://www.anthropic.com/engineering/claude-think-tool)
    createAIFunction({
      name: 'think',
      description: `Use this tool to think about something. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed.`,
      inputSchema: z.object({
        thought: z.string().describe('A thought to think about.')
      }),
      execute: ({ thought }) => thought
    })
  ),
  prompt:
    'What year did Jurassic Park the movie come out, and what else happened that year?'
})

An AIFunctionLike can be any agentic client instance, a single AIFunction selected from the client's .functions property (which holds an AIFunctionSet of available AI functions), or an AI function created manually via createAIFunction.

AIFunctionLike and AIFunctionSet are implementation details that you likely won't have to touch directly, but they're important because of their flexibility.

Features

  • ✅ All tools are thoroughly tested in production
  • ✅ Tools work across all leading TS AI SDKs
  • ✅ Tools are hand-coded and extremely minimal
  • ✅ Tools have both a good manual DX and LLM DX via the @aiFunction decorator
  • ✅ Tools use native fetch
  • ✅ Tools use ky to wrap fetch, so HTTP options, throttling, retries, etc are easy to customize
  • ✅ Supports tools from any MCP server (createMcpTools(...))
  • ✅ Generate new Agentic tool clients from OpenAPI specs (@agentic/openapi-to-ts)
  • ✅ 100% open source && not trying to sell you anything 💯

Docs

Full docs are available at agentic.so.

AI SDKs

Vercel AI SDK

Agentic adapter docs for the Vercel AI SDK

Mastra

Agentic adapter docs for the Mastra AI Agent framework

LangChain

Agentic adapter docs for LangChain

LlamaIndex

Agentic adapter docs for LlamaIndex

Firebase Genkit

Agentic adapter docs for Genkit

Dexa Dexter

Agentic adapter docs for Dexter

OpenAI

Agentic adapter docs for OpenAI

GenAIScript

Agentic support in GenAIScript

xsAI SDK

Agentic adapter docs for the xsAI SDK

Tools

Service / ToolPackageDocsDescription
Airtable@agentic/airtabledocsNo-code spreadsheets, CRM, and database.
Apollo@agentic/apollodocsB2B person and company enrichment API.
ArXiv@agentic/arxivdocsSearch for research articles.
Bing@agentic/bingdocsBing web search.
Brave Search@agentic/brave-searchdocsBrave web search and local places search.
Calculator@agentic/calculatordocsBasic calculator for simple mathematical expressions.
Clearbit@agentic/clearbitdocsResolving and enriching people and company data.
Dexa@agentic/dexadocsAnswers questions from the world's best podcasters.
Diffbot@agentic/diffbotdocsWeb page classification and scraping; person and company data enrichment.
DuckDuckGo@agentic/duck-duck-godocsPrivacy-focused web search API.
E2B@agentic/e2bdocsHosted Python code interpreter sandbox which is really useful for data analysis, flexible code execution, and advanced reasoning on-the-fly.
Exa@agentic/exadocsWeb search tailored for LLMs.
Firecrawl@agentic/firecrawldocsWebsite scraping and structured data extraction.
Google Custom Search@agentic/google-custom-searchdocsOfficial Google Custom Search API.
Google Drive@agentic/google-drivedocsSimplified Google Drive API.
Google Docs@agentic/google-docsdocsSimplified Google Docs API.
Gravatar@agentic/gravatardocsGravatar profile API.
HackerNews@agentic/hacker-newsdocsOfficial HackerNews API.
Hunter@agentic/hunterdocsEmail finder, verifier, and enrichment.
Jina@agentic/jinadocsURL scraper and web search.
LeadMagic@agentic/leadmagicdocsB2B person, company, and email enrichment API.
Midjourney@agentic/midjourneydocsUnofficial Midjourney client for generative images.
McpTools@agentic/mcpdocsModel Context Protocol (MCP) client, supporting any MCP server. Use createMcpTools to spawn or connect to an MCP server.
Notion@agentic/notiondocsOfficial Notion API for accessing pages, databases, and content.
Novu@agentic/novudocsSending notifications (email, SMS, in-app, push, etc).
Open Meteo@agentic/open-meteodocsFree weather API (no API key required).
People Data Labs@agentic/people-data-labsdocsPeople & company data (WIP).
Perigon@agentic/perigondocsReal-time news API and web content data from 140,000+ sources. Structured and enriched by AI, primed for LLMs.
Polygon@agentic/polygondocsStock market and company financial data.
PredictLeads@agentic/predict-leadsdocsIn-depth company data including signals like fundraising events, hiring news, product launches, technologies used, etc.
Proxycurl@agentic/proxycurldocsPeople and company data from LinkedIn & Crunchbase.
Reddit@agentic/redditdocsBasic readonly Reddit API for getting top/hot/new/rising posts from subreddits.
RocketReach@agentic/rocketreachdocsB2B person and company enrichment API.
Searxng@agentic/searxngdocsOSS 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@agentic/serpapidocsLightweight wrapper around SerpAPI for Google search.
Serper@agentic/serperdocsLightweight wrapper around Serper for Google search.
Slack@agentic/slackdocsSend and receive Slack messages.
SocialData@agentic/social-datadocsUnofficial Twitter / X client (readonly) which is much cheaper than the official Twitter API.
Tavily@agentic/tavilydocsWeb search API tailored for LLMs.
Twilio@agentic/twiliodocsTwilio conversation API to send and receive SMS messages.
Twitter@agentic/twitterdocsBasic Twitter API methods for fetching users, tweets, and searching recent tweets. Includes support for plan-aware rate-limiting. Uses Nango for OAuth support.
Typeform@agentic/typeformdocsReadonly Typeform client for fetching form insights and responses.
Weather@agentic/weatherdocsBasic access to current weather data based on location.
Wikidata@agentic/wikidatadocsBasic Wikidata client.
Wikipedia@agentic/wikipediadocsWikipedia page search and summaries.
Wolfram Alpha@agentic/wolfram-alphadocsWolfram Alpha LLM API client for answering computational, mathematical, and scientific questions.
YouTube@agentic/youtubedocsYouTube data API v3 for searching YT videos and channels.
ZoomInfo@agentic/zoominfodocsPowerful B2B person and company data enrichment.

[!NOTE] Missing a tool or want to add your own tool to this list? If you have an OpenAPI v3 spec for your tool's API, we make it extremely easy to add support using our @agentic/openapi-to-ts CLI. Otherwise, feel free to open an issue to discuss or submit a PR.

For more details on tool usage, see the docs.

Contributors

License

MIT © Travis Fischer

To stay up to date or learn more, follow @transitive_bs on Twitter.

NPM DownloadsLast 30 Days