π Bee Agent Framework is an open-source TypeScript library for building production-ready multi-agent systems. Pick from a variety of π LLM providers, customize the π prompt templates, create π€ agents, equip agents with pre-made π οΈ tools, and orchestrate π€π€π€ multi-agent workflows! πͺ
- π 2025-01-09:
- Introduced Workflows, a way of building multi-agent systems.
- Added support for Model Context Protocol, featured on the official page.
- π 2024-12-09: Added support for LLaMa 3.3.
- π 2024-11-21: Added an experimental Streamlit agent.
For a full changelog, see the releases page.
- βοΈ Battle-tested. Bee Agent Framework is at the core of BeeAI, a powerful platform for building chat assistants and custom AI-powered apps. BeeAI is in a closed beta, but already used by hundreds of users. And it's fully open-source too!
- π Production-grade. In an actual product, you have to reduce token spend through memory strategies, store and restore the agent state through (de)serialization, generate structured output, or execute generated code in a sandboxed environment. Leave all that to Bee and focus on building!
- π€ Built for open-source models. Pick any LLM you want β including small and open-source models. The framework is designed to perform robustly with Granite and Llama 3.x. A full agentic workflow can run on your laptop!
- π’ Bee cares about the sad path too. Real-world applications encounter errors and failures. Bee lets you observe the full agent workflow through events, collect telemetry, log diagnostic data, and throws clear and well-defined exceptions. Bees may be insects, but not bugs!
- π³ A part of something greater. Bee isn't just a framework, but a full ecosystem. Use Bee UI to chat with your agents visually. Bee Observe collects and manages telemetry. Bee Code Interpreter runs generated code safely in a secure sandbox. The Bee ecosystem also integrates with Model Context Protocol, allowing interoperability with the wider agent ecosystem!
This example demonstrates how to build a multi-agent workflow using Bee Agent Framework:
import "dotenv/config";
import { UnconstrainedMemory } from "bee-agent-framework/memory/unconstrainedMemory";
import { OpenMeteoTool } from "bee-agent-framework/tools/weather/openMeteo";
import { WikipediaTool } from "bee-agent-framework/tools/search/wikipedia";
import { AgentWorkflow } from "bee-agent-framework/experimental/workflows/agent";
import { BaseMessage, Role } from "bee-agent-framework/llms/primitives/message";
import { GroqChatLLM } from "bee-agent-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(
BaseMessage.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);
Tip
π Would you like a fully set-up TypeScript project with Bee, Code Interpreter, and Observability? Check out our Bee Framework Starter.
Tip
π Would you like to work with Bee in your web browser? See Bee Stack
npm install bee-agent-framework
or
yarn add bee-agent-framework
import { BeeAgent } from "bee-agent-framework/agents/bee/agent";
import { OllamaChatLLM } from "bee-agent-framework/adapters/ollama/chat";
import { TokenMemory } from "bee-agent-framework/memory/tokenMemory";
import { DuckDuckGoSearchTool } from "bee-agent-framework/tools/search/duckDuckGoSearch";
import { OpenMeteoTool } from "bee-agent-framework/tools/weather/openMeteo";
const llm = new OllamaChatLLM(); // default is llama3.1 (8B), it is recommended to use 70B model
const agent = new BeeAgent({
llm, // for more explore 'bee-agent-framework/adapters'
memory: new TokenMemory({ llm }), // for more explore 'bee-agent-framework/memory'
tools: [new DuckDuckGoSearchTool(), new OpenMeteoTool()], // for more explore 'bee-agent-framework/tools'
});
const response = await agent
.run({ prompt: "What's the current weather in Las Vegas?" })
.observe((emitter) => {
emitter.on("update", async ({ data, update, meta }) => {
console.log(`Agent (${update.key}) π€ : `, update.value);
});
});
console.log(`Agent π€ : `, response.result.text);
β‘οΈ See a more advanced example.
β‘οΈ you can run this example after local installation, using the command yarn start examples/agents/simple.ts
Tip
Documentation is available at https://i-am-bee.github.io/bee-agent-framework/
Note
yarn
should be installed via Corepack (tutorial)
- Clone the repository
git clone [email protected]:i-am-bee/bee-agent-framework
. - Install dependencies
yarn install --immutable && yarn prepare
. - Create
.env
(from.env.template
) and fill in missing values (if any). - Start the agent
yarn run start:bee
(it runs/examples/agents/bee.ts
file).
β‘οΈ All examples can be found in the examples directory.
β‘οΈ To run an arbitrary example, use the following command yarn start examples/agents/bee.ts
(just pass the appropriate path to the desired example).
The source directory (src
) provides numerous modules that one can use.
Name | Description |
---|---|
agents | Base classes defining the common interface for agent. |
workflows | Build agentic applications in a declarative way via workflows. |
llms | Base classes defining the common interface for text inference (standard or chat). |
template | Prompt Templating system based on Mustache with various improvements. |
memory | Various types of memories to use with agent. |
tools | Tools that an agent can use. |
cache | Preset of different caching approaches that can be used together with tools. |
errors | Error classes and helpers to catch errors fast. |
adapters | Concrete implementations of given modules for different environments. |
logger | Core component for logging all actions within the framework. |
serializer | Core component for the ability to serialize/deserialize modules into the serialized format. |
version | Constants representing the framework (e.g., latest version) |
emitter | Bringing visibility to the system by emitting events. |
internals | Modules used by other modules within the framework. |
To see more in-depth explanation see overview.
π§ Coming soon π§
- Bee agent performance optimization with additional models
- Examples, tutorials, and docs
- Improvements to building custom agents
- Multi-agent orchestration
The Bee Agent Framework is an open-source project and we β€οΈ contributions.
If you'd like to contribute to Bee, please take a look at our contribution guidelines.
We are using GitHub Issues to manage our 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.
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.
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.
Special thanks to our contributors for helping us improve Bee Agent Framework.