How Does LLM and Agents interact with External World?

As AI Agents is gaining serious traction to make artificial intelligence not just responsive, but autonomous and proactive, this kind of questions became more frequent between developers and executives.

To help anyone diving into the world of AI Agents, here is a quick tutorial of the most important feature you must understand to connect Agents with external world: Tools, also known as Function Calls.

What are Tools (Function Calls)?

In the context of AI Agents, Tools are external functions or APIs that the agent can “call” to perform specific tasks. Think of them as skills the agent can activate when needed. They’re NOT built into the model itself, but are instead defined by the developer and exposed to the agent.

For example:

  • A calculator function
  • A file reader
  • A web search API
  • A custom business logic function

These Tools allow the agent to go beyond text generation and interact with the world in real-time.

How Does It Work?

The figure below illustrates how the Tools/Function Call process works with LLMs:

Step 1: Define Your Tools

Tools are defined essentially by:

  • A name
  • A description (what it does, so AI can understand when to use it)
  • A schema of expected inputs

In the example, suppose we have the following Tools:

  • searchOnInternet: Given a search query, it’ll make a search on the Web, and return a list of titles and descriptions from the Internet.
  • addNumbers: Given two numbers, it’ll return sum the numbers and return the result.

Step 2: Merge User Prompt with Tools

When USER asks for “Summary of the latest news”. Before sending any message to the LLM, our application adds the available Tools to the prompt. Like the example below:

Step 3: Let LLM Decide

With the prompt above, we do let LLM know the available Tools, and infer the best answer for the USER prompt. Which in this case, might be asking to call searchOnInternet function with the query “letest+news” to have more context. The response looks like:

Step 4: Execute the Tool and Send Result

With the “tool_call” in the LLM response, your application should parse the arguments and execute the requested Tool (searchOnInternet). After executing the Tool, the application should send the conversation history with the result to the LLM again.

Step 5: LLM Final Answer

Now, with the conversation history, and the result of the Tool call, if LLM understand it has enough context to answer the USER request, it will generate then the final response:

Implementing it With Langchain4J

Implementing all these steps from scratch can be cumbersome. Fortunately, you can use libraries like Langchain4J to handle the details and streamline the process. Here is a simple implementation for the example:

Conclusion

Tools (Function Calls) are the bridge between the language model’s intelligence and real-world utility, and understanding how it works before diving into the world of Agents and Agentic AI, is crucial. Without tools, an agent is just a chatbot. With tools, it becomes a powerful, proactive assistant capable of taking meaningful actions on your behalf.

Now that you understand how the process works under the hood, it’s easier to see why solutions like Anthropic’s Model Context Protocol (MCP) are gaining traction. In the enterprise world, you wouldn’t want to redefine tool descriptions for every system you integrate with. Having a standard improves maintainability and reusability. But let’s save that topic for the next article.

If you’d like to see more examples using Java and Langchain4J,, I’ve published a repository with runnable samples on my Github. Feel free to check it out—and if you find it helpful, consider giving it a star! 😊

What has been your biggest challenges when implementing AI Agents? I’m excited to hear your stories and insights in the comments below!

3 Common Mistakes When Working with LLM Projects

As LLMs and AI agents become mainstream tools in enterprise environments, more organizations are rushing to integrate these technologies into their operational pipelines. However, teams discover too late that implementing LLM solutions requires more than just purchasing an API key and making a few calls. Here are three critical mistakes to avoid:

1. Not Having Clear Scope

Teams often approach LLM implementations with vague objectives like “improve customer service” or “enhance document processing and querying”. This lack of specificity leads to vague objectives, wasted resources, and ultimately, disappointing outcomes.

What happens: Without clear scope boundaries, teams chase endless possibilities rather than focusing on concrete deliverables. The project expands beyond initial timelines and budgets as stakeholders continuously discover new use cases.

Better approach: Define specific, measurable objectives from the start. Establish clear success criteria, identify exactly which business processes will be affected, and determine precise and expected inputs and outputs for your LLM solution.

2. Underestimating Prompting Effort

Many teams assume that interacting with LLMs is as simple as asking questions in plain English. They drastically underestimate the expertise, time, and iteration required to develop effective prompts that produce reliable, high-quality outputs.

