CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/maven-com-embabel-agent--embabel-agent-shell

Interactive Spring Shell-based command-line interface for the Embabel Agent platform, providing terminal interaction, chat sessions, and agent management commands.

Overview
Eval results
Files

configuration.mddocs/reference/

Configuration

The shell module provides Spring Boot configuration classes and properties for customizing shell behavior.

Imports

import com.embabel.agent.shell.config.ShellConfiguration
import com.embabel.agent.shell.config.ShellProperties

Shell Configuration

Spring configuration class for shell-specific components.

@Configuration
@EnableConfigurationProperties(ShellProperties::class)
class ShellConfiguration

Default Prompt Provider Bean

Provides a fallback prompt provider if no custom provider is configured.

@Bean
@ConditionalOnMissingBean(PromptProvider::class)
fun defaultPromptProvider(): PromptProvider

Returns: DefaultPromptProvider instance

Conditions: Only creates this bean if no other PromptProvider bean is found

Usage: This bean is automatically configured by Spring. If you want to use a custom prompt provider, define your own PromptProvider bean:

import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.shell.jline.PromptProvider
import org.jline.utils.AttributedString
import org.jline.utils.AttributedStyle

@Configuration
class MyConfiguration {
    @Bean
    fun customPromptProvider(): PromptProvider {
        return PromptProvider {
            AttributedString(
                "my-app> ",
                AttributedStyle.DEFAULT.foreground(AttributedStyle.CYAN)
            )
        }
    }
}

Shell Properties

Configuration properties class with prefix "embabel.agent.shell".

@ConfigurationProperties(prefix = "embabel.agent.shell")
class ShellProperties {
    var lineLength: Int = 140
    var redirectLogToFile: Boolean = false
}

Properties

lineLength

Maximum line length for text wrapping in terminal output.

Type: Int Default: 140 Property Key: embabel.agent.shell.lineLength

Usage:

embabel:
  agent:
    shell:
      lineLength: 120

Or in application.properties:

embabel.agent.shell.lineLength=120

redirectLogToFile

Whether to redirect log output to a file during chat sessions.

Type: Boolean Default: false Property Key: embabel.agent.shell.redirectLogToFile

Behavior:

  • When true: All log output is redirected to a file in the logs directory during chat sessions
  • When false: Logs continue to display in the console during chat sessions
  • Helps prevent log output from interfering with chat UI

Usage:

embabel:
  agent:
    shell:
      redirectLogToFile: true

Or in application.properties:

embabel.agent.shell.redirectLogToFile=true

Complete Configuration Example

Here's a complete application.yaml configuration example:

embabel:
  agent:
    shell:
      # Maximum line length for text wrapping
      lineLength: 140

      # Redirect logs to file during chat
      redirectLogToFile: false

    logging:
      # Choose personality theme for prompt
      # Options: starwars, severance, hitchhiker, colossus, montypython
      personality: starwars

spring:
  application:
    name: my-agent-app

  # Spring Shell configuration
  shell:
    interactive:
      enabled: true
    noninteractive:
      enabled: false

Programmatic Access

You can inject ShellProperties to access configuration values:

import com.embabel.agent.shell.config.ShellProperties
import org.springframework.stereotype.Component

@Component
class MyComponent(
    private val shellProperties: ShellProperties
) {
    fun processText(text: String) {
        val maxLength = shellProperties.lineLength
        val shouldRedirect = shellProperties.redirectLogToFile

        // Use configuration values
    }
}

Configuration Properties Processing

The ShellConfiguration class enables configuration properties processing through the @EnableConfigurationProperties(ShellProperties::class) annotation. This ensures that ShellProperties is registered as a Spring bean and properties are bound from application configuration sources.

Conditional Bean Configuration

The ShellConfiguration uses Spring's conditional bean registration:

  • @ConditionalOnMissingBean(PromptProvider::class): Only creates the default prompt provider if no other PromptProvider bean exists
  • This allows for easy customization by defining your own PromptProvider bean
  • Personality-based prompt providers (StarWars, Severance, etc.) use @ConditionalOnProperty to activate based on configuration

Integration with Spring Shell

This configuration integrates with Spring Shell framework:

  • PromptProvider interface is from org.springframework.shell.jline
  • The shell becomes interactive when Spring Shell starter is on the classpath
  • Commands are discovered through @ShellComponent annotation scanning
  • Terminal and LineReader are provided by Spring Shell's auto-configuration
tessl i tessl/maven-com-embabel-agent--embabel-agent-shell@0.3.0

docs

examples.md

index.md

quickstart.md

troubleshooting.md

tile.json