0.1.2 • Published 4 months ago

beeai-framework-electron v0.1.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

Latest updates

For a full changelog, see our releases page.

Why pick BeeAI?

šŸ† Build the optimal agent architecture for your use case. To design the right architecture for your use case, you need flexibility in both orchestrating agents and defining their roles and behaviors. With the BeeAI framework, you can implement any multi-agent pattern using Workflows. Start with our out-of-the-box ReActAgent, or easily customize your own agent.

šŸš€ Scale effortlessly with production-grade controls. Deploying multi-agent systems requires efficient resource management and reliability. With the BeeAI framework, you can optimize token usage through memory strategies, persist and restore agent state via (de)serialization, generate structured outputs, and execute generated code in a sandboxed environment. When things go wrong, BeeAI helps you track the full agent workflow through events, collect telemetry, log diagnostic data, and handle errors with clear, well-defined exceptions.

šŸ”Œ Seamlessly integrate with your models and tools. Get started with any model from Ollama, Groq, OpenAI, watsonx.ai, and more. Leverage tools from LangChain, connect to any server using the Model Context Protocol, or build your own custom tools. BeeAI is designed for extensibility, allowing you to integrate with the systems and capabilities you need.

Modules

The source directory (src) provides numerous modules that one can use.

NameDescription
agentsBase classes defining the common interface for agent.
backendFunctionalities that relates to AI models (chat, embedding, image, tool calling, ...)
templatePrompt Templating system based on Mustache with various improvements.
memoryVarious types of memories to use with agent.
toolsTools that an agent can use.
cachePreset of different caching approaches that can be used together with tools.
errorsBase framework error classes used by each module.
loggerCore component for logging all actions within the framework.
serializerCore component for the ability to serialize/deserialize modules into the serialized format.
versionConstants representing the framework (e.g., the latest version)
emitterBringing visibility to the system by emitting events.
instrumentationIntegrate monitoring tools into your application.
internalsModules used by other modules within the framework.

Installation

To install the TypeScript library:

npm install beeai-framework

or

yarn add beeai-framework

Quick example

The following example demonstrates how to build a multi-agent workflow using the BeeAI Framework:

import "dotenv/config";
import { UnconstrainedMemory } from "beeai-framework/memory/unconstrainedMemory";
import { OpenMeteoTool } from "beeai-framework/tools/weather/openMeteo";
import { WikipediaTool } from "beeai-framework/tools/search/wikipedia";
import { AgentWorkflow } from "beeai-framework/experimental/workflows/agent";
import { Message, Role } from "beeai-framework/llms/primitives/message";
import { GroqChatLLM } from "beeai-framework/adapters/groq/chat";

const workflow = new AgentWorkflow();

workflow.addAgent({
  name: "Researcher",
  instructions: "You are a researcher assistant. Respond only if you can provide a useful answer.",
  tools: [new WikipediaTool()],
  llm: new GroqChatLLM(),
});

workflow.addAgent({
  name: "WeatherForecaster",
  instructions: "You are a weather assistant. Respond only if you can provide a useful answer.",
  tools: [new OpenMeteoTool()],
  llm: new GroqChatLLM(),
  execution: { maxIterations: 3 },
});

workflow.addAgent({
  name: "Solver",
  instructions:
    "Your task is to provide the most useful final answer based on the assistants' responses which all are relevant. Ignore those where assistant do not know.",
  llm: new GroqChatLLM(),
});

const memory = new UnconstrainedMemory();

await memory.add(
  Message.of({
    role: Role.USER,
    text: "What is the capital of France and what is the current weather there?",
    meta: { createdAt: new Date() },
  }),
);

const { result } = await workflow.run(memory.messages).observe((emitter) => {
  emitter.on("success", (data) => {
    console.log(`-> ${data.step}`, data.response?.update?.finalAnswer ?? "-");
  });
});

console.log(`Agent šŸ¤–`, result.finalAnswer);

Once you've installed the BeeAI Framework locally, you can run this example using either yarn or npm:

Using yarn:

yarn start examples/agents/simple.ts

Using npm:

npm run start examples/agents/simple.ts

!TIP

To run this example, be sure that you have installed ollama with the llama3.1 model downloaded.

āž”ļø Explore all examples in our examples library.

Roadmap

  • Python parity with TypeScript
  • Standalone docs site
  • Integration with watsonx.ai for deployment
  • More multi-agent reference architecture implementations using workflows
  • More OTTB agent implementations
  • Native tool calling with supported LLM providers

To stay up-to-date with out latest priorities, check out our public roadmap.

Contribution guidelines

The BeeAI Framework is an open-source project and we ā¤ļø contributions.

If you'd like to help build BeeAI, take a look at our contribution guidelines.

Bugs

We are using GitHub Issues to manage public bugs. We keep a close eye on this, so before filing a new issue, please check to make sure it hasn't already been logged.

Code of conduct

This project and everyone participating in it are governed by the Code of Conduct. By participating, you are expected to uphold this code. Please read the full text so that you can read which actions may or may not be tolerated.

Legal notice

All content in these repositories including code has been provided by IBM under the associated open source software license and IBM is under no obligation to provide enhancements, updates, or support. IBM developers produced this code as an open source project (not as an IBM product), and IBM makes no assertions as to the level of quality nor security, and will not be maintaining this code going forward.

Contributors

Special thanks to our contributors for helping us improve the BeeAI Framework.