Taran Srivastava

AI-Generated Code: How Indian Businesses Can Ensure Quality, Security and Accountability

Published on: 
Q

Verification Standards: Beyond data residency, what specific frameworks should CTOs implement to verify that agent-generated code has been rigorously tested before merge?

A

An agent saying “the tests passed” isn’t verification. The checks have to run independently of the agent, in your CI pipeline, and the agent shouldn’t be able to edit the tests or the CI configuration to get a green build. At minimum, every agent-written change should go through type checking, linting and tests that cover the new behaviour. It’s also worth testing the tests: mutation testing deliberately introduces small bugs and shows whether your test suite actually catches them.

Security needs its own gate, separate from correctness. Code can pass every functional test and still be unsafe, and even agents that perform well on coding benchmarks still produce insecure code more often than you’d like. Static analysis and fuzzing should run before anything is merged.

You also want to limit the blast radius when something goes wrong. At ML.ai, the agent writes a plan up front and declares which files it will change. If it touches anything outside that set, the run stops. Every job runs in an isolated sandbox that is destroyed when the job finishes.

Q

Accountability: How can Indian engineering teams establish clear audit trails for agentic changes to satisfy compliance and security requirements?

A

At some point, an auditor will ask who changed something and why. Agents make that harder to answer: git records whoever ran the agent as the author, even though the agent wrote the code.

So for every agent-driven change, I’d log who requested it, the instruction the agent was given, the model and version, the context it pulled in, the commands it ran, the test results and the final diff.

Two technical details matter more than people expect. First, give the agent its own identity with restricted permissions, so agent activity and human activity are clearly separated in your logs. Second, store those logs somewhere the agent can’t write to.

Compliance is moving in the same direction. CERT-In’s new AI security auditing guidelines bring reportable AI incidents under its existing six-hour reporting rule and 180-day log retention requirement. They also call for an AI bill of materials: a record of the models, data, prompts and tools each system depends on. For agentic development, that means being able to show which prompts and tools an agent used, and that neither was misused. How strictly the newer requirements will be enforced isn’t clear yet, but I wouldn’t wait to find out. Retrofitting logging after an auditor has asked for it is painful.

Q

Human Oversight: What is the ideal balance between human sign-off and agent autonomy, and how can teams ensure this doesn't become a bottleneck as they scale development?

A

There’s no single right answer. The level of oversight should depend on how costly it is if a change turns out to be wrong.

Anything that’s hard to undo needs human sign-off every time: database changes, security, payments and anything that touches customer data. Lower-risk work like writing tests, updating dependencies and small cleanups can get a lighter review, but it still gets one. I don’t believe in merging code nobody has looked at.

In practice, review itself is rarely the bottleneck. The volume of review is. If an agent keeps sending large diffs to the same two senior engineers, you’ll get a backlog. Breaking work into small, focused changes helps a lot. The agent should also attach its test evidence to every diff, so reviewers are judging against something concrete. And review should be spread across the team, not left to senior engineers alone.

It’s also worth tracking how quickly approvals happen. If changes are routinely approved within seconds, nobody is really reviewing them. That’s review theatre, not review.

Start narrow: one agent, one type of task, one codebase. Review everything it produces for a month and look closely at what it gets wrong. Only expand the scope once the quality holds up. Autonomy should grow gradually, and separately for each type of task.

Q

Future Benchmarks: What should be the primary metric for Indian businesses to evaluate the reliability of AI-generated code compared to traditional manual development?

A

Escaped defects: bugs that reach production after merge, weighted by severity. Track them for agent-written and human-written changes in the same codebase, and you have a fair comparison.

The usual metrics don’t tell you much. Benchmark scores show how a model performed on someone else’s test set, not on your own messy repository. Approval rate only tells you how often reviewers clicked approve. Lines of code and pull request counts measure activity, not reliability. 

I’d pair it with a rework metric: the share of changes reverted or substantially rewritten within 30 days. If a change merged quickly but came back for fixes the following week, you didn’t actually save any time.

But you can only compare AI and human changes if you know which ones the agent wrote. That’s why the audit trail from my second answer matters so much. Teams that start logging now will have real data in six months. Teams that don’t will be going on gut feel.

The same logic applies to cost. Measure it per successful change, not per attempt. A change that’s cheap to generate but has to be redone isn’t cheap