What happens: Initial prompts produce inconsistent or low-quality results. Teams discover they need specialized skills to develop robust prompt engineering systems, and what seemed like a quick implementation turns into months of refinement.

Better approach: Budget time and resources specifically for prompt engineering. Consider it a critical component of your project that requires dedicated expertise. Plan for multiple iterations and continuous improvement of your prompting strategy.

3. Expecting No Data Preparation Needed

Perhaps the most pervasive misconception is that LLMs eliminate the need for data preparation. Project leaders often assume these models can seamlessly process raw, unstructured data with no preprocessing.

What happens: The LLM produces poor results when fed disorganized inputs. Teams discover too late that they still need data cleaning pipelines, formatting standards, and quality control mechanisms. Combined with a lack of clear scope, this leads to endless experimentation cycles where teams chase better results without addressing the fundamental data issues.

Better approach: Invest in proper data preparation workflows. Standardize your input formats, implement data cleaning processes, and create validation steps to ensure the LLM receives high-quality inputs consistently.

Conclusion

Successful LLM implementations aren’t about having the most powerful models or the latest technology—they’re about the fundamentals: clear scope definition, thoughtful prompt engineering, and diligent data preparation. These three elements can make the difference between a transformative AI solution and a costly disappointment.

These lessons came directly from my experience working on multiple real-world projects integrating LLMs into existing workflows. In each case, I observed how addressing these common mistakes earlier would have saved countless hours of frustration and significantly improved our return on AI investment.

What has your experience been with LLM implementations? Have you encountered different challenges when building solutions in real-world settings? The landscape of AI application is constantly evolving, and sharing our collective experiences can help everyone build better solutions. I’d love to hear your stories and insights in the comments below!

The Future of AI for Developers: Rethinking Productivity and Competition



Recently, I had the honor to be invited and discuss the future of AI for developers in the Red Hat DevNation SP event. Being surrounded by brilliant minds shaped my perspective on this topic, which has been widely debated since the launch of ChatGPT and the subsequent boom in generative AI.

The Productivity Fallacy

Global leaders and consultants are captivated by the promise that AI can maintain or even boost productivity while reducing workforce size, immediately connecting with cost reduction and business profit margin improvement.

While this potential exists, it overlooks a critical reality: AI capabilities are equally accessible to all competitors.

The Flaw in Static Mindset

The current AI boom mirrors the digital revolution: its disruptive potential extends across industries, with widespread accessibility and adoption becoming the norm.

Assuming competitors will remain passive in adopting AI is a strategic blind spot. In this rapidly evolving landscape, traditional performance benchmarks quickly become obsolete.

Embracing Growth in the AI Era

To stay competitive, business owners must shift their focus from maintaining current productivity levels to pursuing growth with AI—both vertically and horizontally.

Vertical growth involves enhancing existing operations by:

  • Equipping teams with AI assistants
  • Training staff in effective AI prompting
  • Selecting appropriate AI solutions for specific challenges

Meanwhile, horizontal growth focus on expanding business opportunities by:

  • Generating new content and insights
  • Revieweing and automating workflows
  • Processing natural language data

Those who embrace a growth-oriented mindset are better equipped to navigate emerging market dynamics and seize new opportunities with the potential of AI.

Conclusion

In conclusion, the integration of AI into business processes isn’t just about maintaining the status quo with fewer resources. It’s an opportunity to redefine productivity, explore new avenues for growth, and stay ahead in an increasingly dynamic and competitive market.

Thoughtworks TechRadar brings AI

A few weeks ago, I held an amazing workshop on AI for software engineers eager to learn the fundamentals and create their first application integrated with AI models!

AI became an intrinsic topic in the tech world and can be overwhelming to keep updated.

It’s beneficial to rely on summaries that highlight key topics, which is why I regularly consult Thoughtworks Tech Radar for invaluable insights.

And what is interesting, they already added some topics on AI in the latest version released this month (April)!

I gave special attention to the topics below 🙂

  • Retrieval Augmented Generation: I’ve covered RAG on my workshop and it proved to become the preferred pattern to improve the quality of LLM responses
  • LLM-powered Autonomous Agents: LLM agents allow those models to perform a variety of human-language based tasks.
  • LiteLLM: We don’t have a de facto framework to work with AI models yet. I’ve been using Langchain for popularity, but worth keeping track of other options.
  • Nemo-Guadrails: One of the major challenges in deploying AI solutions is ensuring safety measures and addressing unforeseen behaviors. It’s good to see the advances over this topic to enable production ready solutions.

You can check the complete radar here!

How about you? What are your favorite topics on the radar? 🙂

Exploring the Essentials of LLM-Powered Java Applications

The integration of Large Language Models (LLMs) into Java applications is a major leap forward in the field of software development. These models open up new possibilities for automating and enhancing tasks through natural language understanding and generation.

To effectively utilize these capabilities, one must grasp several key concepts I’ve highlighted in the following video recorded with formidable people at Jacksonville JUG meetup!

Source Code used in this presentation can be found on the GitHub repo here.

Fundamental Concepts for LLM

Decoding Models in Java Applications

Central to LLM-powered applications are the models themselves. These Large Language Models, like OpenAI’s GPT and Google’s Gemini, are advanced AI tools to process and generate natural language. In Java applications, these models can significantly extend functionalities, from text generation to complex query handling. Selecting the right model is critical, as it defines your application’s scope and capabilities.

The Significance of Prompts

Prompts serve as the primary mode of communication between your Java application and the LLM. They are instructions or queries that guide the model in producing the desired output. For instance, prompts can be creatively designed to craft narratives or answer specific questions. Their adaptability is a key strength, allowing for diverse applications ranging from creative writing assistance to technical problem-solving.

Navigating Memory Management in Java Applications with LLMs

Handling memory in LLMs is not like some people may think. These models are stateless, so they essentially don’t store or “learn” anything new from previous prompt. To maintains a conversational history, we must send the conversation history with the new prompt, preserving the context of interactions. This is what leads to a relevant and coherent responses from the LLM.

Enhancing Functionality with Retrieval Augmented Generation

Retrieval Augmented Generation (RAG) elevates the capabilities of your application by enabling the LLM to access and incorporate external information. This method is particularly beneficial for circumventing token limitations and for specializing the model in certain knowledge areas. RAG involves extracting relevant data from external sources to inform the LLM’s responses, ensuring accuracy and depth in the output.

The Role of Agents in Java Applications with LLMs

Agents in this context refer to mechanisms that delegate specific tasks to be called by the model. This setup enables complex functionalities within the Java application, allowing the LLM to perform intricate tasks by interacting with predefined functions. This concept showcases the versatility of LLMs in handling diverse and complex tasks within a Java environment.

Conclusion

Embarking on the development of a Java application powered by a Large Language Model is an exciting and promising endeavor. By understanding the nuances of Models, Prompts, Memory, Retrieval Augmented Generation, and Agents, developers can fully harness the capabilities of LLMs. As this technology continues to evolve, keeping up with these foundational concepts will be crucial for creating innovative and efficient Java applications.

For those looking to delve deeper into the world of LLM-powered Java applications, I hope you have enjoyed the video and content! Whether you are a seasoned developer or just starting out, the journey into the realm of LLMs in Java applications is both fascinating and rewarding.

Tiny Tips: Build and export results with Docker

Hello and welcome to our tiny tip of the day!

I wish to build an experimental standalone binary app in controlled environment and just pull out the results on my machine, so I can avoid installing all the build dependencies.

Shouldn’t Docker help me with such thing? And sure it DOES xD!

I’ve mainly used Docker to create runnable images with web applications exposing their ports, so this was new for me! I hope you find it simple and useful too!

1. Create your build Dockerfile as usual and then add a scratch images to expose only the result files:

# Dockerfile with conventional Java Application build with Gradle
FROM eclipse-temurin:17-jdk-jammy as build

WORKDIR /app

COPY build.gradle .
COPY gradlew .
COPY settings.gradle .
COPY gradle/ ./gradle
COPY src/ ./src

RUN ./gradlew build

# Expose /build content 
FROM scratch AS binaries
COPY --from=build /app/build /

