📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

AI-coding ИИ-агента в Cursor за 15 минут | AI Driven Development | Vibecoding

AI.Dialogs16:17

Transcription

Welcome to the AI Dialog channel. Today we are at IPde. We will demonstrate to you the AI Driven Development approach that we use for implementing commercial projects. We will create an AI assistant and go through the path from idea to deployment. AI Cursor. Let's go. Just as any project begins with an idea, so will our development begin with an idea. Let's fix it in our project for starters. For this, we will use the voice input function. We will ask the cursor to fix our idea in a file. Please fix my idea for developing an LM assistant in a file. The LM assistant should be implemented as a Telegram bot. The main task of the bot is to conduct dialogue with the user and answer their questions. The cursor fixes our idea. Here it is filling the file. The idea is fixed. It represents an intelligent bot that uses the capabilities of large language models to conduct dialogues with users and provide answers to their questions. The bot conducts natural dialogue, provides informative responses, and uses modern language models. Well, let's remove the unnecessary technical requirements and development possibilities from here. The idea is fixed. The next important step in the AI-driven approach is analytical preparation. Therefore, we will open a new tab by pressing Ctrl + T and design our solution together with the LM. We will create a Vision, in which we will consider the business, technological, and architectural aspects of creating our solution. This will be a full-fledged task definition for our AI assistant, which it will create for itself together with us. Our vision is ready, and now we have a complete understanding of what and how will be implemented by the artificial intelligence further. So, the solution is designed, and now let's agree with the AI assistant on the plan and process of joint work. Now we have a step-by-step plan for developing the LM bot. It is iterative and incremental, from developing a simple Telegram bot working in echo mode to integrating with the LM and deploying in Docker. By the way, the cursor allows you to conveniently preview MD files. Let's use this, look at our plan, and note a fundamentally important point: in the AI-driven approach, having such a step-by-step plan is very important, as it allows not only us to conveniently control the workflow but also the assistant to put only the necessary information into its context during the work on iterations. Having a work plan, we now only need to conclude an agreement with the language model on the execution of this plan. We will ask the language model to coordinate the solution plan with us before implementation, and after implementation, to wait for confirmation before committing and publishing the process in the task list. We have fixed the work process agreement in the Workflow file, and we see that it also refers to other files in our project, including the conventions MD file. And in this file, it makes sense to place any agreements that are accepted in your project or that you want to accept, whether it's agreements on writing code, designing databases, architectures, or documentation. Be sure to note what needs and can be done, how to do it, and what is strictly forbidden. You may have noticed that the Conventions and Workflow files have the MD extension. This means they are Cursor rules. But what is a rule? Let's start by saying that project rules are located in our project directory cursor/rules, but are also available in the cursor settings section. Here we see another new type of rule, user rules. These are the rules, instructions that are always added to the context of our language model's work. Well, let's talk about Project Rules in more detail. Let's open our rule and see four modes for adding this rule to the language model's work context at the top. The first mode is apply manually. It states that we ourselves must add this rule to the context of the language model's work, as we have just done. But there are more convenient ways for automatic addition. For example, the apply to specific files mode. It means that the rule will be added when the model works with specific files, with directories according to a pattern. There is an intelligent addition mode, when the assistant itself decides, depending on how fully and accurately we have made the description, when to add the rules to the context. And there is the supply mode, when the rule is always added to the context of our LLM model. We will use it now. Well, let's move on to the most exciting part. We are starting the development of our solution strictly according to the plan and in accordance with the rules established by us in Cursor. So, Cursor starts working, analyzes the task plan, determines what needs to be done, agrees with us, implements the first source codes, creates the project structure, informs us about the progress made in the form of a brief report at the end, and proposes a plan for testing the created bot. One of the first steps is to create an environment file and install the bot token there, which we will do now. Based on the example configuration file enf.example created for us, we will create an environment file. And now we need to get the Telegram token. And we will use a good practice here. We will ask the language model to prepare a clear step-by-step instruction for us on how to get it. We get the token and add it to our file tonn. We have generated the token, installed it. Now let's ask the cursor to launch the bot. We see that it first checks for the presence of the environment file and launches the bot start command in the inline console. It is worth noting that this is not the only way to launch the bot; we will talk about other ways at the end of the video. Let's check that our bot is actually working, launch it, write it a few messages, and see that the bot responds to us in echo mode with our own messages. In the console logs, we will see the messages that our bot output during testing. And after testing, the cursor marked the progress in the task plan, made a commit to the repository, and reported its readiness to proceed to the next iteration. Similar to the execution of the first iteration, we will complete the execution of all remaining iterations with our full control and understanding of everything that happens along the way, testing our bot after each iteration. We will integrate the language model into our bot. We will implement support for conversational mode with message history. We will implement beautiful and reliable error handling, detailed logging, statistics collection, and containerization and packaging of our bot into a container for production deployment. Well, Cursor has finished its work, reported it in our chat that all six iterations have been successfully completed. Now let's see what we have in the project. And we see that we have a lot of files and directories. A Python file for working with message history, a Python module with classes for exceptional situations, handlers for our bot's commands, message handlers, interaction with LM models, use of the OpenAI client and direct calls to the Open Router provider. Additional files for collecting statistics on the use of LM models, counting tokens, counting messages, a configuration file, and setting up the logging system and logging to the console and file system. We have created files for building our Docker image, files for automating our project's development lifecycle, yes, this includes starting in development mode, installing dependencies, building the Docker image, starting the Docker container, stopping the container, viewing logs. Separately, a file that displays all the necessary dependencies of our project and generated readmes for a quick immersion into how to run our project. Let's open it in a format convenient for study. And we see that there is a brief instruction on how to set up the environment, how to run in development mode, how to deploy in Docker, and what settings need to be configured for our bot to work correctly. But let's imagine that a new developer has joined us, or we ourselves return to studying the project after some time. And despite the fact that we have documents describing the project idea, vision, conventions, it is very convenient to have instructions for such a quick start for a new employee. I have already asked for such an instruction to be created. And let's see what we have done, right? Technical vision, project status, brief project overview, its capabilities, presented system architecture, Telegram infrastructure, external services OpenRouter, storage of dialogue history, logs, and the bot itself, entry point, event handlers, commands and messages, business logic, infrastructure modules, configuration, logging, statistics, exception handling. The entire data flow is described, how our application works. And also, I asked to visualize this on a convenient sequence diagram of the entire application. The project structure is described. Well, and accordingly, then key components with code examples and references. Thus, you can quickly familiarize yourself with the project, understand how to develop it, how it works, how to test it, how errors are handled in it, links to additional documentation contained in the project, and even the process and plan for participation and further development. Well, let's launch our bot now. Earlier, we did this through the chat by writing: "Launch the bot." But it's not very efficient to ask the language model to launch our application every time. However, it can be useful because in this case, the language model monitors the launch and operation logs and can immediately correct errors. We will use the standard way of launching through the terminal. Select the New Terminal menu item and type the command make, as is generally suggested in the documentation. And let's launch our bot in development mode. We see that the bot is launched. Let's not check it yet, but restart the bot in Docker and see how it works. Let's use the image building instructions. Make build. So, the image is built. Let's run the Mykra command. Let's run the Mykl command to see what's happening in our image. So, we opened our Docker, our bot, logs. Let's look at the file system. The LKS folder is mounted to our host machine's file system. When the Docker stops, the logs will not be lost. So, we launched our bot. We press the start command. Let's say hello. How can I help? Let's check the message history. What is my name? We see that it remembers us perfectly. Everything is great, the bot is working. It works in a Docker container. Logs, welcome messages sent, text messages, token count, processing time. We have thus checked the working bot in our Docker container. And now it is ready for deployment to any server. Let's make a brief summary. So, we have reviewed the AI Driven development methodology in the Cursor tool. In the first step, we worked on the context, created a file with the description of our idea. Then we formed a technical vision for the development of our project. We created agreements for development, for writing code, made an iterative incremental task list with a plan of tasks for each iteration. We created a description of the work process, asked it to coordinate the plan before implementation, give confirmation before moving to the next iteration, follow the tasks in the task list, update progress, make commits after completing the iteration, which it successfully did. And in the end, we got a working bot, which we observed. I want to emphasize again that with the demonstrated methodology, you can implement practically any of your ideas at any intersection of technologies. As for the basic LM assistant implemented within these six iterations, of course, with the help of the demonstrated approaches, this assistant also smoothly, easily, confidently develops in terms of technical and architectural concepts, whether it's connecting automated tests, persistent data storage, multimodal operation mode, support for local language models, integration of vector databases, building quality assessment pipelines, implementing monitoring systems, and finally, forming a basic assistant into a full-fledged agent. But this solution also transforms into complete products, such as smart assistants for personal use, tutors, mentors, advisors, copywriters, and, of course, products and processes that automate business processes, HR departments, customer support, sales managers, secretarial work, correspondence classification, or an assistant for the legal department. All these cases are successfully implemented by employees and companies undergoing our corporate training, as well as students in public programs, whose feedback we publish on our AI Dial Telegram channel. You can see them on the screen now. And we invite all graduates and give them access to a closed club, a community for the development and business application of generative artificial intelligence. To register for corporate training and for access to the club, write to Telegram smirnov_AI. And so that the demonstrated methodology remains not just knowledge in your head, but grows into a practical skill and allows you to implement all your ideas, projects in the very near future, or simply reach a new level of productivity and efficiency, go to landing llmstar.ru/idd via the QR code and sign up for the upcoming accelerated program sessions. We are waiting for you. This was your AI Dialogs.