Skip to main content
Set custom attributes on a Model or AgentTool that can be accessed by logging hooks. This function stores key-value pairs as attributes on the object, making them accessible to hooks during model invocation events. Attributes are automatically scoped to async or sync contexts.

Parameters

Model | AgentTool
required
The object to set the attribute on (Model or AgentTool instance)
str | int | float | bool
Key-value pairs of attributes to set (str, int, float, or bool values)

Example