scratch is the minimal image used to create base images in Docker

2. Build image with output and target params

In your preferred terminal, navigate at your Dockerfile directory and run the following command:

docker build --output=<OUTPUT_PATH> --target=<TARGET_NAME> .

TARGET_NAME: the instruction name inside your Dockerfile where you’ve placed the result files.

OUTPUT_PATH: the path on your machine to where you want to copy the result files

For the Dockerfile sample above, run the following command to get the output in the ./bin folder:

And… Dekiagari (Voila)!

Check the ./bin folder created with all the generated resources resulting from the build action.

Read the complete documentation from official Docker website here 🙂

Hope you find it useful! You can fund the sample code in my repository here. Have a nice coding day!

4 Great Architects to Follow [2]

In this post, I’m sharing some famous Software Architects that you probably heard of before, and I’m sure you’re using some of their content or tools on your project 🙂

Robert C. Martin

The Clean series author, also known as Uncle Bob. Robert Cecil Martin heavily contributed to the software development industry helping innumerable developers around the world to become better professionals by spreading best practices and architecture patterns.

Father of SOLID principle and author of Clean Code and Clean Architecture, Uncle Bob keeps lecturing professional developers to improve their coding skills and shares his thoughts on social media.

Martin Fowler

Martin Fowler is an unparalleled reference in Software Architecture topics. Author of popular titles such as Refactoring and Enterprise Application Architectures, Martin keeps his blog updated with modern challenges and solutions to make development routine easier and help build useful software.

One of my favorite content from Martin is Who Needs An Architect where he starts a journey to define Software Architecture with many other big names in the industry.

Simon Brown

Simon Brown is a renowned speaker and content creator, and his biggest contribution to the development community is the widely adopted C4 software architecture model.

The C4 model is an easy-to-learn, developer-friendly approach to creating software architecture diagrams, which helps explore a set of hierarchical abstractions of a solution architecture (software systems, containers, components, and code).

If you need to create consistent and clear solution architectural diagrams, I do totally recommend going through the C4 model to help you!

Sam Newman

Sam Newman is a definitive reference if you want to go deeper into Microservices! He is an author, speaker, and independent consultant specializing in cloud, continuous delivery, and microservices.

Author of Building Microservices and Monolith to Microservices, with the revamp of so many web applications to distributed architectures, it’s a great and reliable source to guide your tradeoffs with confidence.

That’s it! Hope you enjoy those guys contents! Did you know them? Have I missed some one from your list? Share your references!

Making Tough Architectural Decisions

What experienced Software Architects do to make Tough Architectural Decisions in their projects?

During a meeting with experienced Architects friends, I’ve shared a difficult challenge I was facing at my work!

That driven our discussion to think about approaches we do follow to help us decide things that can have big impact and costly consequences in our projects.

Here are the four best tips and practices highlighted from our discussion:

Focus on real problem

Discussing architectures for complex problem is stressful and can become extensive. During the design process is very common to get hyped with many solutions and lose focus on the real problem.

Invest time to state the real problems you need to solve in a clear and visible way for you and your team, and revisit it frequently to stay close to your goals.

Create Proof of Concepts

Architectural patterns are solution blueprint and should be used as a reference only. There are no silver bullets, and a great way to get rid of hidden challenges is to create small Proof of Concepts to validate ideas.

Don’t be shy and create as many disposable samples as you can just to stress out potential solutions. You’ll be surprised, in a good way, how many things you haven’t covered before going through a practical exercise.

Tradeoff with involved parts

Not every tradeoff is about technology aspects. In a project, many other roles needs to contribute to have balanced weights when deciding the directions to follow.

The Managers, Product Owners, End Users, Stakeholders and also Developers, each of them can contribute with their perspectives and concerns to better drive your solution architecture.

Make sure to write documents such as Architecture Decision Records, to capture important architectural decisions made along with its context and consequences.

Think together

It’s good to have time alone and go deep on analysis during tough tradeoffs, but having someone else to discuss a solution is as valuable practice to keep focused and don’t get biased by yourself.

All these awesome tips only raised because I had to share my challenge with other Architects. Our discussion helped me to think in the problem with different perspectives 🙂

