Build AI Agent that Gets YOU Hired


Hello Reader,

Agents are everywhere. But there’s a big difference between using an agent and building one end-to-end. Let's face it - if you tell a recruiter that you played with Claude or ChatGPT, or even created a workflow using n8n, that won't impress them. Because when a company hires you, it expects you to know how to build agent using the infrastructure components. With that in mind, let's turn our attention to how to build an agent.

Good Agent

Let's take a look at building a good agent.

A decent agent should have some code integrating with LLM on Cloud, and various tools. You can use MCP for some tools. A lot of candidates will do this. This is good, but NOT delightful.

To delight, you need add couple more things:

  • Implement memory which will make the agent stateful. We went over memory details, and memory extraction in depth in a previous newsletter. Check that out, if interested.
  • All real-world agents use memory. That is why they remember the past convo, and you can continue the chat instead of repeating everything
  • Next - you need to showcase tool call vs hook

Tool call - LLM decides when to call what tool, in which order

Hook - YOU decide when to call a tool or process. You probably know about tool calls, but hook is used all the time in production agents. Where can we use hooks in this case?

Saving and extracting info from memory is done via hooks. After you ask agent a question, and agent responds, using hook you can save it into the memory. And later, when you initiate or resume a chat session, you can run a hook, to get information from the memory. Hooks ensure guaranteed execution, and not dependent on LLM.

And the final delight factor is running the Agent on the cloud.

Now that we understand what separates a good vs delightful agent, let's look into agent building lifecycle.

Agent Build Lifecycle

You'd see example agent code everywhere. But in reality, no one builds the full agent code as a regular code from get go. We use Jupyter Notebook, which can run the python agent code block by block :

  • Break a big agent into small parts that can tested and re-tested instead of running the whole agent
  • LLM calls are expensive, this saves cost because you can execute LLM once, and then re-run future blocks to test
  • Easy to add/remove lines while executing

For our agent, we are building a movie recommendation agent. The components are as follows:

  • LLM hosted in Amazon Bedrock
  • Memory managed via Amazon Agentcore. Memory will be called via hooks
  • Search tool (Duck Duck Go)

Finally when agent is ready, agent code will be converted into a full python code using Open Source framework Strands. This part is easy because in our notebook, we are already using Strands, so it's just a matter of stitching all those blocks together to a single program.

And finally, we will move the Strands code to Amazon Agentcore Runtime, and the whole thing will be on Cloud!

Command "agentcore configure"

  • Creates Dockerfile to containerize your agent
  • I hate writing Dockerfile myself because I am always forgetting something to include. AgentCore creates the Dockerfile which will package the code and requirements.txt file
  • This is all happening on your local laptop

Command "agentcore launch"

  • AgentCore copies the python code, requirements.txt, and Dockerfile from your local to a S3 bucket. It creates the bucket for you
  • It runs the Dockerfile in AWS CodeBuild which creates a container image for the agent code
  • It saves the image in an ECR repo (it creates the repo for you)
  • It starts running the container in AgentCore ready to be invoked
  • It creates logging and tracing for you. AWS even created new Gen AI Observability which is super slick

Below are the characteristics of the AgentCore:

  • Agents run on Serverless microVMs managed by AWS
  • Out of the box Gen AI logging and tracing
  • Convert any Lambda or APIs into MCP
  • Supports third party Agent Frameworks – Crew, LangGraph etc. if you have written your agents on these framework, you can still utilize AgentCore to run them on AWS
  • Easy to add AuthN/Z

Now that we understand the agent components, and their implementation, let's run our agent

GitHub Repo and Code Snippets

Main GitHub Repo: https://github.com/saha-rajdeep/Strands-agents-demo/tree/main (If this is useful, please star it)

Movie Agent Jupyter Notebook, and Strands Code: https://github.com/saha-rajdeep/Strands-agents-demo/tree/main/movie-agent-with-memory

Notable Code Snippets:

  • on_agent_initialized(self,event:AgentInitializedEvent) function is the function that'd be used in hook when agent session starts
    • Under the hood, it does RAG with query="movie preferences genres directors favorites" from the memory
    • top_k=10 signifies top 10 memory records matching that query
    • The actor_id is basically the user_id. Even when sessions IDs change for different sessions, actor_id will remain same. Hence actor_id is used to save and fetch memory
  • on_after_invocation(self,event:AfterInvocationEvent) function is the other function used in hook. It's called after 2 messages (1 from you to agent, and then 1 from agent to you as a response)
    • You can only save messages into short term memory
    • Periodically messages from short term memory is extracted and saved to long term memory
    • In Agentcore, both short term and long term memory is in S3
  • Once you run the notebook steps, it'd give you a memory ID. Make sure to use that in the movie_agent_runtime.py, in MEMORY_ID variable

If you want to see this in action, watch out my video:

video preview

Once you do this, and when talking to a recruiter, don’t impress with vagueness. Impress with specifics.

Instead of saying:

“Yeah I built an agent with memory.”

Say:

“I implemented short-term and long-term memory using Bedrock AgentCore. I used hooks to persist preferences and RAG to retrieve semantic context across sessions.”

🙏 Quick favor - just hit reply and say “hey” so your inbox knows we’re friends. It helps future emails land in your main inbox instead of spam.

If you have found this newsletter helpful, and want to support me :

Checkout my bestselling courses on AWS, System Design, Kubernetes, DevOps, and more: Max discounted links

AWS SA Bootcamp with Live Classes, Mock Interviews, Hands-On, Resume Improvement and more: https://www.sabootcamp.com/

Keep learning and keep rocking 🚀,

Raj

Fast Track To Cloud

Free Cloud Interview Guide to crush your next interview. Plus, real-world answers for cloud interviews, and system design from a top AWS Solutions Architect.

Read more from Fast Track To Cloud

Hello Reader, Not all System Designs are created equal! To make matters complicated, there are so many designs out there. As a former Principal Solutions Architect at AWS and Distinguished Cloud Architect at Verizon, I have taken over 300+ interviews, and I have seen three patterns coming over and over in interviews. In this newsletter edition, we will go through 3 System Design patterns that appear the MOST in cloud interviews and actual projects. If you nail these 3, you will be ahead of...

Hello Reader, Claude. ChatGPT. Gemini. Copilot. If you're not using at least one of these daily, you're the outlier. So here's the uncomfortable truth: walking into an interview and saying "I use Claude Code every day" is no longer impressive. It's table stakes. That's the average answer. And average doesn't get you hired. In today's edition, I'll show you what separates a forgettable Gen AI answer from one that makes the interviewer lean forward. The Average Answer (And Why It Fails) Here's...

Hello Reader, Recruiters reaching out to you for interviews. That's the dream, right? And one of the best ways to make that happen is a badge most cloud professionals have never heard of - the AWS Community Builder. I've had multiple students get accepted into this program recently. Recruiters started finding them on LinkedIn. Interview calls went up. And the best part? You don't need to be a Principal Architect or a 10x AWS certified rockstar to qualify. In today's newsletter, I'll show you...