Externalize agent settings with SPEL

In addition to hardcoding your Agent properties within the annotation, we also support setting those through your application.properties file. To set this up, just replace your @PeoplelogicAgent annotation with something similar:

@PeoplelogicAgent(value="hrCoordinator", name = "${peoplelogic.agent.HRCoordinatorAgent.name}",
        tools = {"hr-coordinator-tools", "${peoplelogic.agent.HRCoordinatorAgent.tools:}"},
        persona = "${peoplelogic.agent.HRCoordinatorAgent.persona}", title = "${peoplelogic.agent.HRCoordinatorAgent.title}",
        avatar = "${peoplelogic.agent.HRCoordinatorAgent.avatar}", bio = "${peoplelogic.agent.HRCoordinatorAgent.bio}", shortBio = "${peoplelogic.agent.HRCoordinatorAgent.shortBio}")
public interface HRCoordinatorAgent extends WorkerAgent { }

Each of the values inside the strings like ${peoplelogic.agent.HRCoordinatorAgent.name} are properties. Just replace HRCoordinatorAgent in the string with the simple name of your Agent (SampleAgent for example) and include the whole property in application.properties. It will get picked up on startup of the SDK.

Last updated

Was this helpful?