1.0.1 • Published 10 months ago

@graphai/agents v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@graphai/agents for GraphAI

Agents for GraphAI.

Install

yarn add @graphai/agents

Usage

import { GraphAI } from "graphai";
import * as agents from "@graphai/agents";

const graph = new GraphAI(graph_data, agents);
const result = await graph.run();

Related Agent Packages

GraphData Example

graphDataLiteral

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": "apple"
    },
    "source2": {
      "value": {
        "apple": "red"
      }
    },
    "step1": {
      "agent": "stringTemplateAgent",
      "params": {
        "template": "${a}, ${b}, ${c}."
      },
      "inputs": {
        "a": ":source",
        "b": "orange"
      },
      "isResult": true
    },
    "step2": {
      "agent": "sleepAndMergeAgent",
      "inputs": {
        "array": [
          ":source2",
          {
            "lemon": "yellow"
          }
        ]
      },
      "isResult": true
    }
  }
}

graphDataInputs

{
  "version": 0.5,
  "nodes": {
    "apple": {
      "value": {
        "fruits": {
          "apple": "red"
        }
      }
    },
    "lemon": {
      "value": {
        "fruits": {
          "lemon": "yellow"
        }
      }
    },
    "total": {
      "agent": "sleepAndMergeAgent",
      "inputs": {
        "array": [
          ":apple",
          ":lemon",
          ":apple.fruits",
          ":lemon.fruits"
        ]
      }
    }
  }
}

graphDataAny

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": {}
    },
    "positive": {
      "agent": "sleepAndMergeAgent",
      "anyInput": true,
      "isResult": true,
      "inputs": {
        "array": [
          ":source.yes"
        ]
      }
    },
    "negative": {
      "agent": "sleepAndMergeAgent",
      "anyInput": true,
      "isResult": true,
      "inputs": {
        "array": [
          ":source.no"
        ]
      }
    }
  }
}

graphDataAny2

{
  "version": 0.5,
  "nodes": {
    "source1": {
      "value": {
        "apple": "red"
      }
    },
    "source2": {
      "value": {
        "lemon": "yellow"
      }
    },
    "router1": {
      "agent": "sleepAndMergeAgent",
      "params": {
        "duration": 10
      },
      "isResult": true,
      "inputs": {
        "array": [
          ":source1"
        ]
      }
    },
    "router2": {
      "agent": "sleepAndMergeAgent",
      "params": {
        "duration": 100
      },
      "isResult": true,
      "inputs": {
        "array": [
          ":source2"
        ]
      }
    },
    "receiver": {
      "agent": "sleepAndMergeAgent",
      "anyInput": true,
      "isResult": true,
      "inputs": {
        "array": [
          ":router1",
          ":router2"
        ]
      }
    }
  }
}

graphDataNested

{
  "version": 0.5,
  "nodes": {
    "source": {
      "value": {
        "nodes": {
          "source": {
            "value": 1
          },
          "result": {
            "agent": "copyAgent",
            "inputs": {
              "source": ":source"
            },
            "isResult": true
          }
        }
      }
    },
    "nested": {
      "agent": "nestedAgent",
      "graph": ":source",
      "isResult": true,
      "params": {
        "supressError": true
      }
    },
    "catch": {
      "agent": "propertyFilterAgent",
      "params": {
        "include": [
          "message"
        ]
      },
      "if": ":nested.onError",
      "inputs": {
        "item": ":nested.onError"
      },
      "isResult": true
    }
  }
}
1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

1.0.3

8 months ago

2.0.3

7 months ago

2.0.2

7 months ago

2.0.5

7 months ago

2.0.4

7 months ago

2.0.1

7 months ago

2.0.0

8 months ago

0.2.10

11 months ago

0.1.6

1 year ago

0.1.5

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.7

11 months ago

0.2.6

12 months ago

0.2.9

11 months ago

0.2.8

11 months ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.5

12 months ago

0.1.4

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.29

1 year ago

0.1.3

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago