What to do in a scenario where the improved version(especially the last version) whether it is of code or content or anything else is not right?
What if the model generated a code which has bug?
Is there a mechanism to handle that?
Reason to ask: It happened with me. And the workflow failed with error.
I ran the complete run_workflow code.
It generated the v1 code and produced the chart.
It generated the v2 code and failed while executing.
Hi,
Thank you for sharing your experience — that’s a very valid concern.
I should mention that I’m not very deeply involved with this specific course, but in general, when using AI-generated code, it’s important to review and validate the output yourself before running it end-to-end.
In courses like Generative AI for Software Development, the model can generate code that often works well, but it is not guaranteed to be correct every time. Issues like bugs, logical errors, or incompatibilities (as you experienced with the v2 version) can occur.
So in practice, it’s recommended to:
- Inspect the generated code before executing it
- Run it step by step rather than the full workflow at once
- Debug or adjust the code when something doesn’t look right
Your case is actually a good example of why human verification is still necessary when working with LLM-generated outputs.
I hope this helps clarify things, and feel free to share more details if you’d like a second look at the issue.
Actually the way we are developing here is we are creating agents(once deployed, without human involvement it should perform the task accuratly), which should do the task on their own. Which also involves asking LLM to generate code and then agent will execute that code to generate the final output.
So to check if there is any problem, we added one more step called reflection so that we can check if there is any issue with it and ask LLM to generate V2(improvised code) for the prev code version.
So I am looking for an answer if there is any design pattern which we can use to tackle this scenario.
Hi @ashutoshtechstack
You have a genuine question there, which is a challenge for most ai agents. In advanced ai agents this challenge is addressed by using a feedback loop in the code execution section. If the generated code fails to execute, the agent loops back one step with the error feedback and fixes its own code to execute again. However, there should be a limit on the number of tries the agent can do this, so that it does not get stuck in an infinite loop.