This plugin simply uses an external API to add two numbers via a GET request to localhost:3001/api/calculate, but is simply an
example to demonstrate a custom plugin to reach out to external APIs.
Assume a GET /calculate api like so
app.get("/calculate", async (request, response) => {
const { n1, n2 } = request.query;
const addition = Number(n1) + Number(n2);
response.status(200).json({ sum: addition });
});You can then use a custom agent by:
- create a folder in the
storagefolder of AnythingLLM calledagent-skills. This folder should exist already. - create a folder named
agent-addition-api-invocation - Copy paste plugin.json and handler.js into this folder.
- It should now be visible in
Agent Skillsin the AnythingLLM UI. - Call is via
@agent add x + yand get a response that was calculated externally.