> For the complete documentation index, see [llms.txt](https://hive-4.gitbook.io/hive/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hive-4.gitbook.io/hive/home.md).

# Home

<figure><img src="/files/Jgar4fR7JjYiobp1LqWG" alt=""><figcaption></figcaption></figure>

## &#x20;                                 Hive Agent Framework

<div align="center"><img src="https://img.shields.io/badge/Status-Alpha-red" alt="Project Status: Alpha"></div>

**Open-source framework for building, deploying, and serving powerful agentic workflows at scale.**&#x54;he Hive Agent Framework makes it easy to build scalable agent-based workflows with your model of choice. The framework is Hiven designed to perform robustly with [IBM Granite](https://www.ibm.com/granite/docs/) and [Llama 3.x](https://ai.meta.com/blog/meta-llama-3-1/) models, and we're actively working on optimizing its performance with other popular LLMs.\
\
Our goal is to empower developers to adopt the latest open-source and proprietary models with minimal changes to their current agent implementation.

### Key Features

* 🤖 **AI agents**: Use our powerful Hive agent refined for Llama 3.1 and Granite 3.0, or build your own.
* 🛠️ **Tools**: Use our built-in tools or create your own in Javascript/Python.
* 👩‍💻 **Code interpreter**: Run code safely in a sandbox container.
* 💾 **Memory**: Multiple strategies to optimize token spend.
* ⏸️ **Serialization** Handle complex agentic workflows and easily pause/resume them without losing state.
* 🔍 **Instrumentation**: Use Instrumentation based on Emitter to have full visibility of your agent’s inner workings.
* 🎛️ **Production-level** control with caching and error handling.
* 🔁 **API**: Integrate your agents using an OpenAI-compatible Assistants API and Python SDK.
* 🖥️ **Chat UI**: Serve your agent to users in a delightful UI with built-in transparency, explainability, and user controls.

### Getting started

#### Installation

```shell
npm install Hive-agent-framework
```

or

```shell
yarn add Hive-agent-framework
```

#### Example

```ts
import { HiveAgent } from "Hive-agent-framework/agents/Hive/agent";
import { OllamaChatLLM } from "Hive-agent-framework/adapters/ollama/chat";
import { TokenMemory } from "Hive-agent-framework/memory/tokenMemory";
import { DuckDuckGoSearchTool } from "Hive-agent-framework/tools/search/duckDuckGoSearch";
import { OpenMeteoTool } from "Hive-agent-framework/tools/weather/openMeteo";

const llm = new OllamaChatLLM(); // default is llama3.1 (8B), it is recommended to use 70B model

const agent = new HiveAgent({
  llm, // for more explore 'Hive-agent-framework/adapters'
  memory: new TokenMemory({ llm }), // for more explore 'Hive-agent-framework/memory'
  tools: [new DuckDuckGoSearchTool(), new OpenMeteoTool()], // for more explore 'Hive-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`

#### Local Installation

1. Clone the repository `git clone git@github.com:i-am-Hive/Hive-agent-framework`.
2. Install dependencies `yarn install --immutable && yarn prepare`.
3. Create `.env` (from `.env.template`) and fill in missing values (if any).
4. Start the agent `yarn run start:Hive` (it runs `/examples/agents/Hive.ts` file).

➡️ All examples can be found in the examples directory.

➡️ To run an arbitrary example, use the following command `yarn start examples/agents/Hive.ts` (just pass the appropriate path to the desired example).

#### 📦 Modules

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

| Name           | Description                                                                                 |
| -------------- | ------------------------------------------------------------------------------------------- |
| **agents**     | Base classes defining the common interface for agent.                                       |
| **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.

### Roadmap

* Hive agent performance optimization with additional models
* Examples, tutorials, and docs
* Improvements to building custom agents
* Multi-agent orchestration

[![Contributors list](https://contrib.rocks/image?repo=i-am-Hive/Hive-agent-framework)](https://github.com/i-am-Hive/Hive-agent-framework/graphs/contributors)
