NashTech Blog

Akka Agentic AI: Secret to Planning a Perfect Trip – Part 5

Table of Contents

Welcome back to our journey of Akka Agentic AI! The last blog, Akka Agentic AI: Secret to Planning a Perfect Trip – Part 4, provides a step-by-step guide to add a view via which a User can query all trip plans recommended by Akka AI Agents. This helped User to evaluate the plans and select the best one.

However, till now we have been telling Akka AI Agents (Weather Agent & Planning Agent) how to coordinate via a predefined workflow (PlanTripWorkflow). In a larger system there can be 10s/100s of AI agents, and it would be cumbersome to orchestrate them via a single workflow. A better approach would be to let the AI model come up with a plan consisting of – which agents to use and in which order to execute them to achieve the required goal.

This article will guide us on adding a Dynamic Plan, which will orchestrate multiple AI Agents and use a Workflow to execute the plan. It’s a 4-step process:

  1. Select Agents (select)
  2. Coordinate Selected Agents (coordinate)
  3. Execute Workflow (execute)
  4. Summarize Results (summarize)

1. Select Agents (select)

First step of a dynamic plan is selecting the required agents. An Agentic AI System can contain multiple AI Agents, but all might not be required to respond to a request. Hence, we need to add a SelectorAgent, which will generate a list of agents required for responding to a request.

In case you are wondering, the information about the AI agents in the AgentRegistry comes from the @ComponentId and @AgentDescription annotations. Hence, when generating a dynamic plan it becomes important that the agents define those descriptions. So, let’s add required descriptions to Weather & Planning agents.

Weather Agent Description

Planning Agent Description

Note: SelectorAgent will retrieve a subset of the agents with the role “worker“. Hence, we need to make sure that this role is defined in the @AgentDescription annotation of all agents.

2. Coordinate Selected Agents (coordinate)

After selecting the required agents, we need a CoordinatorAgent to help us in deciding the order in which the selected agents should be used. Also, how each agent should receive the request to perform its task.

Update Signature of Worker Agents

CoordinatorAgent will provide a list of steps in which the worker agents (Weather & Planning) will be called. But which agent will be called and in which order, is not known beforehand. Hence, all worker agents should have same signature.

Weather Agent Signature

Planning Agent Signature

3. Execute Plan (execute)

To execute the plan, the final orchestration is done by the PlanTripWorkflow. Since, SelectorAgent and CoordinatorAgent only selects the agents and put them in order, a workflow is required to connect them.

Note: In place of using ordinary method of ComponentClient, we are using dynamicCall of ComponentClient with the id of the agent. Because, when executing the plan and calling the agents we would know the id of the agent to call, but not the agent class. It can be the WeatherAgent or PlanningAgent. Also, this is the same reason why we had to update the method signatures of the AI agents in Step #2.

4. Summarize Results (summarize)

The last step of a dynamic plan is summarizing the results. For that we need a SummarizerAgent. It will help in creating a summary of the results from the selected agents.

Let’s Plan a Trip!

1. Set OpenAI API Key as environment variable

2. Start the service locally

3. Plan Trip

Conclusion

Dynamic planning (orchestration) in Akka Agentic AI is a 4 step process:

  1. Selection
  2. Coordination
  3. Execution
  4. Summarization

Selecting the required agents is done by the SelectorAgent. Then CoordinatorAgent puts the selected agents in an order. This order is then used by PlanTripWorkflow to execute it. At last the result of each agent is summarized by the SummarizerAgent.

Next Steps

Evaluation of AI Agents’ results is key to an enhanced User experience. Till now, trip plan(s) were being evaluated by the User. To make the application fully autonomous, a better approach would be to use an AI agent to evaluate the previous recommendation when the user preferences are changed or if new suggestions are created. We will explore this feature of Akka Agentic AI in our next blog, hence, stay tuned 🙂

Further Reading

Picture of Himanshu Gupta

Himanshu Gupta

Himanshu Gupta is a Principal Architect passionate about building scalable systems, AI‑driven solutions, and high‑impact digital platforms. He enjoys exploring emerging technologies, writing technical articles, and creating accelerators that help teams move faster. Outside of work, he focuses on continuous learning and sharing knowledge with the tech community.

Leave a Comment

Your email address will not be published. Required fields are marked *

Suggested Article

Scroll to Top