OutputHandling: {
    toString: (() => string) | (() => string);
    valueOf: (() => string) | (() => Object);
}

Defines where to place each tool output type in the LangChain ToolMessage.

Can be set to content or artifact to send all tool output into the ToolMessage.content or ToolMessage.artifact array, respectively, or you can assign an object that maps each content type to content or artifact.

Items in the content field will be used as input context for the LLM, while the artifact field is used for capturing tool output that won't be shown to the model, to be used in some later workflow step.

For example, imagine that you have a SQL query tool that can return huge result sets. Rather than sending these large outputs directly to the model, perhaps you want the model to be able to inspect the output in a code execution environment. In this case, you would set the output handling for the resource type to artifact (its default value), and then upon initialization of your code execution environment, you would look through your message history for ToolMessages with the artifact field set to resource, and use the content field during initialization of the environment.