Ai Agents (the Working Mechanism Of Llms)

Sanskar singhSanskar singh
2 min read

LLMs vs Agents

LLMs (Large Language Models) are powerful models which are trained on large text data .

It is helpful to generate codes provide answers and much more tasks.

The Real Disadvantage :

LLMs don’t have context of real time data. Such as they cant tell the weather updates.

They can’t perform actions like create file ,send email or Write in file with their own.

Here comes the Agents →

Agents use LLMs along with they have few tools to take decision, get real time information,

to achieve the goal.

Cursor is also a Agent having thousands of tools.

Tools of Agents

Few Basics tools are →

  • File Handling : Read / Write in file.

  • Code execution : python interpreter.

  • API and external services : Send / Read Email , Read / Write in Database.

Tool to write in a file.


def write_file(filePath, content):
    with open(filePath, 'w') as file:
        file.write(content)

Tool to run command in terminal

import os
def run_command(cmd : str): 

  if cmd.startswith("cd "):
        try:
            path = cmd[3:].strip()
            os.chdir(path)
            return f"Changed directory to: {os.getcwd()}"
        except Exception as e:
            return f"Error: {str(e)}"
  else:
        return os.system(cmd)

Mini Cursor

It is made by using the above tools. and the given System Prompt.

This can create a basics react app and for more enhancements we can add new tailwind tool and many more.

0
Subscribe to my newsletter

Read articles from Sanskar singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sanskar singh
Sanskar singh