Function Context
How the function context is used to implement cross-cutting concerns in Inferable applications
Every inferable function call receives two arguments:
input
: The input to the function.context
: The context of the function call.
While the input
argument is constructed by the agent, the context
argument is constructed the code that the developer writes. The context object is never seen by the agent.
Context Object
The context
object is a special object that is used to implement cross-cutting concerns in Inferable applications.
It contains the following properties:
approved
A boolean that indicates if the function has been approved. By default, this is always false
. In order to initiate an approval request, you must return the approval request result type by checking the approved
property.
For an example, see human in the loop.
authContext
An object that contains the authentication context of the function call. Used for custom authentication and authorization flows.
For an example, see custom authentication and authorization.
runContext
An object that contains the run context of the function call. Used for custom run context, passed in from creating a Run. This is useful for sharing context between functions in the same run, that does not get passed to the agent.
Was this page helpful?