Token and Speed Optimization

Token saving capabilities and recommendations

Calling functions directly

After a function is created you can make direct usage of the function:

POST /function

A simple token optimization involves "turning off" all unnecessary agents for the function or execution context. When the function executes, previously generated code ensures that calling /function bypasses any code generation and testing agents, allowing direct API execution.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Required
Description

function

string

Name of the function

data

object

The data example or parameters for your function to work

previous_agents

array

The Agents in order that will be executed before the function is called

active_agents

array

The Agents in order that will be executed after the function is called and before the return is send, the can alter the return for the client or call new functions

following_agents

array

Asynchronous agents to execute after the function is executed and the return send to the client

version

number

The version of the function to execute

bearer_token

string

Auth0 user session token to validate and ACL to database

Response

{
  "run_id": 1,
  "return": {
    "message" : "message example"
  },
  "status" : {
    "code" : 5,
    "status" : "completed",
  },
  "error": null
}

Last updated

Was this helpful?