AWS Builder Center
Weekend Creative Agent Challenge: DSA Guru

Weekend Creative Agent Challenge: DSA Guru

The Agent which can help you to practice DSA daily basis and help you to upskill based on your skill level as you grow

Goal:

Goal is to build agent which can challenge you daily on DSA problem and increase the level of difficulty as you grow. Not just challenge but also provide you feedbacks and main benefit is to avoid drift of Laptop/PC Dependency but is to offer practice on the go from your telegram app

Architecture

Built on server less pattern


 Core Components   

  1. API Gateway (HTTP API): Receives webhook payloads from Telegram.
  1. Orchestrator Lambda: The "Brain" of the application. It parses Telegram messages, fetches user state, calls Amazon Bedrock, and formats the reply.
  1. Amazon EventBridge: Triggers a daily cron job that wakes the Orchestrator Lambda up to send a personalized challenge to all active users.
  1. Sandbox Lambda: An intentionally isolated, locked-down execution environment. It runs the user's Python code using the  run_python_code  tool invoked by Bedrock.
  1. DynamoDB: A single-table design ( PK: USER#<chat_id> ,  SK: PROFILE ) storing user progression, stats, and a sliding window of conversation history.
SSM Parameter Store: Securely holds the Telegram Bot Token.

What it does?

The DSA Sparring Partner is an AI-powered Telegram bot that acts as your personal Data Structures and Algorithms (DSA) coach.
It generates personalized coding challenges tailored to your skill level and weak areas. When you reply with a Python solution directly in the chat, the bot securely executes your code in an isolated AWS Lambda sandbox, tests it against hidden edge cases, and provides instant, detailed feedback on correctness, time complexity, and space complexity.
Additionally, it wakes up every morning to send you a daily coding challenge to keep your skills sharp!

How I Built

The journey started with a simple idea: bringing a coding coach to a platform I already use every day (Telegram).
  1. Infrastructure First: I started by defining the entire architecture in Terraform to ensure everything was reproducible.
  1. The LLM Core: Next, I integrated Amazon Bedrock to act as the "brain", focusing heavily on prompt engineering to get the bot to act like a strict-but-friendly coach.
  1. The Sandbox: The hardest part was building a secure environment to run the code users submit.
  1. State & Memory: Finally, I added DynamoDB to track user stats and conversation history, followed by an EventBridge cron job to send daily challenges.

Key Decisions

  • Zero-Dependency Python: To keep Lambda cold starts incredibly fast, I decided not to use  requests  or  telebot . Instead, I built the Telegram webhook integrations using only Python's standard  urllib  and  json  libraries.
  • Agentic Tool Calling over Static Prompts: Instead of just asking the LLM to "guess" if the user's code is correct, I gave the LLM a tool:  run_python_code . The LLM writes test cases, executes the user's code in a sandbox, and bases its feedback on actual runtime results.
Single-Table Design: I chose DynamoDB for state management to keep costs at zero and queries lightning fast. Both user profiles and conversation histories are managed under a single Partition Key.

Learning:

The Bedrock Converse API makes tool-calling incredibly seamless. Seeing an LLM realize it needs to test code, format a payload, wait for Lambda to execute it, and then generate a user response was a yurekha moment for me. AI is moving from "text generators" to "action takers."

Screenshot from APP:




Links

Challenge :  Here 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article