How about you? What you do when you have to make tough decisions in your project? Share with us!

Always Free Cloud Services

After hosting The Senior Journey session, sponsored by Oracle Cloud, I was so impressed with their always free tier package!

We can achieve so many things with that! From running simple experiments to publish small production level solutions! All for free!

That made me curious!

What other cloud providers free tier offers, such as in Amazon, Google and Microsoft?

I end up finding this GitHub repository collecting all these information for us 😀

To have a quick view:

1. AWS Free Tier

Always Free

  • Amazon DynamoDB (NoSQL): 25 GB of storage
  • AWS Lambda (FaaS): 1 Million free requests per month
  • Amazon SNS: 1 Million publishes

2. Azure Free Tier

Free for Limited-time

  • US$200 credit for 30 days
  • Popular services free for 12 months

Always Free

  • 54+ other services free always

3. Google Cloud Free Tier

Always Free

  • Compute VM: 0.25 vCPU, 1G RAM (only on us-west1, us-central1 and us-east1)
  • 1GB of network egress (except China and Australia)
  • 5GB Storage (only on us-west1, us-central1, us-east1, asia-east1 and europe-west1)

4. Oracle Cloud Free Tier

Free for Limited-time

  • US$300 credit for 30 days
  • Up to eight instances across all available services
  • Up to 5 TB of storage

Always Free

  • Compute:
    • 2 AMD-based VMs: 0.25 vCPU and 1 GB RAM each;
    • 4 Arm-based VMs: 24 GB RAM total, 3,000 vCPU hours and 18,000 GB hours per month;
  • 2 Block Volumes Storage, 200 GB total;
  • 10 GB Object Storage – Standard;
  • 10 GB Object Storage – Infrequent Access;
  • 10 GB Archive Storage;
  • 10TB of network egress;
  • Load Balancer;
  • Monitoring and Notifications;
  • Two Oracle Autonomous Databases incl. Oracle Application Express (APEX), Oracle SQL Developer etc.

Not bad uhh?! Have you already created your own Cloud account? Or made use of these amazing services and try some interesting Cloud Architectures? Share in the comments 🙂

4 Great Architects to Follow!

There are many names in the software architecture field to share and follow, so I decided to make it a series of Architects to follow with a brief description and link to their content 🙂

Here is my list of must-follow architects to stay updated with architectural discussions and expand my knowledge every day!

Mark Richards

Author of Fundamentals of Software Architecture and many more titles in collaboration with other great software architects of the industry, Mark definitely deserves to be in this list for helping collect and organize all these deep and complex topics to guide the fellow architects in our challenging tasks.

Mark records and shares valuable content on his Software Architecture Monday channel on YouTube. He generously offers all of these resources for free and already on lesson 173!

If you’re just starting on Software Architecture topic and enjoy well-structured and didactic content, I totally recommend you take a look on Mark Richards contents.

Alex Xu

Alex, the author of System Design Interview, provides content that explains the design of various solutions using intuitive diagrams for a quick and clear understanding.

Alex also shares System Design animated contents on his official ByteByteGo channel on YouTube, which are very useful for the learning process!

If you like to read some reviews before buying any book, I have particularly found a detailed and enjoyable review of Alex’s book from Gergely Orosz (would like to write about him in the future list).

Chris Richardson

Experienced Software Architect and the author of Microservices Patterns book, Chris became an important reference in the widespread Microservice architecture field.

The Microservices.io website offers clear concepts and easy-to-understand diagrams. It is helpful for beginners learning about microservices architecture and also for senior architects looking to enhance their knowledge in advanced topics.

Venkat Subramaniam

Founder of Agile Developer Inc., author of many books published at The Pragmatic Programmers series, and also a Java Champion. On top of all of that, Vankat is for me, the best Live Coding speaker of all the time! 🙂

His exceptional ability to create impressive Live Coding sessions while telling a captivating story results in a rich and dense in concept session that is at the same time engaging and entertaining.

I do really recommend you to watch Core Design Principles for Software Developers 🙂

How about you? Have heard about them before? What content did you like most from them? Share in the comments! 🙂