@graphai/service_agents
v0.1.0
Published
Service agents for GraphAI.
Downloads
376
Readme
@graphai/service_agents for GraphAI
Service agents for GraphAI.
Install
yarn add @graphai/service_agents
Usage
import { GraphAI } from "graphai";
import { fetchAgent, wikipediaAgent } from "@graphai/service_agents";
const agents = { fetchAgent, wikipediaAgent };
const graph = new GraphAI(graph_data, agents);
const result = await graph.run();
Agents description
- fetchAgent - Retrieves JSON data from the specified URL
- wikipediaAgent - Retrieves data from wikipedia
Input/Output/Params Schema & samples
GraphData Example
graphDataFetch
{
"version": 0.5,
"nodes": {
"url": {
"value": "https://www.google.com/search?q=hello"
},
"fetch": {
"agent": "fetchAgent",
"params": {
"type": "text"
},
"inputs": {
"url": ":url"
}
},
"success": {
"agent": "copyAgent",
"isResult": true,
"unless": ":fetch.onError",
"inputs": {
"result": true
}
},
"error": {
"agent": "copyAgent",
"isResult": true,
"if": ":fetch.onError",
"inputs": {
"error": ":fetch.onError"
}
}
}
}
graphDataPost
{
"version": 0.5,
"nodes": {
"url": {
"value": "https://www.google.com/search?q=hello"
},
"fetch": {
"agent": "fetchAgent",
"params": {
"type": "text"
},
"inputs": {
"url": ":url",
"body": "Posting data"
}
},
"success": {
"agent": "copyAgent",
"isResult": true,
"unless": ":fetch.onError",
"inputs": {
"result": true
}
},
"error": {
"agent": "propertyFilterAgent",
"params": {
"include": [
"message",
"status"
]
},
"isResult": true,
"if": ":fetch.onError",
"inputs": {
"item": ":fetch.onError"
}
}
}
}