diff --git a/agentic-tutorial/src/main/java/_1_basic_agent/_1a_Basic_Agent_Example.java b/agentic-tutorial/src/main/java/_1_basic_agent/_1a_Basic_Agent_Example.java index 49c0210b..3e521a6b 100644 --- a/agentic-tutorial/src/main/java/_1_basic_agent/_1a_Basic_Agent_Example.java +++ b/agentic-tutorial/src/main/java/_1_basic_agent/_1a_Basic_Agent_Example.java @@ -37,7 +37,7 @@ public static void main(String[] args) throws IOException { CvGenerator cvGenerator = AgenticServices .agentBuilder(CvGenerator.class) .chatModel(CHAT_MODEL) - .outputName("masterCv") // we can optionally define the name of the output object + .outputKey("masterCv") // we can optionally define the key of the output object .build(); // 4. Load text file from resources/documents/user_life_story.txt diff --git a/agentic-tutorial/src/main/java/_2_sequential_workflow/_2a_Sequential_Agent_Example.java b/agentic-tutorial/src/main/java/_2_sequential_workflow/_2a_Sequential_Agent_Example.java index f0848f16..f7fa42ea 100644 --- a/agentic-tutorial/src/main/java/_2_sequential_workflow/_2a_Sequential_Agent_Example.java +++ b/agentic-tutorial/src/main/java/_2_sequential_workflow/_2a_Sequential_Agent_Example.java @@ -41,14 +41,14 @@ public static void main(String[] args) throws IOException { CvGenerator cvGenerator = AgenticServices .agentBuilder(CvGenerator.class) .chatModel(CHAT_MODEL) - .outputName("masterCv") // if you want to pass this variable from agent 1 to agent 2, - // then make sure the output name here matches the input variable name + .outputKey("masterCv") // if you want to pass this variable from agent 1 to agent 2, + // then make sure the output key here matches the input variable name // specified in the second agent interface agent_interfaces/CvTailor.java .build(); CvTailor cvTailor = AgenticServices .agentBuilder(CvTailor.class) .chatModel(CHAT_MODEL) // note that it is also possible to use a different model for a different agent - .outputName("tailoredCv") // we need to define the name of the output object + .outputKey("tailoredCv") // we need to define the key of the output object // if we would put "masterCv" here, the original master CV would be overwritten // by the second agent. In this case we don't want this, but it's a useful feature. .build(); @@ -59,7 +59,7 @@ public static void main(String[] args) throws IOException { UntypedAgent tailoredCvGenerator = AgenticServices // use UntypedAgent unless you define the resulting composed agent, see below .sequenceBuilder() .subAgents(cvGenerator, cvTailor) // this can be as many as you want, order matters - .outputName("tailoredCv") // this is the final output of the composed agent + .outputKey("tailoredCv") // this is the final output of the composed agent // note that you can use as output any field that is part of the AgenticScope // for example you could output 'masterCv' instead of tailoredCv (even if in this case that makes no sense) .build(); diff --git a/agentic-tutorial/src/main/java/_2_sequential_workflow/_2b_Sequential_Agent_Example_Typed.java b/agentic-tutorial/src/main/java/_2_sequential_workflow/_2b_Sequential_Agent_Example_Typed.java index 1c59f18f..61792914 100644 --- a/agentic-tutorial/src/main/java/_2_sequential_workflow/_2b_Sequential_Agent_Example_Typed.java +++ b/agentic-tutorial/src/main/java/_2_sequential_workflow/_2b_Sequential_Agent_Example_Typed.java @@ -42,14 +42,14 @@ public static void main(String[] args) throws IOException { CvGenerator cvGenerator = AgenticServices .agentBuilder(CvGenerator.class) .chatModel(CHAT_MODEL) - .outputName("masterCv") // if you want to pass this variable from agent 1 to agent 2, - // then make sure the output name here matches the input variable name + .outputKey("masterCv") // if you want to pass this variable from agent 1 to agent 2, + // then make sure the output key here matches the input variable name // specified in the second agent interface agent_interfaces/CvTailor.java .build(); CvTailor cvTailor = AgenticServices .agentBuilder(CvTailor.class) .chatModel(CHAT_MODEL) // note that it is also possible to use a different model for a different agent - .outputName("tailoredCv") // we need to define the name of the output object + .outputKey("tailoredCv") // we need to define the key of the output object // if we would put "masterCv" here, the original master CV would be overwritten // by the second agent. In this case we don't want this, but it's a useful feature. .build(); @@ -66,7 +66,7 @@ public static void main(String[] args) throws IOException { SequenceCvGenerator sequenceCvGenerator = AgenticServices .sequenceBuilder(SequenceCvGenerator.class) // here we specify the typed interface .subAgents(cvGenerator, cvTailor) - .outputName("bothCvsAndLifeStory") + .outputKey("bothCvsAndLifeStory") .output(agenticScope -> { // any method is possible, but we collect some internal variables. Map bothCvsAndLifeStory = Map.of( "lifeStory", agenticScope.readState("lifeStory", ""), diff --git a/agentic-tutorial/src/main/java/_3_loop_workflow/_3a_Loop_Agent_Example.java b/agentic-tutorial/src/main/java/_3_loop_workflow/_3a_Loop_Agent_Example.java index 7a6476a9..6700a0d5 100644 --- a/agentic-tutorial/src/main/java/_3_loop_workflow/_3a_Loop_Agent_Example.java +++ b/agentic-tutorial/src/main/java/_3_loop_workflow/_3a_Loop_Agent_Example.java @@ -38,17 +38,17 @@ public static void main(String[] args) throws IOException { // 3. Create all agents using AgenticServices CvReviewer cvReviewer = AgenticServices.agentBuilder(CvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("cvReview") // this gets updated in every iteration with new feedback for the next tailoring + .outputKey("cvReview") // this gets updated in every iteration with new feedback for the next tailoring .build(); ScoredCvTailor scoredCvTailor = AgenticServices.agentBuilder(ScoredCvTailor.class) .chatModel(CHAT_MODEL) - .outputName("cv") // this will be updated in every iteration, continuously improving the CV + .outputKey("cv") // this will be updated in every iteration, continuously improving the CV .build(); // 4. Build the sequence UntypedAgent reviewedCvGenerator = AgenticServices // use UntypedAgent unless you define the resulting composed agent, see _2_Sequential_Agent_Example .loopBuilder().subAgents(cvReviewer, scoredCvTailor) // this can be as many as you want, order matters - .outputName("cv") // this is the final output we want to observe (the improved CV) + .outputKey("cv") // this is the final output we want to observe (the improved CV) .exitCondition(agenticScope -> { CvReview review = (CvReview) agenticScope.readState("cvReview"); System.out.println("Checking exit condition with score=" + review.score); // we log intermediary scores diff --git a/agentic-tutorial/src/main/java/_3_loop_workflow/_3b_Loop_Agent_Example_States_And_Fail.java b/agentic-tutorial/src/main/java/_3_loop_workflow/_3b_Loop_Agent_Example_States_And_Fail.java index 32de3111..0d048401 100644 --- a/agentic-tutorial/src/main/java/_3_loop_workflow/_3b_Loop_Agent_Example_States_And_Fail.java +++ b/agentic-tutorial/src/main/java/_3_loop_workflow/_3b_Loop_Agent_Example_States_And_Fail.java @@ -36,11 +36,11 @@ public static void main(String[] args) throws IOException { // 1. Create all sub-agents (same as before) CvReviewer cvReviewer = AgenticServices.agentBuilder(CvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("cvReview") // this gets updated in every iteration with new feedback for the next tailoring + .outputKey("cvReview") // this gets updated in every iteration with new feedback for the next tailoring .build(); ScoredCvTailor scoredCvTailor = AgenticServices.agentBuilder(ScoredCvTailor.class) .chatModel(CHAT_MODEL) - .outputName("cv") // this will be updated in every iteration, continuously improving the CV + .outputKey("cv") // this will be updated in every iteration, continuously improving the CV .build(); // 2. Build the sequence and store the reviews on each exit condition check @@ -53,7 +53,7 @@ public static void main(String[] args) throws IOException { UntypedAgent reviewedCvGenerator = AgenticServices // use UntypedAgent unless you define the resulting composed agent, see below .loopBuilder().subAgents(cvReviewer, scoredCvTailor) // this can be as many as you want, order matters - .outputName("cvAndReview") // this is the final output we want to observe + .outputKey("cvAndReview") // this is the final output we want to observe .output(agenticScope -> { Map cvAndReview = Map.of( "cv", agenticScope.readState("cv"), diff --git a/agentic-tutorial/src/main/java/_4_parallel_workflow/_4_Parallel_Workflow_Example.java b/agentic-tutorial/src/main/java/_4_parallel_workflow/_4_Parallel_Workflow_Example.java index fa2efffc..6e4941da 100644 --- a/agentic-tutorial/src/main/java/_4_parallel_workflow/_4_Parallel_Workflow_Example.java +++ b/agentic-tutorial/src/main/java/_4_parallel_workflow/_4_Parallel_Workflow_Example.java @@ -43,17 +43,17 @@ public static void main(String[] args) throws IOException { // 3. Create all agents using AgenticServices HrCvReviewer hrCvReviewer = AgenticServices.agentBuilder(HrCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("hrReview") // this will be overwritten in every iteration, and also be used as the final output we want to observe + .outputKey("hrReview") // this will be overwritten in every iteration, and also be used as the final output we want to observe .build(); ManagerCvReviewer managerCvReviewer = AgenticServices.agentBuilder(ManagerCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("managerReview") // this overwrites the original input instructions, and is overwritten in every iteration and used as new instructions for the CvTailor + .outputKey("managerReview") // this overwrites the original input instructions, and is overwritten in every iteration and used as new instructions for the CvTailor .build(); TeamMemberCvReviewer teamMemberCvReviewer = AgenticServices.agentBuilder(TeamMemberCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("teamMemberReview") // this overwrites the original input instructions, and is overwritten in every iteration and used as new instructions for the CvTailor + .outputKey("teamMemberReview") // this overwrites the original input instructions, and is overwritten in every iteration and used as new instructions for the CvTailor .build(); // 4. Build the sequence @@ -63,7 +63,7 @@ public static void main(String[] args) throws IOException { .parallelBuilder() .subAgents(hrCvReviewer, managerCvReviewer, teamMemberCvReviewer) // this can be as many as you want .executor(executor) // optional, by default an internal cached thread pool is used which will automatically shut down after execution is completed - .outputName("fullCvReview") // this is the final output we want to observe + .outputKey("fullCvReview") // this is the final output we want to observe .output(agenticScope -> { // read the outputs of each reviewer from the agentic scope CvReview hrReview = (CvReview) agenticScope.readState("hrReview"); diff --git a/agentic-tutorial/src/main/java/_5_conditional_workflow/EmailAssistant.java b/agentic-tutorial/src/main/java/_5_conditional_workflow/EmailAssistant.java index d0ab80ef..fbd69f24 100644 --- a/agentic-tutorial/src/main/java/_5_conditional_workflow/EmailAssistant.java +++ b/agentic-tutorial/src/main/java/_5_conditional_workflow/EmailAssistant.java @@ -7,7 +7,7 @@ public interface EmailAssistant { - @Agent("Sends rejection emails to candidates that didn't pass") + @Agent("Sends rejection emails to candidates that didn't pass, returns the sent email ID or 0 if no email could be sent") @SystemMessage(""" You send a kind email to application candidates that did not pass the first review round. You also update the application status to 'rejected'. diff --git a/agentic-tutorial/src/main/java/_5_conditional_workflow/_5b_Conditional_Workflow_Example_Async.java b/agentic-tutorial/src/main/java/_5_conditional_workflow/_5b_Conditional_Workflow_Example_Async.java index 0a9b40b2..0a401ea8 100644 --- a/agentic-tutorial/src/main/java/_5_conditional_workflow/_5b_Conditional_Workflow_Example_Async.java +++ b/agentic-tutorial/src/main/java/_5_conditional_workflow/_5b_Conditional_Workflow_Example_Async.java @@ -35,19 +35,19 @@ public static void main(String[] args) throws IOException { ManagerCvReviewer managerCvReviewer = AgenticServices.agentBuilder(ManagerCvReviewer.class) .chatModel(CHAT_MODEL) .async(true) // async agent - .outputName("managerReview") + .outputKey("managerReview") .build(); EmailAssistant emailAssistant = AgenticServices.agentBuilder(EmailAssistant.class) .chatModel(CHAT_MODEL) .async(true) .tools(new OrganizingTools()) - .outputName("sentEmailId") + .outputKey("sentEmailId") .build(); InfoRequester infoRequester = AgenticServices.agentBuilder(InfoRequester.class) .chatModel(CHAT_MODEL) .async(true) .tools(new OrganizingTools()) - .outputName("sentEmailId") + .outputKey("sentEmailId") .build(); // 2. Build async conditional workflow diff --git a/agentic-tutorial/src/main/java/_6_composed_workflow/_6_Composed_Workflow_Example.java b/agentic-tutorial/src/main/java/_6_composed_workflow/_6_Composed_Workflow_Example.java index 8e8b9f04..74c2f60c 100644 --- a/agentic-tutorial/src/main/java/_6_composed_workflow/_6_Composed_Workflow_Example.java +++ b/agentic-tutorial/src/main/java/_6_composed_workflow/_6_Composed_Workflow_Example.java @@ -51,26 +51,26 @@ public static void main(String[] args) throws IOException { CvGenerator cvGenerator = AgenticServices .agentBuilder(CvGenerator.class) .chatModel(CHAT_MODEL) - .outputName("cv") + .outputKey("cv") .build(); ScoredCvTailor scoredCvTailor = AgenticServices .agentBuilder(ScoredCvTailor.class) .chatModel(CHAT_MODEL) - .outputName("cv") + .outputKey("cv") .build(); CvReviewer cvReviewer = AgenticServices .agentBuilder(CvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("cvReview") + .outputKey("cvReview") .build(); // 2. Create the loop workflow for CV improvement UntypedAgent cvImprovementLoop = AgenticServices .loopBuilder() .subAgents(scoredCvTailor, cvReviewer) - .outputName("cv") + .outputKey("cv") .exitCondition(agenticScope -> { CvReview review = (CvReview) agenticScope.readState("cvReview"); System.out.println("CV Review Score: " + review.score); @@ -87,7 +87,7 @@ public static void main(String[] args) throws IOException { .subAgents(cvGenerator, cvReviewer, cvImprovementLoop) // here we use the composed agent cvImprovementLoop inside the sequenceBuilder // we also need the cvReviewer in order to generate a first review before entering the loop - .outputName("cv") + .outputKey("cv") .build(); // 4. Load input data @@ -112,19 +112,19 @@ public static void main(String[] args) throws IOException { HrCvReviewer hrCvReviewer = AgenticServices .agentBuilder(HrCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("hrReview") + .outputKey("hrReview") .build(); ManagerCvReviewer managerCvReviewer = AgenticServices .agentBuilder(ManagerCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("managerReview") + .outputKey("managerReview") .build(); TeamMemberCvReviewer teamMemberCvReviewer = AgenticServices .agentBuilder(TeamMemberCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("teamMemberReview") + .outputKey("teamMemberReview") .build(); EmailAssistant emailAssistant = AgenticServices @@ -144,7 +144,7 @@ public static void main(String[] args) throws IOException { .parallelBuilder() .subAgents(hrCvReviewer, managerCvReviewer, teamMemberCvReviewer) .executor(Executors.newFixedThreadPool(3)) - .outputName("combinedCvReview") + .outputKey("combinedCvReview") .output(agenticScope -> { CvReview hrReview = (CvReview) agenticScope.readState("hrReview"); CvReview managerReview = (CvReview) agenticScope.readState("managerReview"); diff --git a/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7a_Supervisor_Orchestration.java b/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7a_Supervisor_Orchestration.java index c5c8ca53..e6140e48 100644 --- a/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7a_Supervisor_Orchestration.java +++ b/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7a_Supervisor_Orchestration.java @@ -44,7 +44,7 @@ public static void main(String[] args) throws IOException { // 1. Define all sub-agents HrCvReviewer hrReviewer = AgenticServices.agentBuilder(HrCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("hrReview") + .outputKey("hrReview") .build(); // importantly, if we use the same method names for multiple agents // (in this case: 'reviewCv' for all reviewers) we best name our agents, like this: @@ -52,12 +52,12 @@ public static void main(String[] args) throws IOException { ManagerCvReviewer managerReviewer = AgenticServices.agentBuilder(ManagerCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("managerReview") + .outputKey("managerReview") .build(); TeamMemberCvReviewer teamReviewer = AgenticServices.agentBuilder(TeamMemberCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("teamMemberReview") + .outputKey("teamMemberReview") .build(); InterviewOrganizer interviewOrganizer = AgenticServices.agentBuilder(InterviewOrganizer.class) diff --git a/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7b_Supervisor_Orchestration_Advanced.java b/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7b_Supervisor_Orchestration_Advanced.java index 079b309e..27aa90c8 100644 --- a/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7b_Supervisor_Orchestration_Advanced.java +++ b/agentic-tutorial/src/main/java/_7_supervisor_orchestration/_7b_Supervisor_Orchestration_Advanced.java @@ -54,12 +54,12 @@ public static void main(String[] args) throws IOException { InterviewOrganizer interviewOrganizer = AgenticServices.agentBuilder(InterviewOrganizer.class) .chatModel(CHAT_MODEL) .tools(new OrganizingTools()) - .outputName("response") + .outputKey("response") .build(); EmailAssistant emailAssistant = AgenticServices.agentBuilder(EmailAssistant.class) .chatModel(CHAT_MODEL) .tools(new OrganizingTools()) - .outputName("response") + .outputKey("response") .build(); // 2. Build supervisor diff --git a/agentic-tutorial/src/main/java/_8_non_ai_agents/ScoreAggregator.java b/agentic-tutorial/src/main/java/_8_non_ai_agents/ScoreAggregator.java index 70691a70..58a7787b 100644 --- a/agentic-tutorial/src/main/java/_8_non_ai_agents/ScoreAggregator.java +++ b/agentic-tutorial/src/main/java/_8_non_ai_agents/ScoreAggregator.java @@ -11,7 +11,7 @@ */ public class ScoreAggregator { - @Agent(description = "Aggregates HR/Manager/Team reviews into a combined review", outputName = "combinedCvReview") + @Agent(description = "Aggregates HR/Manager/Team reviews into a combined review", outputKey = "combinedCvReview") public CvReview aggregate(@V("hrReview") CvReview hr, @V("managerReview") CvReview mgr, @V("teamMemberReview") CvReview team) { diff --git a/agentic-tutorial/src/main/java/_8_non_ai_agents/_8_Non_AI_Agents.java b/agentic-tutorial/src/main/java/_8_non_ai_agents/_8_Non_AI_Agents.java index 16485429..360d9624 100644 --- a/agentic-tutorial/src/main/java/_8_non_ai_agents/_8_Non_AI_Agents.java +++ b/agentic-tutorial/src/main/java/_8_non_ai_agents/_8_Non_AI_Agents.java @@ -48,17 +48,17 @@ public static void main(String[] args) throws IOException { // 2. Build the AI sub-agents for the parallel review step HrCvReviewer hrReviewer = AgenticServices.agentBuilder(HrCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("hrReview") + .outputKey("hrReview") .build(); ManagerCvReviewer managerReviewer = AgenticServices.agentBuilder(ManagerCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("managerReview") + .outputKey("managerReview") .build(); TeamMemberCvReviewer teamReviewer = AgenticServices.agentBuilder(TeamMemberCvReviewer.class) .chatModel(CHAT_MODEL) - .outputName("teamMemberReview") + .outputKey("teamMemberReview") .build(); // 3. Build the composed parallel agent @@ -75,14 +75,14 @@ public static void main(String[] args) throws IOException { .sequenceBuilder() .subAgents( parallelReviewWorkflow, - new ScoreAggregator(), // no AgenticServices builder needed for non-AI agents. outputname 'combinedCvReview' is defined in the class + new ScoreAggregator(), // no AgenticServices builder needed for non-AI agents. outputKey 'combinedCvReview' is defined in the class new StatusUpdate(), // takes 'combinedCvReview' as input, no output needed AgenticServices.agentAction(agenticScope -> { // another way to add non-AI agents that can operate on the AgenticScope CvReview review = (CvReview) agenticScope.readState("combinedCvReview"); agenticScope.writeState("scoreAsPercentage", review.score * 100); // when agents from different systems communicate, output conversion is often needed }) ) - .outputName("scoreAsPercentage") // outputName defined on the non-AI agent annotation in ScoreAggregator.java + .outputKey("scoreAsPercentage") // outputKey defined on the non-AI agent annotation in ScoreAggregator.java .build(); // 5. Load input data diff --git a/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9a_HumanInTheLoop_Simple_Validator.java b/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9a_HumanInTheLoop_Simple_Validator.java index fbb86103..64c4436f 100644 --- a/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9a_HumanInTheLoop_Simple_Validator.java +++ b/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9a_HumanInTheLoop_Simple_Validator.java @@ -24,14 +24,14 @@ public static void main(String[] args) { // 3. Create involved agents HiringDecisionProposer decisionProposer = AgenticServices.agentBuilder(HiringDecisionProposer.class) .chatModel(CHAT_MODEL) - .outputName("modelDecision") + .outputKey("modelDecision") .build(); // 2. Define human in the loop for validation HumanInTheLoop humanValidator = AgenticServices.humanInTheLoopBuilder() .description("validates the model's proposed hiring decision") - .inputName("modelDecision") - .outputName("finalDecision") // checked by human + .inputKey("modelDecision") + .outputKey("finalDecision") // checked by human .requestWriter(request -> { System.out.println("AI hiring assistant suggests: " + request); System.out.println("Please confirm the final decision."); @@ -44,7 +44,7 @@ public static void main(String[] args) { // 3. Chain agents into a workflow UntypedAgent hiringDecisionWorkflow = AgenticServices.sequenceBuilder() .subAgents(decisionProposer, humanValidator) - .outputName("finalDecision") + .outputKey("finalDecision") .build(); // 4. Prepare input arguments diff --git a/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9b_HumanInTheLoop_Chatbot_With_Memory.java b/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9b_HumanInTheLoop_Chatbot_With_Memory.java index d0db500e..ceb59116 100644 --- a/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9b_HumanInTheLoop_Chatbot_With_Memory.java +++ b/agentic-tutorial/src/main/java/_9_human_in_the_loop/_9b_HumanInTheLoop_Chatbot_With_Memory.java @@ -36,7 +36,7 @@ public static void main(String[] args) { .agentBuilder(MeetingProposer.class) .chatModel(CHAT_MODEL) .chatMemoryProvider(memoryId -> MessageWindowChatMemory.withMaxMessages(15)) // so the agent remembers what he proposed already - .outputName("proposal") + .outputKey("proposal") .build(); // 2. Add an AiService to judge if a decision has been reached (this can be a tiny local model because the assignment is so simple) @@ -46,8 +46,8 @@ public static void main(String[] args) { HumanInTheLoop humanInTheLoop = AgenticServices .humanInTheLoopBuilder() .description("agent that asks input from the user") - .outputName("candidateAnswer") // matches one of the proposer's input variable names - .inputName("proposal") // must match the output of the proposer agent + .outputKey("candidateAnswer") // matches one of the proposer's input variable names + .inputKey("proposal") // must match the output of the proposer agent .requestWriter(request -> { System.out.println(request); System.out.print("> "); @@ -66,7 +66,7 @@ public static void main(String[] args) { "proposal", agenticScope.readState("proposal"), "candidateAnswer", agenticScope.readState("candidateAnswer") )) - .outputName("proposalAndAnswer") + .outputKey("proposalAndAnswer") // this output contains the last date proposal + candidate's answer, which should be sufficient info for a followup agent to schedule the meeting (or abort trying) .build(); @@ -79,7 +79,7 @@ public static void main(String[] args) { String proposal = (String) scope.readState("proposal"); return response != null && decisionService.isDecisionReached(proposal, response); }) - .outputName("proposalAndAnswer") + .outputKey("proposalAndAnswer") .maxIterations(5) .build(); diff --git a/gpullama3.java-example/src/main/java/agentic/_1_basic_agent/GPULlama3_1a_Basic_Agent_Example.java b/gpullama3.java-example/src/main/java/agentic/_1_basic_agent/GPULlama3_1a_Basic_Agent_Example.java index 7e75b17f..dc03ca9f 100644 --- a/gpullama3.java-example/src/main/java/agentic/_1_basic_agent/GPULlama3_1a_Basic_Agent_Example.java +++ b/gpullama3.java-example/src/main/java/agentic/_1_basic_agent/GPULlama3_1a_Basic_Agent_Example.java @@ -47,7 +47,7 @@ public static void main(String[] args) throws IOException { CvGenerator cvGenerator = AgenticServices .agentBuilder(CvGenerator.class) .chatModel(CHAT_MODEL) - .outputName("masterCv") // we can optionally define the name of the output object + .outputKey("masterCv") // we can optionally define the key of the output object .build(); // 4. Load text file from resources/documents/user_life_story.txt diff --git a/gpullama3.java-example/src/main/java/agentic/_2_sequential_workflow/GPULlama3_2a_Sequential_Agent_Example.java b/gpullama3.java-example/src/main/java/agentic/_2_sequential_workflow/GPULlama3_2a_Sequential_Agent_Example.java index d104741c..304e7033 100644 --- a/gpullama3.java-example/src/main/java/agentic/_2_sequential_workflow/GPULlama3_2a_Sequential_Agent_Example.java +++ b/gpullama3.java-example/src/main/java/agentic/_2_sequential_workflow/GPULlama3_2a_Sequential_Agent_Example.java @@ -34,14 +34,14 @@ public static void main(String[] args) throws IOException { CvGenerator cvGenerator = AgenticServices .agentBuilder(CvGenerator.class) .chatModel(CHAT_MODEL) - .outputName("masterCv") // if you want to pass this variable from agent 1 to agent 2, - // then make sure the output name here matches the input variable name + .outputKey("masterCv") // if you want to pass this variable from agent 1 to agent 2, + // then make sure the output key here matches the input variable name // specified in the second agent interface agent_interfaces/CvTailor.java .build(); CvTailor cvTailor = AgenticServices .agentBuilder(CvTailor.class) .chatModel(CHAT_MODEL) // note that it is also possible to use a different model for a different agent - .outputName("tailoredCv") // we need to define the name of the output object + .outputKey("tailoredCv") // we need to define the key of the output object // if we would put "masterCv" here, the original master CV would be overwritten // by the second agent. In this case we don't want this, but it's a useful feature. .build(); @@ -52,7 +52,7 @@ public static void main(String[] args) throws IOException { UntypedAgent tailoredCvGenerator = AgenticServices // use UntypedAgent unless you define the resulting composed agent, see below .sequenceBuilder() .subAgents(cvGenerator, cvTailor) // this can be as many as you want, order matters - .outputName("tailoredCv") // this is the final output of the composed agent + .outputKey("tailoredCv") // this is the final output of the composed agent // note that you can use as output any field that is part of the AgenticScope // for example you could output 'masterCv' instead of tailoredCv (even if in this case that makes no sense) .build();