How can I use Action directly?

Learn how to use action/tool directly

Vity Toolkit allows you to execute action directly as function calls.

import { LangchainToolkit, Action } from "vity-toolkit";

const toolKit = new LangchainToolkit();
const result = await toolKit.executeAction({ action: Action.EARN_BOUNTY_LISTINGS });

console.log(result.data);

Many tools require some input parameters which you need to provide.

import { VityToolKit, Action } from "vity-toolkit";


const toolKit = new VityToolKit();

// 1. Get expected params for an action
const expectedParams = toolKit.getInputParamsForAction({ action: Action.EARN_FETCH_USER_POWS });
console.log(expectedParams);

// 2. Pass the expected params with values for executing the action
const params = { userId: '1ce11bfa-7fca-4d0f-9d19-c114b18a0207' };

const result = await toolKit.executeAction({ action: Action.EARN_FETCH_USER_POWS, inputParams: params });

console.log(result.data);

Last updated