File tree Expand file tree Collapse file tree
src/main/java/org/soujava/samples/ai/patterns/planning Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import jakarta .enterprise .inject .se .SeContainer ;
44import jakarta .enterprise .inject .se .SeContainerInitializer ;
55
6+ import java .util .logging .Logger ;
7+
68public class AgentMain {
79
10+ private static final Logger LOGGER = Logger .getLogger (AgentMain .class .getName ());
11+
812 public static void main (String [] args ) {
9- // Spin up the CDI container in a standard Java SE application
13+ LOGGER . info ( "Starting Customer Resolution Agent..." );
1014 try (SeContainer container = SeContainerInitializer .newInstance ().initialize ()) {
1115
1216 // Fetch the Orchestrator Factory
1317 ResolutionAgentFactory factory = container .select (ResolutionAgentFactory .class ).get ();
1418 var setupService = container .select (SetupService .class ).get ();
19+ LOGGER .info ("Initializing data for user" );
1520 setupService .initializeData ("alice@test.com" );
1621 CustomerResolutionAgent agent = factory .createAgent ();
17-
18- System .out .println ("User: Hi, my email is alice@test.com. Please cancel my current order." );
22+ var prompt = "User: Hi, my email is alice@test.com. Please cancel my current order." ;
23+ LOGGER .info ("Starting conversation with user: " + prompt );
24+ System .out .println ();
1925
2026 // The ReAct loop happens automatically inside this method call!
21- String response = agent .resolveIssue ("Hi, my email is alice@test.com. Please cancel my current order." );
22-
23- System .out .println ("Agent: " + response );
27+ String response = agent .resolveIssue (prompt );
28+ LOGGER .info ("Conversation ended with user: " + response );
2429 }
2530 }
2631}
You can’t perform that action at this time.
0 commit comments