Skip to main content
Note:This method can only be used locally. It is not available with remote inference.
Learn more about this method in the docs: Agent dynamic traits function

How it works

Agents are created by passing a dictionary of traits to an Agent object. For example:
When we run a survey with this agent, the language model will reference the agent’s traits in generating responses. We can test this:

Designing question-based traits

For efficiency or other reasons, we may want to minimize the set of traits that we pass to the agent when we create it, and instead only generate certain traits to use with specific questions. To do this, we can create a method for the desired conditional logic and pass it to an agent as the dynamic_traits_function parameter: