• About TC
  • Affiliate Disclaimer
  • Privacy Policy
  • TOS
  • Contact
Thursday, June 19, 2025
Techcratic
  • TC
  • AI
    Artificial Intelligence

    Update on the AWS DeepRacer Student Portal

    Artificial Intelligence

    INRFlow: Flow Matching for INRs in Ambient Space

    Artificial Intelligence

    Building a custom text-to-SQL agent using Amazon Bedrock and Converse API

    Artificial Intelligence

    How Apollo Tyres is unlocking machine insights using agentic AI-powered Manufacturing Reasoner

    Artificial Intelligence

    Automatically Build AI Workflows with Magical AI

    Artificial Intelligence

    Amazon Nova Lite enables Bito to offer a free tier option for its AI-powered code reviews

    Artificial Intelligence

    Bridging the Gap: New Datasets Push Recommender Research Toward Real-World Scale

    Artificial Intelligence

    7 Python Errors That Are Actually Features

    Artificial Intelligence

    10 Awesome OCR Models for 2025

  • Crypto
    Moscow Releases Tax Calculator for Russian Crypto Miners

    Russian Power Firm Debuts Bitcoin Mining Mutual Investment Fund

    Blockchain Lending Boom: Tokenized Private Credit Nears $14 Billion

    Blockchain Lending Boom: Tokenized Private Credit Nears $14 Billion

    Pi Network Dives Toward $1 – Here’s Why Investors Are Nervous

    Trump Coin Price Prediction: TRUMP Gets Binance Backing

    Crypto Firms on Wall Street Diverge: Miners Dip, Strategy Clones Vary

    Crypto Firms on Wall Street Diverge: Miners Dip, Strategy Clones Vary

    Bitcoin Volume Metric Hints A ‘$130k-$135k Btc Will Happen’ By Q3 2025

    Bitcoin Volume Metric Hints A ‘$130k-$135k Btc Will Happen’ By Q3 2025

    Best Presales to Buy Today – Which Coins Are Poised for a Breakout?

    DOGE, SOL, and XRP Holders Can Now Cash Out Through BCC Mining

    China’s Central Bank Governor Envisions the End of US Dollar Dominance

    China’s Central Bank Governor Envisions the End of US Dollar Dominance

    K33 Plans Major Bitcoin Acquisition With $8 Million Share Issue

    K33 Plans Major Bitcoin Acquisition With $8 Million Share Issue

    Bitcoin Bull Cycle is Over: CryptoQuant CEO

    Trump Wants GENIUS Bill Sent Straight to His Desk, Without Delay

  • Cybersecurity
    Cybersecurity

    Meta Adds Passkey Login Support to Facebook for Android and iOS Users

    Cybersecurity

    FedRAMP at Startup Speed: Lessons Learned

    Cybersecurity

    CISA Warns of Active Exploitation of Linux Kernel Privilege Escalation Vulnerability

    Cybersecurity

    Ex-CIA Analyst Sentenced to 37 Months for Leaking Top Secret National Defense Documents

    Cybersecurity

    Critical RCE Bug Rated 9.9 CVSS in Backup & Replication

    Cybersecurity

    Hard-Coded ‘b’ Password in Sitecore XP Sparks Major RCE Risk in Enterprise Deployments

    Cybersecurity

    AI Agents Run on Secret Accounts — Learn How to Secure Them in This Webinar

    Cybersecurity

    How to Address the Expanding Security Risk

    Cybersecurity

    ConnectWise to Rotate ScreenConnect Code Signing Certificates Due to Security Risks

  • Deals
    StarTech.com 4 Port PCI Express USB 3.0 Card – 5Gbps – 2 External & 2 Internal – SATA…

    StarTech.com 4 Port PCI Express USB 3.0 Card – 5Gbps – 2 External & 2 Internal – SATA…

    SABRENT USB 3.0 to SATA I/II/III Dual Bay External Hard Drive Docking Station for 2.5 or…

    SABRENT USB 3.0 to SATA I/II/III Dual Bay External Hard Drive Docking Station for 2.5 or…

    ORICO 2.5 SSD SATA to 3.5 Hard Drive Adapter Internal Drive Bay Converter Mounting…

    ORICO 2.5 SSD SATA to 3.5 Hard Drive Adapter Internal Drive Bay Converter Mounting…

    Mushkin MLB5C600AEEM16GX2 Mem 2*16gmushkin Mlb5c600aeem16gx2

    Mushkin MLB5C600AEEM16GX2 Mem 2*16gmushkin Mlb5c600aeem16gx2

    MSI MAG321CUP 32-inch 3840 x 2160 (UHD), VA, 4K Gaming Monitor 160Hz, Adaptive Sync,…

    MSI MAG321CUP 32-inch 3840 x 2160 (UHD), VA, 4K Gaming Monitor 160Hz, Adaptive Sync,…

    Logitech C920x HD Pro Webcam, Full HD 1080p/30fps Video, Clear Audio, HD Light…

    Logitech C920x HD Pro Webcam, Full HD 1080p/30fps Video, Clear Audio, HD Light…

    Lexar 128GB (2-Pack) Professional 1667x SD Card, UHS-II, C10, U3, V60, Full HD, 4K, Up…

    Lexar 128GB (2-Pack) Professional 1667x SD Card, UHS-II, C10, U3, V60, Full HD, 4K, Up…

    Charger for Lenovo Laptop – Ideapad 3 1 5 S340 S145 330 320 310, Flex 5, V14 V15 V17,…

    Charger for Lenovo Laptop – Ideapad 3 1 5 S340 S145 330 320 310, Flex 5, V14 V15 V17,…

    Kingston 240GB A400 SATA 3 2.5″ Internal SSD SA400S37/240G – HDD Replacement for…

    Kingston 240GB A400 SATA 3 2.5″ Internal SSD SA400S37/240G – HDD Replacement for…

  • Gaming
    Nood to OP GOD!! TIPS and TRICKS  in Minecraft Prison | Complex Gaming

    Nood to OP GOD!! TIPS and TRICKS in Minecraft Prison | Complex Gaming

    Eight minutes of footage from an unfinished open world D&D game has leaked

    Eight minutes of footage from an unfinished open world D&D game has leaked

    This Cute Game has Sharp Edges | Defenders of the Wild Review

    This Cute Game has Sharp Edges | Defenders of the Wild Review

    Honest Game Trailers | Marvel's Spider-Man: Miles Morales

    Honest Game Trailers | Marvel's Spider-Man: Miles Morales

    Survival Escape: Prison Game – Gameplay Walkthrough Part 1 – Season 1 & 2 Win (Android, iOS)

    Survival Escape: Prison Game – Gameplay Walkthrough Part 1 – Season 1 & 2 Win (Android, iOS)

    Stellaris updates are going to start coming more slowly, because new patches are causing new problems and QA testers can’t keep up

    Stellaris updates are going to start coming more slowly, because new patches are causing new problems and QA testers can’t keep up

    Space Marine 2 REVIEW | Based Game Reviews

    Space Marine 2 REVIEW | Based Game Reviews

    Zelda OoT 100% part 2 (HD)

    Zelda OoT 100% part 2 (HD)

    Daemon X Machina: Titanic Scion is adding a card game as the mecha sequel targets an increasingly specific type of guy

    Daemon X Machina: Titanic Scion is adding a card game as the mecha sequel targets an increasingly specific type of guy

  • Tesla
    4 Pack Aluminum Waterproof Wheel Cover Center Emblem Sticker for Tesla Model 3 Model Y…

    4 Pack Aluminum Waterproof Wheel Cover Center Emblem Sticker for Tesla Model 3 Model Y…

    Tesla Supercharger to CCS1 Adapter – 500A 1000V Fast Charging | NACS to CCS Converter…

    Tesla Supercharger to CCS1 Adapter – 500A 1000V Fast Charging | NACS to CCS Converter…

    OEDRO Floor Mats Fit for Tesla Model 3 Highland 2024 2025, All Weather Waterproof…

    OEDRO Floor Mats Fit for Tesla Model 3 Highland 2024 2025, All Weather Waterproof…

    2025 Upgraded Tesla Model Y Roof Sunshade Heat-Insulating, UV-Protective,…

    2025 Upgraded Tesla Model Y Roof Sunshade Heat-Insulating, UV-Protective,…

    BestEvMod Center Console Cup Holder Trim Cover Panel Decorative Cover Sticker ABS…

    BestEvMod Center Console Cup Holder Trim Cover Panel Decorative Cover Sticker ABS…

    TUFFIOM 46″x 36″x 6″ Universal Rooftop Cargo Carrier Basket, Heavy Duty Steel Roof Rack…

    TUFFIOM 46″x 36″x 6″ Universal Rooftop Cargo Carrier Basket, Heavy Duty Steel Roof Rack…

    Door Side Rear View Mirror Cover Compatible with 2024 2025 Tesla Cybertruck Accessories

    Door Side Rear View Mirror Cover Compatible with 2024 2025 Tesla Cybertruck Accessories

    4PCS Wheel Center Caps and 24PCS Black Lug nut Covers for Tesla Cybertruck Accessories…

    4PCS Wheel Center Caps and 24PCS Black Lug nut Covers for Tesla Cybertruck Accessories…

    Car Windshield Cleaning Tool, Microfiber Window Cleaner with 4 Washable and Reusable…

    Car Windshield Cleaning Tool, Microfiber Window Cleaner with 4 Washable and Reusable…

  • UFO
    Behind the Conspiracy – The Reptilians (Featuring Dr. David Miano)

    Behind the Conspiracy – The Reptilians (Featuring Dr. David Miano)

    Ross Coulthart in Egypt: Ancient UFO proof revealed? | Reality Check

    Ross Coulthart in Egypt: Ancient UFO proof revealed? | Reality Check

    TUFFY – World’s Tuffest Soft Dog Toy – Alien Green-Squeaker- Multiple Layers. Made Durable, Strong & Tough. Interactive Play (Tug, Toss & Fetch). Machine Washable & Floats

    TUFFY – World’s Tuffest Soft Dog Toy – Alien Green-Squeaker- Multiple Layers. Made Durable, Strong & Tough. Interactive Play (Tug, Toss & Fetch). Machine Washable & Floats

    The Fermi Paradox: Where Are All the Aliens? #aliens #cosmos #cosmicmysteries #extraterrestrial

    The Fermi Paradox: Where Are All the Aliens? #aliens #cosmos #cosmicmysteries #extraterrestrial

    Lightweight Cotton Beanie, Summer Skull Caps, Breathable Thin Sleep Hats for Running Cycling Hiking Fishing

    Lightweight Cotton Beanie, Summer Skull Caps, Breathable Thin Sleep Hats for Running Cycling Hiking Fishing

    A Glitch In The Matrix Caught On Camera At Disneyland #shorts

    A Glitch In The Matrix Caught On Camera At Disneyland #shorts

    Men’s Short Sleeve Workout Shirts Quick Dry Lightweight T-Shirts Gym Running Athletic Tshirt for Summer

    Men’s Short Sleeve Workout Shirts Quick Dry Lightweight T-Shirts Gym Running Athletic Tshirt for Summer

    Unveiling the Truth: Garry Nolan’s Journey in #UFO Research | Dr. Garry Nolan

    Unveiling the Truth: Garry Nolan’s Journey in #UFO Research | Dr. Garry Nolan

    Dimzmars Spacecraft Model Interstellar Prowler Movie Spaceship Model

    Dimzmars Spacecraft Model Interstellar Prowler Movie Spaceship Model

No Result
View All Result
  • TC
  • AI
    Artificial Intelligence

    Update on the AWS DeepRacer Student Portal

    Artificial Intelligence

    INRFlow: Flow Matching for INRs in Ambient Space

    Artificial Intelligence

    Building a custom text-to-SQL agent using Amazon Bedrock and Converse API

    Artificial Intelligence

    How Apollo Tyres is unlocking machine insights using agentic AI-powered Manufacturing Reasoner

    Artificial Intelligence

    Automatically Build AI Workflows with Magical AI

    Artificial Intelligence

    Amazon Nova Lite enables Bito to offer a free tier option for its AI-powered code reviews

    Artificial Intelligence

    Bridging the Gap: New Datasets Push Recommender Research Toward Real-World Scale

    Artificial Intelligence

    7 Python Errors That Are Actually Features

    Artificial Intelligence

    10 Awesome OCR Models for 2025

  • Crypto
    Moscow Releases Tax Calculator for Russian Crypto Miners

    Russian Power Firm Debuts Bitcoin Mining Mutual Investment Fund

    Blockchain Lending Boom: Tokenized Private Credit Nears $14 Billion

    Blockchain Lending Boom: Tokenized Private Credit Nears $14 Billion

    Pi Network Dives Toward $1 – Here’s Why Investors Are Nervous

    Trump Coin Price Prediction: TRUMP Gets Binance Backing

    Crypto Firms on Wall Street Diverge: Miners Dip, Strategy Clones Vary

    Crypto Firms on Wall Street Diverge: Miners Dip, Strategy Clones Vary

    Bitcoin Volume Metric Hints A ‘$130k-$135k Btc Will Happen’ By Q3 2025

    Bitcoin Volume Metric Hints A ‘$130k-$135k Btc Will Happen’ By Q3 2025

    Best Presales to Buy Today – Which Coins Are Poised for a Breakout?

    DOGE, SOL, and XRP Holders Can Now Cash Out Through BCC Mining

    China’s Central Bank Governor Envisions the End of US Dollar Dominance

    China’s Central Bank Governor Envisions the End of US Dollar Dominance

    K33 Plans Major Bitcoin Acquisition With $8 Million Share Issue

    K33 Plans Major Bitcoin Acquisition With $8 Million Share Issue

    Bitcoin Bull Cycle is Over: CryptoQuant CEO

    Trump Wants GENIUS Bill Sent Straight to His Desk, Without Delay

  • Cybersecurity
    Cybersecurity

    Meta Adds Passkey Login Support to Facebook for Android and iOS Users

    Cybersecurity

    FedRAMP at Startup Speed: Lessons Learned

    Cybersecurity

    CISA Warns of Active Exploitation of Linux Kernel Privilege Escalation Vulnerability

    Cybersecurity

    Ex-CIA Analyst Sentenced to 37 Months for Leaking Top Secret National Defense Documents

    Cybersecurity

    Critical RCE Bug Rated 9.9 CVSS in Backup & Replication

    Cybersecurity

    Hard-Coded ‘b’ Password in Sitecore XP Sparks Major RCE Risk in Enterprise Deployments

    Cybersecurity

    AI Agents Run on Secret Accounts — Learn How to Secure Them in This Webinar

    Cybersecurity

    How to Address the Expanding Security Risk

    Cybersecurity

    ConnectWise to Rotate ScreenConnect Code Signing Certificates Due to Security Risks

  • Deals
    StarTech.com 4 Port PCI Express USB 3.0 Card – 5Gbps – 2 External & 2 Internal – SATA…

    StarTech.com 4 Port PCI Express USB 3.0 Card – 5Gbps – 2 External & 2 Internal – SATA…

    SABRENT USB 3.0 to SATA I/II/III Dual Bay External Hard Drive Docking Station for 2.5 or…

    SABRENT USB 3.0 to SATA I/II/III Dual Bay External Hard Drive Docking Station for 2.5 or…

    ORICO 2.5 SSD SATA to 3.5 Hard Drive Adapter Internal Drive Bay Converter Mounting…

    ORICO 2.5 SSD SATA to 3.5 Hard Drive Adapter Internal Drive Bay Converter Mounting…

    Mushkin MLB5C600AEEM16GX2 Mem 2*16gmushkin Mlb5c600aeem16gx2

    Mushkin MLB5C600AEEM16GX2 Mem 2*16gmushkin Mlb5c600aeem16gx2

    MSI MAG321CUP 32-inch 3840 x 2160 (UHD), VA, 4K Gaming Monitor 160Hz, Adaptive Sync,…

    MSI MAG321CUP 32-inch 3840 x 2160 (UHD), VA, 4K Gaming Monitor 160Hz, Adaptive Sync,…

    Logitech C920x HD Pro Webcam, Full HD 1080p/30fps Video, Clear Audio, HD Light…

    Logitech C920x HD Pro Webcam, Full HD 1080p/30fps Video, Clear Audio, HD Light…

    Lexar 128GB (2-Pack) Professional 1667x SD Card, UHS-II, C10, U3, V60, Full HD, 4K, Up…

    Lexar 128GB (2-Pack) Professional 1667x SD Card, UHS-II, C10, U3, V60, Full HD, 4K, Up…

    Charger for Lenovo Laptop – Ideapad 3 1 5 S340 S145 330 320 310, Flex 5, V14 V15 V17,…

    Charger for Lenovo Laptop – Ideapad 3 1 5 S340 S145 330 320 310, Flex 5, V14 V15 V17,…

    Kingston 240GB A400 SATA 3 2.5″ Internal SSD SA400S37/240G – HDD Replacement for…

    Kingston 240GB A400 SATA 3 2.5″ Internal SSD SA400S37/240G – HDD Replacement for…

  • Gaming
    Nood to OP GOD!! TIPS and TRICKS  in Minecraft Prison | Complex Gaming

    Nood to OP GOD!! TIPS and TRICKS in Minecraft Prison | Complex Gaming

    Eight minutes of footage from an unfinished open world D&D game has leaked

    Eight minutes of footage from an unfinished open world D&D game has leaked

    This Cute Game has Sharp Edges | Defenders of the Wild Review

    This Cute Game has Sharp Edges | Defenders of the Wild Review

    Honest Game Trailers | Marvel's Spider-Man: Miles Morales

    Honest Game Trailers | Marvel's Spider-Man: Miles Morales

    Survival Escape: Prison Game – Gameplay Walkthrough Part 1 – Season 1 & 2 Win (Android, iOS)

    Survival Escape: Prison Game – Gameplay Walkthrough Part 1 – Season 1 & 2 Win (Android, iOS)

    Stellaris updates are going to start coming more slowly, because new patches are causing new problems and QA testers can’t keep up

    Stellaris updates are going to start coming more slowly, because new patches are causing new problems and QA testers can’t keep up

    Space Marine 2 REVIEW | Based Game Reviews

    Space Marine 2 REVIEW | Based Game Reviews

    Zelda OoT 100% part 2 (HD)

    Zelda OoT 100% part 2 (HD)

    Daemon X Machina: Titanic Scion is adding a card game as the mecha sequel targets an increasingly specific type of guy

    Daemon X Machina: Titanic Scion is adding a card game as the mecha sequel targets an increasingly specific type of guy

  • Tesla
    4 Pack Aluminum Waterproof Wheel Cover Center Emblem Sticker for Tesla Model 3 Model Y…

    4 Pack Aluminum Waterproof Wheel Cover Center Emblem Sticker for Tesla Model 3 Model Y…

    Tesla Supercharger to CCS1 Adapter – 500A 1000V Fast Charging | NACS to CCS Converter…

    Tesla Supercharger to CCS1 Adapter – 500A 1000V Fast Charging | NACS to CCS Converter…

    OEDRO Floor Mats Fit for Tesla Model 3 Highland 2024 2025, All Weather Waterproof…

    OEDRO Floor Mats Fit for Tesla Model 3 Highland 2024 2025, All Weather Waterproof…

    2025 Upgraded Tesla Model Y Roof Sunshade Heat-Insulating, UV-Protective,…

    2025 Upgraded Tesla Model Y Roof Sunshade Heat-Insulating, UV-Protective,…

    BestEvMod Center Console Cup Holder Trim Cover Panel Decorative Cover Sticker ABS…

    BestEvMod Center Console Cup Holder Trim Cover Panel Decorative Cover Sticker ABS…

    TUFFIOM 46″x 36″x 6″ Universal Rooftop Cargo Carrier Basket, Heavy Duty Steel Roof Rack…

    TUFFIOM 46″x 36″x 6″ Universal Rooftop Cargo Carrier Basket, Heavy Duty Steel Roof Rack…

    Door Side Rear View Mirror Cover Compatible with 2024 2025 Tesla Cybertruck Accessories

    Door Side Rear View Mirror Cover Compatible with 2024 2025 Tesla Cybertruck Accessories

    4PCS Wheel Center Caps and 24PCS Black Lug nut Covers for Tesla Cybertruck Accessories…

    4PCS Wheel Center Caps and 24PCS Black Lug nut Covers for Tesla Cybertruck Accessories…

    Car Windshield Cleaning Tool, Microfiber Window Cleaner with 4 Washable and Reusable…

    Car Windshield Cleaning Tool, Microfiber Window Cleaner with 4 Washable and Reusable…

  • UFO
    Behind the Conspiracy – The Reptilians (Featuring Dr. David Miano)

    Behind the Conspiracy – The Reptilians (Featuring Dr. David Miano)

    Ross Coulthart in Egypt: Ancient UFO proof revealed? | Reality Check

    Ross Coulthart in Egypt: Ancient UFO proof revealed? | Reality Check

    TUFFY – World’s Tuffest Soft Dog Toy – Alien Green-Squeaker- Multiple Layers. Made Durable, Strong & Tough. Interactive Play (Tug, Toss & Fetch). Machine Washable & Floats

    TUFFY – World’s Tuffest Soft Dog Toy – Alien Green-Squeaker- Multiple Layers. Made Durable, Strong & Tough. Interactive Play (Tug, Toss & Fetch). Machine Washable & Floats

    The Fermi Paradox: Where Are All the Aliens? #aliens #cosmos #cosmicmysteries #extraterrestrial

    The Fermi Paradox: Where Are All the Aliens? #aliens #cosmos #cosmicmysteries #extraterrestrial

    Lightweight Cotton Beanie, Summer Skull Caps, Breathable Thin Sleep Hats for Running Cycling Hiking Fishing

    Lightweight Cotton Beanie, Summer Skull Caps, Breathable Thin Sleep Hats for Running Cycling Hiking Fishing

    A Glitch In The Matrix Caught On Camera At Disneyland #shorts

    A Glitch In The Matrix Caught On Camera At Disneyland #shorts

    Men’s Short Sleeve Workout Shirts Quick Dry Lightweight T-Shirts Gym Running Athletic Tshirt for Summer

    Men’s Short Sleeve Workout Shirts Quick Dry Lightweight T-Shirts Gym Running Athletic Tshirt for Summer

    Unveiling the Truth: Garry Nolan’s Journey in #UFO Research | Dr. Garry Nolan

    Unveiling the Truth: Garry Nolan’s Journey in #UFO Research | Dr. Garry Nolan

    Dimzmars Spacecraft Model Interstellar Prowler Movie Spaceship Model

    Dimzmars Spacecraft Model Interstellar Prowler Movie Spaceship Model

No Result
View All Result
Techcratic
No Result
View All Result
Home AI

Building a custom text-to-SQL agent using Amazon Bedrock and Converse API

AI by AI
June 18, 2025
in AI
Reading Time: 11 mins read
126 4
A A
0

Pavan Kumar Vadupu Lakshman Manikya
2025-06-18 12:10:00
aws.amazon.com

Developing robust text-to-SQL capabilities is a critical challenge in the field of natural language processing (NLP) and database management. The complexity of NLP and database management increases in this field, particularly while dealing with complex queries and database structures. In this post, we introduce a straightforward but powerful solution with accompanying code to text-to-SQL using a custom agent implementation along with Amazon Bedrock and Converse API.

The ability to translate natural language queries into SQL statements is a game-changer for businesses and organizations because users can now interact with databases in a more intuitive and accessible manner. However, the complexity of database schemas, relationships between tables, and the nuances of natural language can often lead to inaccurate or incomplete SQL queries. This not only compromises the integrity of the data but also hinders the overall user experience. Through a straightforward yet powerful architecture, the agent can understand your query, develop a plan of execution, create SQL statements, self-correct if there is a SQL error, and learn from its execution to improve in the future. Overtime, the agent can develop a cohesive understanding of what to do and what not to do to efficiently answer queries from users.

Solution overview

The solution is composed of an AWS Lambda function that contains the logic of the agent that communicates with Amazon DynamoDB for long-term memory retention, calls Anthropic’s Claude Sonnet in Amazon Bedrock through Converse API, uses AWS Secrets Manager to retrieve database connection details and credentials, and Amazon Relational Database Service (Amazon RDS) that contains an example Postgres database called HR Database. The Lambda function is connected to a virtual private cloud (VPC) and communicates with DynamoDB, Amazon Bedrock, and Secrets Manager through AWS PrivateLink VPC endpoints so that the Lambda can communicate with the RDS database while keeping traffic private through AWS networking.

In the demo, you can interact with the agent through the Lambda function. You can provide it a natural language query, such as “How many employees are there in each department in each region?” or “What is the employee mix by gender in each region”. The following is the solution architecture.

Solution Diagram

A custom agent build using Converse API

Converse API is provided by Amazon Bedrock for you to be able to create conversational applications. It enables powerful features such as tool use. Tool use is the ability for a large language model (LLM) to choose from a list of tools, such as running SQL queries against a database, and decide which tool to use depending on the context of the conversation. Using Converse API also means you can maintain a series of messages between User and Assistant roles to carry out a chat with an LLM such as Anthropic’s Claude 3.5 Sonnet. In this post, a custom agent called ConverseSQLAgent was created specifically for long-running agent executions and to follow a plan of execution.

The Agent loop: Agent planning, self-correction, and long-term learning

The agent contains several key features: planning and carry-over, execution and tool use, SQLAlchemy and self-correction, reflection and long-term learning using memory.

Planning and carry-over

The first step that the agent takes is to create a plan of execution to perform the text-to-SQL task. It first thinks through what the user is asking and develops a plan on how it will fulfill the request of the user. This behavior is controlled using a system prompt, which defines how the agent should behave. After the agent thinks through what it should do, it outputs the plan.

One of the challenges with long-running agent execution is that sometimes the agent will forget the plan that it was supposed to execute as the context becomes longer and longer as it conducts its steps. One of the primary ways to deal with this is by “carrying over” the initial plan by injecting it back into a section in the system prompt. The system prompt is part of every converse API call, and it improves the ability of the agent to follow its plan. Because the agent may revise its plan as it progresses through the execution, the plan in the system prompt is updated as new plans emerge. Refer to the following figure on how the carry over works.

Process Flow

Execution and tool use

After the plan has been created, the agent will execute its plan one step at a time. It might decide to call on one or more tools it has access to. With Converse API, you can pass in a toolConfig that contains the toolSpec for each tool it has access to. The toolSpec defines what the tool is, a description of the tool, and the parameters that the tool requires. When the LLM decides to use a tool, it outputs a tool use block as part of its response. The application, in this case the Lambda code, needs to identify that tool use block, execute the corresponding tool, append the tool result response to the message list, and call the Converse API again. As shown at (a) in the following figure, you can add tools for the LLM to choose from by adding in a toolConfig along with toolSpecs. Part (b) shows that in the implementation of ConverseSQLAgent, tool groups contain a collection of tools, and each tool contains the toolSpec and the callable function. The tool groups are added to the agent, which in turn adds it to the Converse API call. Tool group instructions are additional instructions on how to use the tool group that get injected into the system prompt. Although you can add descriptions to each individual tool, having tool group–wide instructions enable more effective usage of the group.

Converse API processing Tools

SQLAlchemy and self-correction

The SQL tool group (these tools are part of the demo code provided), as shown in the preceding figure, is implemented using SQLAlchemy, which is a Python SQL toolkit you can use to interface with different databases without having to worry about database-specific SQL syntax. You can connect to Postgres, MySQL, and more without having to change your code every time.

In this post, there is an InvokeSQLQuery tool that allows the agent to execute arbitrary SQL statements. Although almost all database specific tasks, such as looking up schemas and tables, can be accomplished through InvokeSQLQuery, it’s better to provide SQLAlchemy implementations for specific tasks, such as GetDatabaseSchemas, which gets every schema in the database, greatly reducing the time it takes for the agent to generate the correct query. Think of it as giving the agent a shortcut to getting the information it needs. The agents can make errors in querying the database through the InvokeSQLQuery tool. The InvokeSQLQuery tool will respond with the error that it encountered back to the agent, and the agent can perform self-correction to correct the query. This flow is shown in the following diagram.

Agent Flow

Reflection and long-term learning using memory

Although self-correction is an important feature of the agent, the agent must be able to learn through its mistakes to avoid the same mistake in the future. Otherwise, the agent will continue to make the mistake, greatly reducing effectiveness and efficiency. The agent maintains a hierarchical memory structure, as shown in the following figure. The agent decides how to structure its memory. Here is an example on how it may structure it.

Memory Management

The agent can reflect on its execution, learn best practices and error avoidance, and save it into long-term memory. Long-term memory is implemented through a hierarchical memory structure with Amazon DynamoDB. The agent maintains a main memory that has pointers to other memories it has. Each memory is represented as a record in a DynamoDB table. As the agent learns through its execution and encounters errors, it can update its main memory and create new memories by maintaining an index of memories in the main memory. It can then tap onto this memory in the future to avoid errors and even improve the efficiency of queries by caching facts.

Prerequisites

Before you get started, make sure you have the following prerequisites:

Deploy the solution

The full code and instructions are available in GitHub in the Readme file.

  1. Clone the code to your working environment:

git clone https://github.com/aws-samples/aws-field-samples.git

  1. Move to ConverseSqlAgent folder
  2. Follow the steps in the Readme file in the GitHub repo

Cleanup

To dispose of the stack afterwards, invoke the following command:

cdk destroy

Conclusion

The development of robust text-to-SQL capabilities is a critical challenge in natural language processing and database management. Although current approaches have made progress, there remains room for improvement, particularly with complex queries and database structures. The introduction of the ConverseSQLAgent, a custom agent implementation using Amazon Bedrock and Converse API, presents a promising solution to this problem. The agent’s architecture, featuring planning and carry-over, execution and tool use, self-correction through SQLAlchemy, and reflection-based long-term learning, demonstrates its ability to understand natural language queries, develop and execute SQL plans, and continually improve its capabilities. As businesses seek more intuitive ways to access and manage data, solutions such as the ConverseSQLAgent hold the potential to bridge the gap between natural language and structured database queries, unlocking new levels of productivity and data-driven decision-making. To dive deeper and learn more about generative AI, check out these additional resources:


About the authors

Pavan KumarPavan Kumar is a Solutions Architect at Amazon Web Services (AWS), helping customers design robust, scalable solutions on the cloud across multiple industries. With a background in enterprise architecture and software development, Pavan has contributed to creating solutions to handle API security, API management, microservices, and geospatial information system use cases for his customers. He is passionate about learning new technologies and solving, automating, and simplifying customer problems using these solutions.

Abdullah SiddiquiAbdullah Siddiqui is a Partner Sales Solutions Architect at Amazon Web Services (AWS) based out of Toronto. He helps AWS Partners and customers build solutions using AWS services and specializes in resilience and migrations. In his spare time, he enjoys spending time with his family and traveling.

Parag SrivastavaParag Srivastava is a Solutions Architect at Amazon Web Services (AWS), helping enterprise customers with successful cloud adoption and migration. During his professional career, he has been extensively involved in complex digital transformation projects. He is also passionate about building innovative solutions around geospatial aspects of addresses.

Source Link



Shark AI Ultra Voice Control Robot Vacuum

Transform your cleaning routine with the Shark AI Ultra Voice Control Robot Vacuum! This high-tech marvel boasts over 32,487 ratings, an impressive 4.2 out of 5 stars, and has been purchased over 900 times in the past month. Perfect for keeping your home spotless with minimal effort, this vacuum is now available for the unbeatable price of $349.99!

Don’t miss out on this limited-time offer. Order now and let Shark AI do the work for you!


Start your free Amazon Prime trial
today and unlock unlimited streaming and more!

Help Power Techcratic’s Future – Scan To Support

If Techcratic’s content and insights have helped you, consider giving back by supporting the platform with crypto. Every contribution makes a difference, whether it’s for high-quality content, server maintenance, or future updates. Techcratic is constantly evolving, and your support helps drive that progress.

As a solo operator who wears all the hats, creating content, managing the tech, and running the site, your support allows me to stay focused on delivering valuable resources. Your support keeps everything running smoothly and enables me to continue creating the content you love. I’m deeply grateful for your support, it truly means the world to me! Thank you!

BITCOIN

Bitcoin Logo

Bitcoin QR Code

bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge

Scan the QR code with your crypto wallet app

DOGECOIN

Dogecoin Logo

Dogecoin QR Code

D64GwvvYQxFXYyan3oQCrmWfidf6T3JpBA

Scan the QR code with your crypto wallet app

ETHEREUM

Ethereum Logo

Ethereum QR Code

0xe9BC980DF3d985730dA827996B43E4A62CCBAA7a

Scan the QR code with your crypto wallet app

Please read the Privacy and Security Disclaimer on how Techcratic handles your support.

Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.

Tags: AI NEWS
Share162ShareTweet101
Previous Post

TerraPower lands $650M from NVIDIA and Bill Gates

Next Post

Framework Laptop 12 review: I’m excited to see what the 2nd generation looks like

AI

AI

Explore the dynamic realm of AI, where breakthroughs and trends are shaping the future. Stay informed and see how AI is making an impact. Don’t miss the crucial updates—read the latest articles here at Techcratic.

Related Posts

Artificial Intelligence
AI

Update on the AWS DeepRacer Student Portal

June 19, 2025
1.3k
Artificial Intelligence
AI

INRFlow: Flow Matching for INRs in Ambient Space

June 19, 2025
1.3k
Artificial Intelligence
AI

How Apollo Tyres is unlocking machine insights using agentic AI-powered Manufacturing Reasoner

June 16, 2025
1.3k
Artificial Intelligence
AI

Automatically Build AI Workflows with Magical AI

June 16, 2025
1.3k
Artificial Intelligence
AI

Amazon Nova Lite enables Bito to offer a free tier option for its AI-powered code reviews

June 11, 2025
1.4k
Artificial Intelligence
AI

Bridging the Gap: New Datasets Push Recommender Research Toward Real-World Scale

June 11, 2025
1.3k
Artificial Intelligence
AI

7 Python Errors That Are Actually Features

June 10, 2025
1.3k
Artificial Intelligence
AI

10 Awesome OCR Models for 2025

June 6, 2025
1.3k
Load More
Next Post
Framework Laptop 12 review: I’m excited to see what the 2nd generation looks like

Framework Laptop 12 review: I’m excited to see what the 2nd generation looks like

Leave a Reply Cancel reply

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

Your Tech Resources

  • 30 Second Tech ™
  • AI
  • App Zone ™
  • Apple
  • Ars Technica
  • CNET
  • ComputerWorld
  • Crypto News
  • Cybersecurity
  • Endgadget
  • Forbes
  • Fossbytes
  • Gaming
  • GeekWire
  • Gizmodo
  • Google News
  • Hacker News
  • Harvard Tech
  • I Like Cats ™
  • I Like Dogs ™
  • LifeHacker
  • MacRumors
  • Macworld
  • Mashable
  • Microsoft
  • MIT Tech
  • PC World
  • Photofocus
  • Physics
  • Random Tech
  • Retro Rewind ™
  • Robot Report
  • SiliconANGLE
  • SlashGear
  • Smartphone
  • StackSocial
  • Tech Art
  • Tech Careers
  • Tech Deals
  • Techcratic ™
  • TechCrunch
  • Techdirt
  • TechRepublic
  • Techs Got To Eat ™
  • TechSpot
  • Tesla
  • The Verge
  • TNW
  • Trusted Reviews
  • UFO
  • VentureBeat
  • Visual Capitalist
  • Wired
  • ZDNet

Tech News

  • 30 Second Tech ™
  • AI
  • Apple Insider
  • Ars Technica
  • CNET
  • ComputerWorld
  • Crypto News
  • Cybersecurity
  • Endgadget
  • ExtremeTech
  • Fossbytes
  • Gaming
  • GeekWire
  • Gizmodo

Tech News

  • Harvard Tech
  • MacRumors
  • Macworld
  • Mashable
  • Microsoft
  • MIT Tech
  • Physics
  • PC World
  • Random Tech
  • Retro Rewind ™
  • SiliconANGLE
  • SlashGear
  • Smartphone
  • StackSocial
  • Tech Careers

Tech News​

  • Tech Art
  • TechCrunch
  • Techdirt
  • TechRepublic
  • Techs Got To Eat ™
  • TechSpot
  • Tesla
  • The Verge
  • TNW
  • Trusted Reviews
  • UFO
  • VentureBeat
  • Visual Capitalist
  • Wired
  • ZDNet

Site Links

  • About Techcratic
  • Affiliate Disclaimer
  • Affiliate Link Policy
  • Contact Techcratic
  • Dealors Discount Store
  • Privacy and Security Disclaimer
  • Privacy Policy
  • RSS Feed
  • Site Map
  • Support Techcratic
  • Techcratic
  • Tech Deals
  • TOS
  • 𝕏
Click For A Secret Deal

Techcratic – Your All In One Tech Hub © 2020 – 2025
All Rights Reserved
∞

No Result
View All Result
  • 30 Second Tech ™
  • AI
  • App Zone ™
  • Apple
  • Ars Technica
  • CNET
  • Crypto News
  • Cybersecurity
  • Endgadget
  • Gaming
  • I Like Cats ™
  • I Like Dogs ™
  • MacRumors
  • Macworld
  • Tech Deals
  • Techcratic ™
  • Techs Got To Eat ™
  • Tesla
  • UFO
  • Wired