Skip to content
POST/v1/decide

Run the planner: calls, a dispatch, or a graph.

Exactly one of three request shapes; see DecideCallsRequest, DecideDispatchRequest and DecideGraphRequest. Every call's function (for 'calls'; for 'dispatch', the leaf a router reaches; for 'graph', each node's function) is checked against the caller's licences before it is decided (403 NotLicensed), and against on_low_confidence's own escalation steps first. on_low_confidence='error' answers 409 LowConfidence carrying the abstained decision; escalation runs through function references only -- an LLM, a person or another server step runs in the SDK, not here, and is refused as 422 InvalidRequest.

Request body

Full request schema
{
  "description": "Told apart by which key is present -- calls, dispatch or graph. No discriminator property is added: the wire has none.",
  "oneOf": [
    {
      "title": "DecideCallsRequest",
      "description": "Up to 256 function calls, answered in order.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "calls"
      ],
      "properties": {
        "calls": {
          "type": "array",
          "minItems": 1,
          "maxItems": 256,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "function",
              "input"
            ],
            "properties": {
              "function": {
                "type": "string",
                "minLength": 1
              },
              "input": true,
              "context": {
                "type": [
                  "object",
                  "null"
                ],
                "description": "Context field code name -> value: each field by the code_name GET /v1/functions lists for it (the manifest's key itself unless that key has spaces or other characters a name in code cannot have, for example counterparty_name for the key 'counterparty name'); null is the same as leaving it out."
              },
              "labels": {
                "description": "An object of label key -> description (null for none), or a list of label keys for a function that offers a subset of its own labels; null is the same as leaving it out.",
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "on_low_confidence": {
          "oneOf": [
            {
              "enum": [
                "return",
                "error"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "escalate"
              ],
              "properties": {
                "escalate": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 256,
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": "Function references to try in order, each implementing the same interface."
                },
                "budget_ms": {
                  "type": "number",
                  "exclusiveMinimum": 0
                }
              }
            }
          ]
        }
      }
    },
    {
      "title": "DecideDispatchRequest",
      "description": "One input routed through router functions to the function that should answer it.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "dispatch"
      ],
      "properties": {
        "dispatch": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "input",
            "interface"
          ],
          "properties": {
            "input": true,
            "interface": {
              "type": "string",
              "minLength": 1
            },
            "context": {
              "type": [
                "object",
                "null"
              ],
              "description": "Context field code name -> value: each field by the code_name GET /v1/functions lists for it (the manifest's key itself unless that key has spaces or other characters a name in code cannot have, for example counterparty_name for the key 'counterparty name'); null is the same as leaving it out."
            },
            "labels": {
              "description": "An object of label key -> description (null for none), or a list of label keys for a function that offers a subset of its own labels; null is the same as leaving it out.",
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "router": {
              "type": "string",
              "minLength": 1,
              "description": "The router to start from; jeff.core.router when absent."
            }
          }
        },
        "on_low_confidence": {
          "oneOf": [
            {
              "enum": [
                "return",
                "error"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "escalate"
              ],
              "properties": {
                "escalate": {
                  "type": "array",
                  "minItems": 1,
                  "maxItems": 256,
                  "items": {
                    "type": "string",
                    "minLength": 1
                  },
                  "description": "Function references to try in order, each implementing the same interface."
                },
                "budget_ms": {
                  "type": "number",
                  "exclusiveMinimum": 0
                }
              }
            }
          ]
        }
      }
    },
    {
      "title": "DecideGraphRequest",
      "description": "A registered graph (by id) or an inline graph without code nodes and with at most 256 nodes.",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "graph",
        "input",
        "params"
      ],
      "properties": {
        "graph": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "inline"
              ],
              "properties": {
                "inline": {
                  "allOf": [
                    {
                      "title": "Jeff decision graph",
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "graph",
                        "version",
                        "input",
                        "params",
                        "nodes",
                        "outputs"
                      ],
                      "properties": {
                        "graph": {
                          "type": "string",
                          "pattern": "^jeff(\\.[a-z0-9][a-z0-9_-]*){2}$|^[a-z][a-z0-9_-]*$"
                        },
                        "version": {
                          "type": "string",
                          "pattern": "^\\d+\\.\\d+\\.\\d+$"
                        },
                        "input": {
                          "type": "string"
                        },
                        "params": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "nodes": {
                          "type": "object",
                          "minProperties": 1,
                          "additionalProperties": {
                            "type": "object",
                            "additionalProperties": false,
                            "oneOf": [
                              {
                                "required": [
                                  "call"
                                ]
                              },
                              {
                                "required": [
                                  "code"
                                ]
                              }
                            ],
                            "properties": {
                              "call": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "after": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "context": {
                                "type": "object",
                                "additionalProperties": {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "param"
                                  ],
                                  "properties": {
                                    "param": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "description": "The called function's context fields, each keyed by its code name (the code_name GET /v1/functions lists, as every caller passes context; 'counterparty_name' for the manifest key 'counterparty name'), never by the exact key with spaces, which is refused (UnknownContext, naming the code name), and mapped to a graph param."
                              },
                              "labels": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "param"
                                ],
                                "properties": {
                                  "param": {
                                    "type": "string"
                                  }
                                }
                              },
                              "when": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "all"
                                    ],
                                    "properties": {
                                      "all": {
                                        "type": "array",
                                        "items": {
                                          "$ref": "#/components/schemas/graph/$defs/condition"
                                        },
                                        "minItems": 1
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "any"
                                    ],
                                    "properties": {
                                      "any": {
                                        "type": "array",
                                        "items": {
                                          "$ref": "#/components/schemas/graph/$defs/condition"
                                        },
                                        "minItems": 1
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "not"
                                    ],
                                    "properties": {
                                      "not": {
                                        "$ref": "#/components/schemas/graph/$defs/condition"
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "node",
                                      "is"
                                    ],
                                    "properties": {
                                      "node": {
                                        "type": "string"
                                      },
                                      "is": {
                                        "type": [
                                          "string",
                                          "boolean",
                                          "integer"
                                        ]
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "node",
                                      "in"
                                    ],
                                    "properties": {
                                      "node": {
                                        "type": "string"
                                      },
                                      "in": {
                                        "type": "array",
                                        "items": {
                                          "type": [
                                            "string",
                                            "boolean",
                                            "integer"
                                          ]
                                        },
                                        "minItems": 1
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "node",
                                      "abstained"
                                    ],
                                    "properties": {
                                      "node": {
                                        "type": "string"
                                      },
                                      "abstained": {
                                        "type": "boolean"
                                      }
                                    }
                                  },
                                  {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                      "node",
                                      "confidence_below"
                                    ],
                                    "properties": {
                                      "node": {
                                        "type": "string"
                                      },
                                      "confidence_below": {
                                        "type": "number"
                                      }
                                    }
                                  }
                                ]
                              },
                              "on_low_confidence": {
                                "enum": [
                                  "return",
                                  "error"
                                ]
                              }
                            }
                          }
                        },
                        "outputs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "minItems": 1
                        }
                      },
                      "$defs": {
                        "param": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "param"
                          ],
                          "properties": {
                            "param": {
                              "type": "string"
                            }
                          }
                        },
                        "node": {
                          "type": "object",
                          "additionalProperties": false,
                          "oneOf": [
                            {
                              "required": [
                                "call"
                              ]
                            },
                            {
                              "required": [
                                "code"
                              ]
                            }
                          ],
                          "properties": {
                            "call": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "after": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "context": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                  "param"
                                ],
                                "properties": {
                                  "param": {
                                    "type": "string"
                                  }
                                }
                              },
                              "description": "The called function's context fields, each keyed by its code name (the code_name GET /v1/functions lists, as every caller passes context; 'counterparty_name' for the manifest key 'counterparty name'), never by the exact key with spaces, which is refused (UnknownContext, naming the code name), and mapped to a graph param."
                            },
                            "labels": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "param"
                              ],
                              "properties": {
                                "param": {
                                  "type": "string"
                                }
                              }
                            },
                            "when": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "all"
                                  ],
                                  "properties": {
                                    "all": {
                                      "type": "array",
                                      "items": {
                                        "$ref": "#/components/schemas/graph/$defs/condition"
                                      },
                                      "minItems": 1
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "any"
                                  ],
                                  "properties": {
                                    "any": {
                                      "type": "array",
                                      "items": {
                                        "$ref": "#/components/schemas/graph/$defs/condition"
                                      },
                                      "minItems": 1
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "not"
                                  ],
                                  "properties": {
                                    "not": {
                                      "$ref": "#/components/schemas/graph/$defs/condition"
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "node",
                                    "is"
                                  ],
                                  "properties": {
                                    "node": {
                                      "type": "string"
                                    },
                                    "is": {
                                      "type": [
                                        "string",
                                        "boolean",
                                        "integer"
                                      ]
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "node",
                                    "in"
                                  ],
                                  "properties": {
                                    "node": {
                                      "type": "string"
                                    },
                                    "in": {
                                      "type": "array",
                                      "items": {
                                        "type": [
                                          "string",
                                          "boolean",
                                          "integer"
                                        ]
                                      },
                                      "minItems": 1
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "node",
                                    "abstained"
                                  ],
                                  "properties": {
                                    "node": {
                                      "type": "string"
                                    },
                                    "abstained": {
                                      "type": "boolean"
                                    }
                                  }
                                },
                                {
                                  "type": "object",
                                  "additionalProperties": false,
                                  "required": [
                                    "node",
                                    "confidence_below"
                                  ],
                                  "properties": {
                                    "node": {
                                      "type": "string"
                                    },
                                    "confidence_below": {
                                      "type": "number"
                                    }
                                  }
                                }
                              ]
                            },
                            "on_low_confidence": {
                              "enum": [
                                "return",
                                "error"
                              ]
                            }
                          }
                        },
                        "condition": {
                          "oneOf": [
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "all"
                              ],
                              "properties": {
                                "all": {
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "all"
                                        ],
                                        "properties": {
                                          "all": {
                                            "type": "array",
                                            "items": {
                                              "$ref": "#/components/schemas/graph/$defs/condition"
                                            },
                                            "minItems": 1
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "any"
                                        ],
                                        "properties": {
                                          "any": {
                                            "type": "array",
                                            "items": {
                                              "$ref": "#/components/schemas/graph/$defs/condition"
                                            },
                                            "minItems": 1
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "not"
                                        ],
                                        "properties": {
                                          "not": {
                                            "$ref": "#/components/schemas/graph/$defs/condition"
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "is"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "is": {
                                            "type": [
                                              "string",
                                              "boolean",
                                              "integer"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "in"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "in": {
                                            "type": "array",
                                            "items": {
                                              "type": [
                                                "string",
                                                "boolean",
                                                "integer"
                                              ]
                                            },
                                            "minItems": 1
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "abstained"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "abstained": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "confidence_below"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "confidence_below": {
                                            "type": "number"
                                          }
                                        }
                                      }
                                    ]
                                  },
                                  "minItems": 1
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "any"
                              ],
                              "properties": {
                                "any": {
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "all"
                                        ],
                                        "properties": {
                                          "all": {
                                            "type": "array",
                                            "items": {
                                              "$ref": "#/components/schemas/graph/$defs/condition"
                                            },
                                            "minItems": 1
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "any"
                                        ],
                                        "properties": {
                                          "any": {
                                            "type": "array",
                                            "items": {
                                              "$ref": "#/components/schemas/graph/$defs/condition"
                                            },
                                            "minItems": 1
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "not"
                                        ],
                                        "properties": {
                                          "not": {
                                            "$ref": "#/components/schemas/graph/$defs/condition"
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "is"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "is": {
                                            "type": [
                                              "string",
                                              "boolean",
                                              "integer"
                                            ]
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "in"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "in": {
                                            "type": "array",
                                            "items": {
                                              "type": [
                                                "string",
                                                "boolean",
                                                "integer"
                                              ]
                                            },
                                            "minItems": 1
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "abstained"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "abstained": {
                                            "type": "boolean"
                                          }
                                        }
                                      },
                                      {
                                        "type": "object",
                                        "additionalProperties": false,
                                        "required": [
                                          "node",
                                          "confidence_below"
                                        ],
                                        "properties": {
                                          "node": {
                                            "type": "string"
                                          },
                                          "confidence_below": {
                                            "type": "number"
                                          }
                                        }
                                      }
                                    ]
                                  },
                                  "minItems": 1
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "not"
                              ],
                              "properties": {
                                "not": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "all"
                                      ],
                                      "properties": {
                                        "all": {
                                          "type": "array",
                                          "items": {
                                            "$ref": "#/components/schemas/graph/$defs/condition"
                                          },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "any"
                                      ],
                                      "properties": {
                                        "any": {
                                          "type": "array",
                                          "items": {
                                            "$ref": "#/components/schemas/graph/$defs/condition"
                                          },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "not"
                                      ],
                                      "properties": {
                                        "not": {
                                          "$ref": "#/components/schemas/graph/$defs/condition"
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "node",
                                        "is"
                                      ],
                                      "properties": {
                                        "node": {
                                          "type": "string"
                                        },
                                        "is": {
                                          "type": [
                                            "string",
                                            "boolean",
                                            "integer"
                                          ]
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "node",
                                        "in"
                                      ],
                                      "properties": {
                                        "node": {
                                          "type": "string"
                                        },
                                        "in": {
                                          "type": "array",
                                          "items": {
                                            "type": [
                                              "string",
                                              "boolean",
                                              "integer"
                                            ]
                                          },
                                          "minItems": 1
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "node",
                                        "abstained"
                                      ],
                                      "properties": {
                                        "node": {
                                          "type": "string"
                                        },
                                        "abstained": {
                                          "type": "boolean"
                                        }
                                      }
                                    },
                                    {
                                      "type": "object",
                                      "additionalProperties": false,
                                      "required": [
                                        "node",
                                        "confidence_below"
                                      ],
                                      "properties": {
                                        "node": {
                                          "type": "string"
                                        },
                                        "confidence_below": {
                                          "type": "number"
                                        }
                                      }
                                    }
                                  ]
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "node",
                                "is"
                              ],
                              "properties": {
                                "node": {
                                  "type": "string"
                                },
                                "is": {
                                  "type": [
                                    "string",
                                    "boolean",
                                    "integer"
                                  ]
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "node",
                                "in"
                              ],
                              "properties": {
                                "node": {
                                  "type": "string"
                                },
                                "in": {
                                  "type": "array",
                                  "items": {
                                    "type": [
                                      "string",
                                      "boolean",
                                      "integer"
                                    ]
                                  },
                                  "minItems": 1
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "node",
                                "abstained"
                              ],
                              "properties": {
                                "node": {
                                  "type": "string"
                                },
                                "abstained": {
                                  "type": "boolean"
                                }
                              }
                            },
                            {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "node",
                                "confidence_below"
                              ],
                              "properties": {
                                "node": {
                                  "type": "string"
                                },
                                "confidence_below": {
                                  "type": "number"
                                }
                              }
                            }
                          ]
                        }
                      }
                    },
                    {
                      "properties": {
                        "nodes": {
                          "maxProperties": 256
                        }
                      },
                      "description": "An inline graph has at most 256 nodes."
                    }
                  ]
                }
              }
            }
          ]
        },
        "input": true,
        "params": {
          "type": "object"
        },
        "on_low_confidence_by_node": {
          "type": "object",
          "maxProperties": 256,
          "additionalProperties": {
            "oneOf": [
              {
                "enum": [
                  "return",
                  "error"
                ]
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "escalate"
                ],
                "properties": {
                  "escalate": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 256,
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Function references to try in order, each implementing the same interface."
                  },
                  "budget_ms": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  }
                }
              }
            ]
          }
        }
      }
    }
  ]
}

Responses

200One reply per request shape.
Response schema
{
  "title": "Jeff POST /v1/decide response",
  "description": "One reply per request shape: 'decisions' (in call order) for 'calls', 'decision' (with its route) for 'dispatch', 'graph_result' for 'graph'.",
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "decisions"
      ],
      "properties": {
        "decisions": {
          "type": "array",
          "items": {
            "title": "Jeff decision",
            "type": "object",
            "additionalProperties": false,
            "required": [
              "value",
              "confidence",
              "abstained",
              "calibrated",
              "interface",
              "function",
              "version",
              "probabilities",
              "score",
              "route",
              "decided_by",
              "escalations",
              "timing",
              "evidence_refs"
            ],
            "properties": {
              "value": {
                "type": [
                  "string",
                  "boolean",
                  "integer"
                ]
              },
              "confidence": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "maximum": 1
              },
              "abstained": {
                "type": "boolean"
              },
              "calibrated": {
                "type": "boolean"
              },
              "interface": {
                "type": "string"
              },
              "function": {
                "type": "string",
                "description": "The function that decided, by its own ID (the adapter's ID, a dot, the function's key): the versioned ID even when the call named the function through an alias, so jeff.routing.router-open.specialist is answered with jeff.routing.router-open-v14.specialist."
              },
              "version": {
                "type": "string",
                "description": "The version of the adapter that decided."
              },
              "probabilities": {
                "type": "object",
                "additionalProperties": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                }
              },
              "score": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "route": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "router",
                    "chose",
                    "confidence"
                  ],
                  "properties": {
                    "router": {
                      "type": "string"
                    },
                    "chose": {
                      "type": "string"
                    },
                    "confidence": {
                      "type": "number"
                    }
                  }
                }
              },
              "decided_by": {
                "type": "string"
              },
              "escalations": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "decided_by",
                    "value",
                    "confidence",
                    "reason"
                  ],
                  "properties": {
                    "decided_by": {
                      "type": "string"
                    },
                    "value": {
                      "type": [
                        "string",
                        "boolean",
                        "integer"
                      ]
                    },
                    "confidence": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                }
              },
              "timing": {
                "type": "object"
              },
              "evidence_refs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "decision"
      ],
      "properties": {
        "decision": {
          "title": "Jeff decision",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "value",
            "confidence",
            "abstained",
            "calibrated",
            "interface",
            "function",
            "version",
            "probabilities",
            "score",
            "route",
            "decided_by",
            "escalations",
            "timing",
            "evidence_refs"
          ],
          "properties": {
            "value": {
              "type": [
                "string",
                "boolean",
                "integer"
              ]
            },
            "confidence": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "maximum": 1
            },
            "abstained": {
              "type": "boolean"
            },
            "calibrated": {
              "type": "boolean"
            },
            "interface": {
              "type": "string"
            },
            "function": {
              "type": "string",
              "description": "The function that decided, by its own ID (the adapter's ID, a dot, the function's key): the versioned ID even when the call named the function through an alias, so jeff.routing.router-open.specialist is answered with jeff.routing.router-open-v14.specialist."
            },
            "version": {
              "type": "string",
              "description": "The version of the adapter that decided."
            },
            "probabilities": {
              "type": "object",
              "additionalProperties": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "score": {
              "type": [
                "number",
                "null"
              ]
            },
            "route": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "router",
                  "chose",
                  "confidence"
                ],
                "properties": {
                  "router": {
                    "type": "string"
                  },
                  "chose": {
                    "type": "string"
                  },
                  "confidence": {
                    "type": "number"
                  }
                }
              }
            },
            "decided_by": {
              "type": "string"
            },
            "escalations": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "decided_by",
                  "value",
                  "confidence",
                  "reason"
                ],
                "properties": {
                  "decided_by": {
                    "type": "string"
                  },
                  "value": {
                    "type": [
                      "string",
                      "boolean",
                      "integer"
                    ]
                  },
                  "confidence": {
                    "type": [
                      "number",
                      "null"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  }
                }
              }
            },
            "timing": {
              "type": "object"
            },
            "evidence_refs": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "graph_result"
      ],
      "properties": {
        "graph_result": {
          "title": "Jeff decision graph result",
          "description": "What running a decision graph returns: every node's result, the graph's outputs (the same results, for the nodes the graph names as outputs) and how many batched stages it took. A model node's result is its Decision; a skipped node's is {skipped: true, reason}; a code node's is whatever the caller's code returned, under 'code'.",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "nodes",
            "outputs",
            "stages"
          ],
          "properties": {
            "nodes": {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "decision"
                    ],
                    "properties": {
                      "decision": {
                        "title": "Jeff decision",
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "value",
                          "confidence",
                          "abstained",
                          "calibrated",
                          "interface",
                          "function",
                          "version",
                          "probabilities",
                          "score",
                          "route",
                          "decided_by",
                          "escalations",
                          "timing",
                          "evidence_refs"
                        ],
                        "properties": {
                          "value": {
                            "type": [
                              "string",
                              "boolean",
                              "integer"
                            ]
                          },
                          "confidence": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1
                          },
                          "abstained": {
                            "type": "boolean"
                          },
                          "calibrated": {
                            "type": "boolean"
                          },
                          "interface": {
                            "type": "string"
                          },
                          "function": {
                            "type": "string",
                            "description": "The function that decided, by its own ID (the adapter's ID, a dot, the function's key): the versioned ID even when the call named the function through an alias, so jeff.routing.router-open.specialist is answered with jeff.routing.router-open-v14.specialist."
                          },
                          "version": {
                            "type": "string",
                            "description": "The version of the adapter that decided."
                          },
                          "probabilities": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            }
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "route": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "router",
                                "chose",
                                "confidence"
                              ],
                              "properties": {
                                "router": {
                                  "type": "string"
                                },
                                "chose": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "number"
                                }
                              }
                            }
                          },
                          "decided_by": {
                            "type": "string"
                          },
                          "escalations": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "decided_by",
                                "value",
                                "confidence",
                                "reason"
                              ],
                              "properties": {
                                "decided_by": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "string",
                                    "boolean",
                                    "integer"
                                  ]
                                },
                                "confidence": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "reason": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "timing": {
                            "type": "object"
                          },
                          "evidence_refs": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "skipped",
                      "reason"
                    ],
                    "properties": {
                      "skipped": {
                        "const": true
                      },
                      "reason": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "code"
                    ],
                    "properties": {
                      "code": true
                    }
                  }
                ]
              }
            },
            "outputs": {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "decision"
                    ],
                    "properties": {
                      "decision": {
                        "title": "Jeff decision",
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "value",
                          "confidence",
                          "abstained",
                          "calibrated",
                          "interface",
                          "function",
                          "version",
                          "probabilities",
                          "score",
                          "route",
                          "decided_by",
                          "escalations",
                          "timing",
                          "evidence_refs"
                        ],
                        "properties": {
                          "value": {
                            "type": [
                              "string",
                              "boolean",
                              "integer"
                            ]
                          },
                          "confidence": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "minimum": 0,
                            "maximum": 1
                          },
                          "abstained": {
                            "type": "boolean"
                          },
                          "calibrated": {
                            "type": "boolean"
                          },
                          "interface": {
                            "type": "string"
                          },
                          "function": {
                            "type": "string",
                            "description": "The function that decided, by its own ID (the adapter's ID, a dot, the function's key): the versioned ID even when the call named the function through an alias, so jeff.routing.router-open.specialist is answered with jeff.routing.router-open-v14.specialist."
                          },
                          "version": {
                            "type": "string",
                            "description": "The version of the adapter that decided."
                          },
                          "probabilities": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            }
                          },
                          "score": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "route": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "router",
                                "chose",
                                "confidence"
                              ],
                              "properties": {
                                "router": {
                                  "type": "string"
                                },
                                "chose": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "number"
                                }
                              }
                            }
                          },
                          "decided_by": {
                            "type": "string"
                          },
                          "escalations": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": [
                                "decided_by",
                                "value",
                                "confidence",
                                "reason"
                              ],
                              "properties": {
                                "decided_by": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": [
                                    "string",
                                    "boolean",
                                    "integer"
                                  ]
                                },
                                "confidence": {
                                  "type": [
                                    "number",
                                    "null"
                                  ]
                                },
                                "reason": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "timing": {
                            "type": "object"
                          },
                          "evidence_refs": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "skipped",
                      "reason"
                    ],
                    "properties": {
                      "skipped": {
                        "const": true
                      },
                      "reason": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "code"
                    ],
                    "properties": {
                      "code": true
                    }
                  }
                ]
              }
            },
            "stages": {
              "type": "integer",
              "minimum": 0
            }
          },
          "$defs": {
            "result": {
              "oneOf": [
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "decision"
                  ],
                  "properties": {
                    "decision": {
                      "title": "Jeff decision",
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "value",
                        "confidence",
                        "abstained",
                        "calibrated",
                        "interface",
                        "function",
                        "version",
                        "probabilities",
                        "score",
                        "route",
                        "decided_by",
                        "escalations",
                        "timing",
                        "evidence_refs"
                      ],
                      "properties": {
                        "value": {
                          "type": [
                            "string",
                            "boolean",
                            "integer"
                          ]
                        },
                        "confidence": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 1
                        },
                        "abstained": {
                          "type": "boolean"
                        },
                        "calibrated": {
                          "type": "boolean"
                        },
                        "interface": {
                          "type": "string"
                        },
                        "function": {
                          "type": "string",
                          "description": "The function that decided, by its own ID (the adapter's ID, a dot, the function's key): the versioned ID even when the call named the function through an alias, so jeff.routing.router-open.specialist is answered with jeff.routing.router-open-v14.specialist."
                        },
                        "version": {
                          "type": "string",
                          "description": "The version of the adapter that decided."
                        },
                        "probabilities": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          }
                        },
                        "score": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "route": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "router",
                              "chose",
                              "confidence"
                            ],
                            "properties": {
                              "router": {
                                "type": "string"
                              },
                              "chose": {
                                "type": "string"
                              },
                              "confidence": {
                                "type": "number"
                              }
                            }
                          }
                        },
                        "decided_by": {
                          "type": "string"
                        },
                        "escalations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "decided_by",
                              "value",
                              "confidence",
                              "reason"
                            ],
                            "properties": {
                              "decided_by": {
                                "type": "string"
                              },
                              "value": {
                                "type": [
                                  "string",
                                  "boolean",
                                  "integer"
                                ]
                              },
                              "confidence": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "timing": {
                          "type": "object"
                        },
                        "evidence_refs": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "skipped",
                    "reason"
                  ],
                  "properties": {
                    "skipped": {
                      "const": true
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                },
                {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "code"
                  ],
                  "properties": {
                    "code": true
                  }
                }
              ]
            }
          }
        }
      }
    }
  ]
}
401HTTP 401; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
402HTTP 402; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
403HTTP 403; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
404HTTP 404; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
409HTTP 409; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
422HTTP 422; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
424HTTP 424; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
429HTTP 429; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
500HTTP 500; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
502HTTP 502; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
504HTTP 504; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}
529HTTP 529; see contract/errors.yaml for which error type(s) answer with this status.
Response schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "error"
  ],
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "type",
        "message",
        "details"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "The JeffError subclass name, e.g. NotLicensed."
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "object",
          "description": "The error's own extra attributes, if it has any (for example NotInstalled's function_id); empty for most errors."
        }
      }
    }
  }
}

Example

bash
curl -s -X POST https://api.jeffhub.ai/v1/decide \
  -H "Authorization: Bearer $JEFF_API_KEY" \
  -H "Content-Type: application/json" \
  -d @request.json