Docs Navigation

Agent

For more advanced applications, you can manage your agents through the API. All of these endpoints use the Agent datatype.

This is the JSON representation of a fuzzy.ai fuzzy agent.

PropertyPurposeExample

id

Unique ID of the agent; an opaque string

 "a38t196fd" 

name

The name of the agent

 "Social Relevance"  

inputs

An object mapping input names to input definitions. Each definition is an object mapping fuzzy set names to set definitions. Each fuzzy set definition is an array of numbers, representing a slope (2 numbers), triangle (3 numbers), or a trapezoid (4 numbers).

{"numberOfLikes": 
 { 
 "veryLow": [0, 10], 
 "low": [0, 5, 15, 20], 
 "medium": [10, 15, 20, 25], 
 "high": [20, 30, 70, 80], 
 "veryHigh": [60, 100] 
 }, 
 "numberOfShares": 
 { 
 "veryLow": [0, 5], 
 "low": [0, 5, 10], 
 "medium": [5, 10, 20, 25], 
 "high": [20, 25, 50, 55], 
 "veryHigh": [50, 75] 
 }, 
 "age": 
 { 
 "brandNew": [0, 15], 
 "new": [0, 15, 50, 60], 
 "recent": [45, 60, 120, 135] 
 "old": [120, 240] 
 } 
 }

outputs

An object mapping output names to output definitions. Each output definition is an object mapping fuzzy set names to set definitions. Each fuzzy set definition is an array of numbers, representing a slope (2 numbers), triangle (3 numbers), or a trapezoid (4 numbers).

{ 
 "relevance": { 
 "veryLow": [0, 20],
 "low": [5, 25, 45],
 "medium": [30, 50, 70],
 "high": [55, 75, 95],
 "veryHigh": [80, 100]
 } 
 }

rules

An array of strings, one for each rule in the agent. The rule language is a subset of Fuzzy Control Language, mapping simple antecedents (possibly joined with AND or OR) with simple consequents.

[
  "IF age IS new THEN relevance IS high",
  "IF numberOfLikes IS medium THEN relevance IS medium"
]

createdAt

ISO 8601 timestamp for the create date of the Agent.

 "2015-02-20T16:32:56.358Z"  

updatedAt

ISO 8601 timestamp for the last update date of the Agent. May be identical to the createdAt date.

"2015-02-20T16:32:56.358Z"

latestVersion

The ID of the latest version of the agent.

"abbaNZ191"

GET https://api.fuzzy.ai/agent

This method returns a list of all the fuzzy agents associated with your account.

Request

The request body is empty. This method requires authentication.

Response

The response body is a UTF-8-encoded JSON array of abbreviated agent objects. Each agent object includes an id and a name property. For example

[ 
 {"id": "aZ1avN6F", "name": "Social Relevance"}, 
 {"id": "thx138ddd", "name", "Dynamic Pricing"}, 
 {"id": "0xDeaDBeef", "name": "Fraud Detection"} 
]

POST https://api.fuzzy.ai/agent

This method is used to create a new agent.

Request

The request body is a UTF-8-encoded JSON representation of an Agent. The ID is not required.

Response

The response body is a UTF-8-encoded JSON representation of the Agent, with the ID added. The Location header includes the full endpoint for the new Agent.

GET https://api.fuzzy.ai/agent/<agent id>

This endpoint retrieves the current definition of the Agent.

Request

The request body is empty. This method requires authentication.

Response

The response body is an UTF-8-encoded JSON representation of the Agent (see above for details).

PUT https://api.fuzzy.ai/agent/<agent id>

This method updates the definition of the Agent with the given ID.

Request

The request body is an UTF-8-encoded JSON representation of the Agent. All properties except name, inputs, outputs and rules are ignored. This method requires authentication.

Response

The response body is an UTF-8-encoded JSON representation of the Agent. The updatedAt timestamp will be updated, as will be the latestVersion property.

DELETE https://api.fuzzy.ai/agent/<agent id>

This method deletes an Agent, including its version history (see below).

Request

The request body should be empty.

Response

The response is an UTF-8-encoded JSON object representing the deletion of the objection. It includes a single property message which will have the value "OK".