Spring Boot auto-configuration platform for Embabel Agent Framework, enabling annotation-driven profile activation and bootstrapping of agent configurations with MCP client support
/**
* Environment post-processor activating profiles based on @EnableAgents annotation.
* Runs early in Spring Boot startup (HIGHEST_PRECEDENCE).
* Registered via META-INF/spring.factories.
*/
public class EnvironmentPostProcessor
implements org.springframework.boot.env.EnvironmentPostProcessor,
org.springframework.core.Ordered {
/**
* Property key for logging theme.
* Value: "embabel.agent.logging.personality"
*/
public static final String LOGGING_THEME_PROPERTY =
"embabel.agent.logging.personality";
/**
* Processes environment to set properties from @EnableAgents annotation.
*
* @param environment Spring environment to modify
* @param application Spring application (source of annotation)
*/
void postProcessEnvironment(ConfigurableEnvironment environment,
SpringApplication application);
/**
* Returns HIGHEST_PRECEDENCE for earliest execution.
*/
int getOrder();
}Registration: META-INF/spring.factories:
org.springframework.boot.env.EnvironmentPostProcessor=\
com.embabel.agent.config.annotation.spi.EnvironmentPostProcessorBehavior:
@EnableAgentsloggingTheme attributeembabel.agent.logging.personality propertyOrder: Returns Ordered.HIGHEST_PRECEDENCE (Integer.MIN_VALUE)
// Pseudocode
public void postProcessEnvironment(ConfigurableEnvironment env,
SpringApplication app) {
// Find @EnableAgents
EnableAgents annotation = findAnnotation(app);
// Extract theme
String theme = annotation != null ? annotation.loggingTheme() : "";
// Set property if not empty
if (!theme.isEmpty()) {
env.getPropertySources().addFirst(
new MapPropertySource("loggingThemeSource",
Map.of(LOGGING_THEME_PROPERTY, theme))
);
}
}Spring Boot Startup:
1. SpringApplication constructor
2. Prepare environment
3. → EnvironmentPostProcessor.postProcessEnvironment() [HIGHEST_PRECEDENCE]
4. Other EnvironmentPostProcessors
5. Load application context
6. Create beans
7. Application ready// Static initialization (pseudocode)
static {
if (IS_WINDOWS) {
configureUTF8Console();
setupOptimalFont();
}
}Purpose: Ensures proper Unicode display in Windows console.
interface ConfigurableEnvironment {
MutablePropertySources getPropertySources();
void addActiveProfile(String profile);
}
interface SpringApplication {
Set<Object> getAllSources();
}
interface Ordered {
int HIGHEST_PRECEDENCE = Integer.MIN_VALUE;
int getOrder();
}
class MapPropertySource extends PropertySource<Map<String, Object>> {
MapPropertySource(String name, Map<String, Object> source);
}Automatic: No manual configuration required - Spring Boot auto-discovers via spring.factories.
Effect:
@EnableAgents(loggingTheme = "starwars")
public class App { }
// After post-processing:
// Property "embabel.agent.logging.personality" = "starwars"Property Access:
@Value("${embabel.agent.logging.personality:}")
private String theme;Conditional Configuration:
@Configuration
@ConditionalOnProperty(
name = "embabel.agent.logging.personality",
havingValue = "starwars"
)
public class StarWarsConfig { }Install with Tessl CLI
npx tessl i tessl/maven-com-embabel-agent--embabel-agent-platform-autoconfigure