Interactive Spring Shell-based command-line interface for the Embabel Agent platform, providing terminal interaction, chat sessions, and agent management commands.
Learn how to execute tasks using the Embabel Agent Shell.
Execute a task from the shell:
embabel> execute "Find news about technology"
embabel> x "Summarize this article" # Short aliasControl execution behavior with flags:
# Show prompts sent to LLMs
embabel> x "Find news" -p
# Show debug information
embabel> x "Find news" -d
# Show LLM responses
embabel> x "Find news" -r
# Combine flags
embabel> x "Find news" -p -d -r
# Run in open mode (choose goal and use all helpful actions)
embabel> x "Find news" -o
# Use existing blackboard state
embabel> x "Find news" --state
# Add delays for debugging
embabel> x "Find news" --toolDelay --operationDelay
# Hide planning information
embabel> x "Find news" --showPlanning false| Short | Long | Description | Default |
|---|---|---|---|
-o | --open | Run in open mode | false |
-p | --showPrompts | Show prompts to LLMs | false |
-r | --showResponses | Show LLM responses | false |
-d | --debug | Show debug info | false |
-s | --state | Use existing blackboard | false |
-td | --toolDelay | Add tool call delays | false |
-od | --operationDelay | Add operation delays | false |
-P | --showPlanning | Show planning info | true |
Note: The -s flag conflicts with --showPlanning. Use long form flags (--state and --showPlanning) if you need both.
Execute tasks programmatically:
import com.embabel.agent.shell.ShellCommands
import com.embabel.agent.api.common.autonomy.Autonomy
@Component
class MyService(
private val shellCommands: ShellCommands
) {
fun executeTask(intent: String) {
val result = shellCommands.execute(
intent = intent,
open = false,
showPrompts = false,
showLlmResponses = false,
debug = false,
state = false,
toolDelay = false,
operationDelay = false,
showPlanning = true
)
println(result)
}
}For more control, use the Autonomy API:
import com.embabel.agent.api.common.autonomy.Autonomy
import com.embabel.agent.api.common.autonomy.AgentProcessExecution
import com.embabel.agent.api.common.autonomy.ProcessOptions
import com.embabel.agent.shell.TerminalServices
import org.springframework.stereotype.Component
@Component
class MyService(
private val autonomy: Autonomy,
private val terminalServices: TerminalServices,
private val agentPlatform: AgentPlatform
) {
fun executeWithCustomOptions(intent: String): AgentProcessExecution {
val processOptions = ProcessOptions(
open = false,
showPrompts = true,
showLlmResponses = false,
debug = false,
toolDelay = false,
operationDelay = false,
showPlanning = true,
blackboard = null
)
val goalSeeker = autonomy.createGoalSeeker(
intent = intent,
agentScope = agentPlatform,
goalChoiceApprover = terminalServices,
goalSelectionOptions = GoalSelectionOptions()
)
val outputChannel = terminalServices.outputChannel(agentPlatform)
return goalSeeker.achieve(
processOptions = processOptions,
outputChannel = outputChannel
)
}
}The blackboard stores state from previous operations:
# View current blackboard
embabel> blackboard
embabel> bb # Short alias
# Clear blackboard
embabel> clearUse --state flag to reuse the previous blackboard:
embabel> x "Find news about AI" -p
embabel> x "Summarize the results" --state # Reuses previous blackboardSee execution history:
embabel> runsOutput includes:
Configure default execution options:
# Set options for all subsequent executions
embabel> setOptions -p -d
# View current options
embabel> showOptionsThe setOptions command accepts the same flags as execute.
The shell handles these exceptions gracefully:
Errors are formatted as user-friendly messages:
embabel> x "impossible task"
Error: No goal found for intent: impossible taskWhen goal approval is required:
embabel> x "Find sensitive information"
Do you approve this goal: Search for sensitive data? (y/n): n
Error: Goal not approved by userExecution results include:
Agent Process Info (verbose mode):
User Request:
You asked: {original intent}Formatted Output:
Cost Information (verbose mode):
Tool Statistics (verbose mode):
Configure line length in application.yaml:
embabel:
agent:
shell:
lineLength: 120 # Default: 140Test goal selection without full execution:
embabel> chooseGoal "Find news about technology"This shows:
In open mode, the system:
embabel> x "Help me with my task" -oEnable all debug options:
embabel> x "Complex task" -p -r -d --toolDelay --operationDelayThis shows:
-p)-r)-d)tessl i tessl/maven-com-embabel-agent--embabel-agent-shell@0.3.0