Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar_position: 2

AgentKit is an ecosystem-agnostic modular developer toolkit that lets you rapidly build, deploy, and iterate on AI agents using pre-configured environments and ready-to-use templates.

In this guide, you'll set up your own custom agent running on **Flow's EVM-compatible testnet**, powered by **Langchain** and **Anthropic's Claude** LLM.
In this guide, you'll set up your own custom agent that runs on **Flow's EVM-compatible testnet**, powered by **Langchain** and **Anthropic's Claude** LLM.

---

Expand Down Expand Up @@ -38,27 +38,27 @@ Follow the interactive setup:

## Project Setup

Once your scaffold is ready:
When your scaffold is ready:

```bash
cd onchain-agent
npm install
```

Now open the project in your preferred IDE (e.g. Cursor).
Now open the project in your preferred integrated development environment (IDE) (for example, [Cursor](../cursor/index.md).

### Environment Configuration

1. Create a `.env.local` file (or edit the one generated).
1. Create a `.env.local` file (or edit the one that you generated).
2. Add your API keys (we'll use **Anthropic** here).

> You can also use OpenAI, DeepSeek, or any other supported LLM.

### Get Your Anthropic API Key

- Head to [Anthropic Console](https://console.anthropic.com/dashboard)
- Create an account and **purchase credits**
- Click **Create Key**, name it, and copy the API key
- Head to [Anthropic Console](https://console.anthropic.com/dashboard).
- Create an account and **purchase credits**.
- Click **Create Key**, name it, and copy the API key.
- Add this to your `.env.local`:

```env
Expand All @@ -67,11 +67,11 @@ ANTHROPIC_API_KEY=your_api_key_here

### Wallet Setup with MetaMask

1. Add [Flow Testnet](https://developers.flow.com/evm/using) to MetaMask
2. Use the [Faucet](https://faucet.flow.com/fund-account) to fund your wallet
1. Add [Flow Testnet](https://developers.flow.com/evm/using) to MetaMask.
2. Use the [Faucet](https://faucet.flow.com/fund-account) to fund your wallet.
3. Get your private key:
- Click the `...` menu in MetaMask > **Account Details**
- Enter your password, copy the private key
- Click the `...` menu in MetaMask > **Account Details**.
- Enter your password, copy the private key.
4. Add it to `.env.local`:

```env
Expand Down Expand Up @@ -102,7 +102,7 @@ http://localhost:3000

## Configure Your LLM

If your agent doesn't respond yet no worries! You still need to configure your **LLM and client libraries**.
If your agent doesn't respond yet, no worries! You still need to configure your **LLM and client libraries**.

### Choose a Model

Expand Down Expand Up @@ -210,13 +210,13 @@ Want to skip the setup?

> [Fork the Flow AgentKit Starter](https://github.com/Aliserag/flow-agentkit-starter)

This starter includes all necessary config to start building immediately on Flow.
This starter includes all of the necessary configurations to start building immediately on Flow.

---

## Adding AgentKit to an Existing Project

Already have a project and want to add AgentKit? Follow these steps to integrate it into your existing codebase:
Already have a project and want to add AgentKit? Follow these steps to integrate it into your codebase:

### Install the Package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@ keywords:

# Eliza Plugin Development Guide

Plugins are a powerful way to extend the functionality of your Eliza AI agents. This guide will walk you through the process of creating custom plugins that can enhance your agent's capabilities, from simple utilities to complex integrations with external services. You'll learn how to leverage the plugin system to create modular and reusable components for your AI agents.
## Overview

Plugins are a powerful way to extend the functionality of your Eliza AI agents. This guide will walk you through the process of how to create custom plugins that can enhance your agent's capabilities, from simple utilities to complex integrations with external services. You'll learn how to leverage the plugin system to create modular and reusable components for your AI agents.

## Learning Objectives

By the end of this tutorial, you will be able to:
After you complete this tutorial, you will be able to:

- Create a new plugin repository from the template
- Understand the plugin development workflow
- Implement custom actions and services
- Integrate plugins with your Eliza agent
- Register and publish plugins to the Eliza Plugin Registry
- Use dependency injection for better plugin architecture
- Create a new plugin repository from the template.
- Understand the plugin development workflow.
- Implement custom actions and services.
- Integrate plugins with your Eliza agent.
- Register and publish plugins to the Eliza Plugin Registry.
- Use dependency injection for better plugin architecture.

## Prerequisites

Before getting started with Eliza, ensure you have:
Before you get started with Eliza, make sure you have:

- [Node.js 23+] (using [nvm] is recommended)
- [pnpm 9+]
Expand All @@ -41,17 +43,21 @@ Before getting started with Eliza, ensure you have:

## Quickstart

Please follow the [Quickstart Guide] to set up your development environment.
Follow the [Quickstart Guide] to set up your development environment.

## Plugin Development

### Create a Plugin repository from Template

Visit [Eliza Plugin Template] and click on the "Use this template" button to create a new repository.
Visit [Eliza Plugin Template] and click "Use this template" to create a new repository.

Or, you can create a new empty repository and copy the files from some examples at the [Eliza Plugins] organization.

Or you can create a new empty repository and copy the files from some examples at [Eliza Plugins] organization.
:::note

> Note: Flow's Eliza plugin template is using Dependency Injection(`@elizaos-plugins/plugin-di`), you can learn more about the Dependency Injection in the [plugin's README.md]. It allows you can use `Class` instead of `Object` for your `Actions`, `Providers`, `Services`, and etc. **If you don't want to use it, you can follow the other examples in Eliza Plugins organiazation.**
Flow's Eliza plugin template uses Dependency Injection(`@elizaos-plugins/plugin-di`). You can learn more about the Dependency Injection in the [plugin's README.md]. It allows you can use `Class` instead of `Object` for your `Actions`, `Providers`, `Services`, and so on. **If you don't want to use it, you can follow the other examples in Eliza Plugins organiazation.**

:::

### Add the Plugin repository to your Eliza project

Expand All @@ -77,7 +83,7 @@ Add the plugin to agent's `package.json`
pnpm add @elizaos-plugins/plugin-foo@'workspace:*' --filter ./agent
```

Check the `agent/package.json` to ensure the plugin is added, you should see something like this:
Check the `agent/package.json` to make sure the plugin is added. You'll see something like this:

```json
{
Expand All @@ -89,7 +95,7 @@ Check the `agent/package.json` to ensure the plugin is added, you should see som

### Build the Plugin

Build the plugin using the following command:
Build the plugin with the following command:

```bash
pnpm build --filter ./packages/plugin-foo
Expand All @@ -113,7 +119,7 @@ Let's say you want to add the plugin to the `sample` character which is `charact

:::warning

If you are using Dependency Injection(`@elizaos-plugins/plugin-di`) in your plugin, remember to add it to the `postProcessors` field. And **`clients` field is deprecated** in the latest version of Eliza, so if you want to add clients you also need to use `plugins` field.
If you use Dependency Injection(`@elizaos-plugins/plugin-di`) in your plugin, remember to add it to the `postProcessors` field. And **`clients` field is deprecated** in the latest version of Eliza, so if you want to add clients, you also need to use `plugins` field.

:::

Expand Down Expand Up @@ -155,7 +161,7 @@ pnpm start:client

You need to register your plugin in the [Eliza Plugin Registry] to make it available for other users.

Please follow the guide there, modify the [index.json] and submit a PR to the registry repository.
Follow the guide there, modify the [index.json] file, and submit a pull request (PR) to the registry repository.

## Conclusion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,24 @@ keywords:

# Quickstart Guide to build AI Agent on Flow with Eliza

Eliza is a powerful framework for building AI agents that can interact with users through natural language. This tutorial will guide you through setting up and deploying an AI agent on the Flow blockchain using Eliza. You'll learn how to create intelligent agents that can understand and respond to user queries, while leveraging Flow's secure and scalable infrastructure.
## Overview

Eliza is a powerful framework for building AI agents that can interact with users through natural language. This tutorial will guide you through how to set up and deploy an AI agent on the Flow blockchain with Eliza. You'll learn how to create intelligent agents that can understand and respond to user queries, while leveraging Flow's secure and scalable infrastructure.

## Learning Objectives

By the end of this tutorial, you will be able to:
After you complete this tutorial, you will be able to:

- Set up the Eliza development environment
- Configure and deploy an AI agent on Flow
- Create and customize character configurations
- Integrate different AI models with your agent
- Interact with your AI agent through a web interface
- Add and develop custom plugins for extended functionality
- Set up the Eliza development environment.
- Configure and deploy an AI agent on Flow.
- Create and customize character configurations.
- Integrate different AI models with your agent.
- Interact with your AI agent through a web interface.
- Add and develop custom plugins for extended functionality.

## Prerequisites

Before getting started with Eliza, ensure you have:
Before you get started started with Eliza, make sure you have:

- [Node.js 23+] (using [nvm] is recommended)
- [pnpm 9+]
Expand Down Expand Up @@ -58,7 +60,7 @@ cd elizaOnFlow
git checkout main
```

Or, If you want to use the origin Eliza, please run:
Or, If you want to use the origin Eliza, run:

```bash
# Eliza's characters folder is a submodule
Expand All @@ -71,7 +73,7 @@ cd eliza
git checkout $(git describe --tags --abbrev=0)
```

If you already cloned without submodules, please run:
If you already cloned without submodules, run:

```bash
# Fetch submodules
Expand All @@ -86,11 +88,11 @@ pnpm install --no-frozen-lockfile

:::warning

Please only use the `--no-frozen-lockfile` option when you're initially instantiating the repo or are bumping the version of a package or adding a new package to your package.json. This practice helps maintain consistency in your project's dependencies and prevents unintended changes to the lockfile.
Only use the `--no-frozen-lockfile` option when you're initially instantiating the repo or bump the version of a package or add a new package to your `package.json` file. This practice helps maintain consistency in your project's dependencies and prevents unintended changes to the lockfile.

:::

If you are using ElizaOnFlow, you need to install Flow Cadence contracts dependencies to ensure `*.cdc` be correctly linted by Cadence extension.
If you use ElizaOnFlow, you need to install Flow Cadence contracts dependencies to ensure that the Cadence extension correctly lints `*.cdc`.

Install Flow Cadence contracts dependencies:

Expand All @@ -106,37 +108,37 @@ pnpm build

## Configure Environment

Copy .env.example to .env and fill in the appropriate values.
Copy `.env.example` to `.env` and fill in the appropriate values.

```bash
cp .env.example .env
```

:::danger

In normal development, it's a best practice to use a `.env` to protect API keys and other sensitive information. When working with crypto, it's **critical** to be disciplined and always use them, even in test projects or tutorials. If you expose a wallet key, you might lose everything in that wallet immediately, or someone might watch it for years and rug you the day you put something valuable there.
In normal development, it's a best practice to use a `.env` to protect API keys and other sensitive information. When you work with crypto, it's **critical** to always use them, even in test projects or tutorials. If you expose a wallet key, you might lose everything in that wallet immediately, or someone might watch it for years and rob you the day you put something valuable there.

:::

Edit `.env` and add your values. Do NOT add this file to version control.
Edit `.env` and add your values. Do **NOT** add this file to version control.

### Choose Your Model

Eliza supports multiple AI models and you set which model to use inside the character JSON file.
But remember, once you chosed a model, you need to set up the relevant configuration.
But remember, after you chosed a model, you need to set up the relevant configuration.

Check full list of supported LLMs in origin Eliza: [Models.ts]
Check the full list of supported LLMs in origin Eliza: [Models.ts]

Suggested models:

- Use API to access LLM providers
- OpenAI: set modelProvider as `openai`, and set `OPENAI_API_KEY` in `.env`
- Deepseek: set modelProvider as `deepseek`, and set `DEEPSEEK_API_KEY` in `.env`
- Grok: set modelProvider as `grok`, and set `GROK_API_KEY` in `.env`
- Use API to access LLM providers:
- OpenAI: set modelProvider as `openai`, and set `OPENAI_API_KEY` in `.env`.
- Deepseek: set modelProvider as `deepseek`, and set `DEEPSEEK_API_KEY` in `.env`.
- Grok: set modelProvider as `grok`, and set `GROK_API_KEY` in `.env`.
- Use local inference
- Ollama: set modelProvider as `ollama`, and set `OLLAMA_MODEL` in `.env` to the model name you are using in ollama.
- Ollama: set modelProvider as `ollama`, and set `OLLAMA_MODEL` in `.env` to the model name you use in ollama.

> To choose model, you need to set in charactor configuration. For example: OPENAI, please set `modelProvider: "openai"` in charactor JSON file or `modelProvider: ModelProviderName.OPENAI` in `charactor.ts`
> To choose a model, you need to set in charactor configuration. For example: OPENAI, set `modelProvider: "openai"` in charactor JSON file or `modelProvider: ModelProviderName.OPENAI` in `charactor.ts`

### Setup Agent's Flow Account

Expand All @@ -146,9 +148,9 @@ Create a new Flow account for the Agent. Learn more: [doc]
flow accounts create
```

> If you are using Testnet, you can get free tokens from [Flow Faucet]
> If you use Testnet, you can get free tokens from [Flow Faucet]

Set Flow blockchain configuration in `.env` with new generated Flow account.
Set the Flow blockchain configuration in `.env` with a newly-generated Flow account.

```bash
FLOW_ADDRESS=
Expand All @@ -157,16 +159,16 @@ FLOW_NETWORK= # Default: mainnet
FLOW_ENDPOINT_URL= # Default: <https://mainnet.onflow.org>
```

For testnet, please check Flow's [Networks] for more information.
For testnet, check Flow's [Networks] for more information.

## Create Your First Agent

### Create a Character File

Check out the `deps/eliza/characters/` directory for a number of character files to try out.
Additionally you can override Eliza's `defaultCharacter` by editting `charactor.ts` which will be default used if no character json provided.
View the `deps/eliza/characters/` directory for a number of character files to try out.
Additionally, you can edit `charactor.ts` to override Eliza's `defaultCharacter` file, which is the default character file used if no character json files are provided.

Copy one of the example character files and make it your own
Copy one of the example character files and make it your own:

```bash
cp characters/scooby.character.json characters/sample.character.json
Expand All @@ -176,13 +178,13 @@ cp characters/scooby.character.json characters/sample.character.json

### **Start the Agent**

Inform it which character you want to run:
Tell it which character you want to run:

```bash
pnpm start --character="characters/sample.character.json"
```

Or you can use `pnpm start:debug` for more debugging logs:
Or, you can use `pnpm start:debug` for more debugging logs:

```bash
pnpm start:debug --character="characters/sample.character.json"
Expand All @@ -196,15 +198,15 @@ pnpm start --characters="characters/sample.character.json, characters/scooby.cha

### Add / Develop Plugins

run `npx elizaos plugins list` to get a list of available plugins or visit [Eliza Plugins Registry]
Run `npx elizaos plugins list` to get a list of available plugins or visit [Eliza Plugins Registry]

run `npx elizaos plugins add @elizaos-plugins/plugin-NAME` to install the plugin into your instance
Run `npx elizaos plugins add @elizaos-plugins/plugin-NAME` to install the plugin into your instance

To create a new plugin **for your own business**, you can refer to the [plugin development guide].
To create a new plugin **for your own business**, refer to the [plugin development guide].

#### Additional Requirements

You may need to install Sharp. If you see an error when starting up, try installing it with the following command:
You may need to install Sharp. If you see an error when starting up, install it with the following command:

```bash
pnpm install --include=optional sharp
Expand All @@ -220,23 +222,23 @@ Open a new terminal window and run the client's http server.
pnpm start:client
```

Once the client is running, you'll see a message like this:
After the client is running, you'll see a message like this:

```bash
➜ Local: http://localhost:5173/
```

Simply click the link or open your browser to `http://localhost:5173/`. You'll see the chat interface connect to the system, and you can begin interacting with your character.
Click the link or open your browser to `http://localhost:5173/`. You'll see the chat interface connect to the system, and you can now interact with your character.

## Common Issues & Solutions

Please check the orgin Eliza's [Common Issues & Solutions]
Check the orgin Eliza's [Common Issues & Solutions]

## Conclusion

In this tutorial, you've learned how to build and deploy an AI agent on the Flow blockchain using Eliza. You've gained hands-on experience with setting up the development environment, configuring agents, creating character configurations, integrating AI models, and developing custom plugins.

The Eliza framework provides a powerful way to create intelligent agents that can understand and respond to user queries while leveraging Flow's secure and scalable infrastructure. By completing this tutorial, you now have the foundation to build more sophisticated AI agents and create unique user experiences through character customization and plugin development.
The Eliza framework provides a powerful way to create intelligent agents that can understand and respond to user queries while leveraging Flow's secure and scalable infrastructure. Now taht you've completed this tutorial, you now have the foundation to build more sophisticated AI agents and create unique user experiences through character customization and plugin development.

[Node.js 23+]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
[nvm]: https://github.com/nvm-sh/nvm
Expand Down
Loading