AI Agents for Business Apps: When to Build One and How
A practical guide to AI agents for product teams: how they differ from chatbots, where they fit, the guardrails they need and how to scope a first pilot.
Prompt injection is the top security risk for LLM-powered apps. Learn how attacks work and the practical controls your product and dev team should build in.
If you are adding a chatbot, an assistant or any large language model (LLM) feature to your product, there is a security problem that does not exist in traditional software: the model cannot reliably tell the difference between your instructions and the data it is processing. Attackers exploit that gap, and the technique is called prompt injection. It is listed as a leading risk in the OWASP Top 10 for LLM Applications, so any team shipping AI features should plan for it from day one.
This guide explains how prompt injection works in plain terms and gives product teams and their development partners a practical set of controls.
An LLM receives one long block of text: your system prompt, the user’s message, and often extra content such as documents, web pages, emails or search results. The model treats all of it as language to follow. If any part of that text contains instructions, the model may obey them, even when they come from an untrusted source.
There are two main forms:
Indirect injection is the harder one to defend against, because your own users may be the victims rather than the attackers.
The risk grows with what the model is allowed to do. A chatbot that only answers questions can leak its prompt or say something embarrassing. An assistant that can search your database, send emails, create tickets or call internal APIs can be steered into doing those things for an attacker.
Typical impacts include:
The most useful design principle is to treat LLM output the way you treat user input: untrusted until validated. The model is not a security boundary. Authorisation must be enforced by your application code, never by asking the model to “be careful”.
Give the model access only to what a given task needs. Use read-only credentials where possible, scope database queries to the current user, and avoid giving a single agent broad access to everything. If a user cannot see a record in your app, the model acting for that user must not be able to retrieve it either.
Check permissions in your backend on every tool call, using the authenticated user’s identity. Do not rely on the prompt to say “only show this user their own data”.
Sending money, deleting data, emailing customers or changing permissions should require explicit user confirmation in the interface, with a clear summary of what will happen.
Clearly delimit retrieved documents and user input in your prompts and tell the model they are data, not instructions. This reduces risk but does not eliminate it, so treat it as one layer, not the defence.
Ask for structured output (for example JSON against a schema) and validate it before acting on it. Never pass model output directly into a shell command, SQL query or HTML page without escaping and validation, as that creates classic injection and cross-site scripting flaws.
Indirect injection often exfiltrates data through links or images that the model is tricked into rendering. Restrict outbound requests, sanitise rendered markdown, and allow-list domains where possible.
Record prompts, tool calls and outcomes (with sensitive data handled according to your privacy policy) so unusual behaviour can be investigated. Rate limit users and agents to contain abuse.
Security controls need evidence. Build an adversarial test set and run it before each release, especially after prompt, model or tool changes.
| Test area | Example check |
|---|---|
| System prompt leakage | Does the assistant reveal hidden instructions when asked in different ways? |
| Data boundaries | Can one user’s session retrieve another user’s data? |
| Tool abuse | Can crafted input trigger a tool call the user is not entitled to? |
| Indirect injection | Does a document containing hidden instructions change behaviour? |
| Output handling | Is model output escaped before it reaches the browser or a database? |
Automated evaluations catch regressions, but manual red-team sessions find creative attacks that scripts miss. Our guide to testing AI features and LLM evaluation covers how to structure this alongside quality testing.
Prompt injection cannot be patched away with a clever prompt, so the controls above need to be part of your architecture and test plan from the start. If you are still scoping your AI roadmap, read our post on adding AI features to existing apps first.
AkMo Technologies builds and tests web applications with AI features for international clients. Explore our web development services and software testing services, or contact us to discuss a security-minded approach to your next AI feature.
A practical guide to AI agents for product teams: how they differ from chatbots, where they fit, the guardrails they need and how to scope a first pilot.
How to use AI coding assistants with an offshore team: where they help, the IP and security risks, and the contract clauses and review rules to put in place.
Planning an AI customer support chatbot? Learn the scope, architecture, guardrails and testing steps that separate a useful assistant from a risky one.
Tell us about your platform, your product idea or the systems you want to modernise. Someone from our Chennai engineering team will get back to you personally.