Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BaseAI — The Web AI Framework. The easiest way to build serverless autonomous AI agents with memory. Start building local-first, agentic pipes, tools, and memory. Deploy serverless with one command.

License

NotificationsYou must be signed in to change notification settings

LangbaseInc/BaseAI

BaseAI is now archived in the favor ofLangbase AI Primitives. The more we built BaseAI the more we realized frameworks are a bad idea in AI engineering. This space is moving fast and frameworks become blockers. Instead you should be using AI primitives, likememory, pipes, agents that work with any language as APIs and with TypeScript and Python SDKs. You can use any coding agent, likeCommandCode to make your own AI framework with these AI primitives. BaseAI is a great example how.

BaseAI

license

Getting Started

BaseAI is the AI framework for building serverless and composable AI agents with memory and tools. It allows you to develop AI agent pipes on your local machine with integrated agentic tools and memory (RAG). Visit ourBaseAI.dev/learn guide to start with BaseAI.

Documentation (recommended)

Please checkBaseAI.dev/docs andBaseAI.dev/learn to get started with full documentation.

1. Initialize a new BaseAI project

BaseAI is a TypeScript-first framework. To create a new BaseAI project, run the following command in your project:

npx baseai@latest init

This command will create abaseai directory in your project. This is what the directory structure looks like:

ROOT (of your app)├── baseai|  ├── baseai.config.ts|  ├── memory|  ├── pipes|  └── tools├── .env (your env file)└── package.json

2. Add API keys

Copy the following in your.env file and add appropriate LLM API keys:

# !! SERVER SIDE ONLY !!# Keep all your API keys secret — use only on the server side.# TODO: ADD: Both in your production and local env files.# Langbase API key for your User or Org account.# How to get this API key https://langbase.com/docs/api-reference/api-keysLANGBASE_API_KEY=# TODO: ADD: LOCAL ONLY. Add only to local env files.# Following keys are needed for local pipe runs. For providers you are using.# For Langbase, please add the key to your LLM keysets.# Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysetsOPENAI_API_KEY=ANTHROPIC_API_KEY=COHERE_API_KEY=FIREWORKS_API_KEY=GOOGLE_API_KEY=GROQ_API_KEY=MISTRAL_API_KEY=PERPLEXITY_API_KEY=TOGETHER_API_KEY=XAI_API_KEY=

3. Create a new AI agent

Pipe is your custom-built AI agent as an API. It's the fastest way to ship AI features/apps. Let's create a new pipe:

npx baseai@latest pipe

It will ask you for the name, description, and other details of the pipe step-by-step. Once done, a pipe will be created inside the/baseai/pipes directory. You can now edit the system prompt, change model params, and more. Here is what a pipe code looks like:

import{PipeI}from'@baseai/core';constpipeSummary=():PipeI=>({// Replace with your API key https://langbase.com/docs/api-reference/api-keysapiKey:process.env.LANGBASE_API_KEY!,name:'summary',description:'AI Summary agent',status:'public',model:'openai:gpt-4o-mini',stream:true,json:false,store:true,moderate:true,top_p:1,max_tokens:1000,temperature:0.7,presence_penalty:1,frequency_penalty:1,stop:[],tool_choice:'auto',parallel_tool_calls:true,messages:[{role:'system',content:`You are a helpful AI agent. Make everything Less wordy.`}],variables:[],memory:[],tools:[]});exportdefaultpipeSummary;

4. Integrate pipe in your app

Let's create a newindex.ts file in your project root. Now we need to do the following:

  1. Import the pipe config we created.
  2. Create a new pipe instance with the pipe config.
  3. Run the pipe with a user message.
  4. Listen to the stream events.

Here is what the code looks like:

import{Pipe,getRunner}from'@baseai/core';importpipeSummarizerfrom'./baseai/pipes/summary';constpipe=newPipe(pipeSummarizer());constuserMsg=`Langbase studio is your playground to build, collaborate, and deploy AI. It allows you to experiment with your pipes in real-time, with real data, store messages, version your prompts, and truly helps you take your idea from building prototypes to deployed in production with LLMOps on usage, cost, and quality.A complete AI developers platform.- Collaborate: Invite all team members to collaborate on the pipe. Build AI together.- Developers & Stakeholders: All your R&D team, engineering, product, GTM (marketing and sales), literally invlove every stakeholder can collaborate on the same pipe. It's like a powerful version of GitHub x Google Docs for AI. A complete AI developers platform.`;asyncfunctionmain(){const{ stream}=awaitpipe.run({messages:[{role:'user',content:userMsg}],stream:true,});construnner=getRunner(stream);// Method 1: Using event listenersrunner.on('connect',()=>{console.log('Stream started.\n');});runner.on('content',content=>{process.stdout.write(content);});runner.on('end',()=>{console.log('\nStream ended.');});runner.on('error',error=>{console.error('Error:',error);});}main();

Make sure to install and importdotenv at the top if you are using Node.js:

import'dotenv/config';

5. Run the AI agent

To run the pipe locally, you need to start the BaseAI server. Run the following command in your terminal:

npx baseai@latest dev

Now, run theindex.ts file in your terminal:

npx tsx index.ts

You should see the following output in your terminal:

Stream started.Langbase Studio is your AI development playground. Experiment in real-time with real data, store messages, and version prompts to move from prototype to production seamlessly.Key Features:-**Collaborate**: Invite team members to build AI together.-**Inclusive Teams**: Engage all stakeholders—R&D, engineering, product, and marketing—in a shared space. It’s like GitHub combined with Google Docs for AI development.Stream ended.

Tip

You can also run RAG locally with BaseAI. Check out the memory agent quickstartguide for more details.

Contributing

We welcome contributions to BaseAI. Please see ourContributing Guide for more information.

Authors

The following are the original authors of BaseAI:

Security

If you've found a security vulnerability in BaseAI, please report it privately by emailingsecurity@langbase.com. Please do not open a public issue. For more details on Langbase security and how to report, visit thislink.

Learn more by clicking and browsing ourwebsite,docs, and a free/learn AI course on building AI agents, with agentic tools, and agentic memory.

baseai.dev

About

BaseAI — The Web AI Framework. The easiest way to build serverless autonomous AI agents with memory. Start building local-first, agentic pipes, tools, and memory. Deploy serverless with one command.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors10


[8]ページ先頭

©2009-2025 Movatter.jp