Skip to content

obidot/obi.kit

Repository files navigation

Obidot

obi-kit — AI Agent SDK

TypeScript monorepo — LangChain tools and SDK for building AI agents on top of the Obidot protocol.


Packages

Package Description Version
@obidot-kit/core ABIs, types, EVM context, WebSocket client npm
@obidot-kit/llm 19+ LangChain tools — vault, swap, intent, oracle, admin npm
@obidot-kit/sdk High-level SDK combining core + llm npm
@obidot-kit/cli CLI — obi-kit init / run / info npm
cli → sdk → llm → core

Quick Start

pnpm add @obidot-kit/sdk
import { ObiKit } from "@obidot-kit/sdk";
import { createEvmContext, OBIDOT_VAULT_ADDRESS } from "@obidot-kit/core";

const evmContext = createEvmContext({
  rpcUrl: "https://eth-rpc-testnet.polkadot.io/",
  privateKey: process.env.PRIVATE_KEY as `0x${string}`,
});

const kit = new ObiKit({ evmContext });

kit.registerVault({
  id: "obidot-paseo",
  address: OBIDOT_VAULT_ADDRESS,
  asset: "DOT",
  decimals: 10,
});

// Get LangChain-compatible tools
const tools = kit.getTools();
// VaultDepositTool, VaultWithdrawTool, SwapQuoteTool,
// ExecuteIntentTool, BifrostYieldTool, OracleUpdateTool, …

With LangChain

import { ChatOpenAI } from "@langchain/openai";
import { createAgent } from "@obidot-kit/llm";

const agent = createAgent({
  model: new ChatOpenAI({ model: "gpt-4" }),
  additionalTools: kit.getTools(),
});

// "Deposit 50 DOT into the vault"
// "Get a swap quote for 10 DOT → USDC"
// "Execute a cross-chain intent to Hydration"

Development

git clone https://github.com/obidot/obi-kit.git
cd obi-kit
pnpm install
pnpm build
Command Description
pnpm build Build all packages
pnpm test Run all tests (Vitest)
pnpm lint Lint (Biome)
pnpm typecheck Type-check all packages
pnpm changeset Create a changeset
pnpm release Publish all changed packages

Writing a Custom Tool

import { ObiBaseTool } from "@obidot-kit/llm";
import { z } from "zod";

const schema = z.object({
  amount: z.string().describe("Amount to stake"),
});

export class MyStakeTool extends ObiBaseTool<typeof schema> {
  name = "my_stake";
  description = "Stake tokens in my protocol.";
  schema = schema;

  protected async execute(input: z.infer<typeof schema>) {
    // on-chain logic
    return { success: true, message: `Staked ${input.amount}` };
  }
}

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors