Every inferable tool call receives two arguments:

  • input: The input to the tool.
  • context: The context of the tool 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:

ctx.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.