{"slug": "tell-your-ai-agent-what-it-was-created-to-do", "title": "Tell Your AI Agent What It Was Created to Do", "summary": "A developer argues that reliable AI agents depend on an explicit, versioned purpose statement rather than a bigger model or new framework, citing a customer-support agent demo that drafted marketing copy for refund questions and invented a tracking API. The proposed contract has four parts — role, scope, success criteria and refusal behavior — and is paired with strict tool scoping, since the model infers capabilities from the tool list. The writeup includes a dependency-free Python example defining purpose and tools, plus a should-do/should-refuse test list run on every prompt or tool change.", "body_md": "Last month I watched a team demo a \"customer support agent\" that could do everything — and therefore did nothing well. Ask it about a refund and it drafted marketing copy; ask about shipping and it confidently invented a tracking API. The fix wasn't a bigger model or a new framework — it was one sentence telling the agent what it was created to do.\n\nAgents have grown up. They're no longer chatbots with a personality — they call APIs, write files, and occasionally spend real money. Modern tool-calling makes it trivially easy to wire up capabilities, which means the bottleneck is no longer what agents *can* do. It's whether they know what they *should* do.\n\nAn LLM will always produce something for any input. Without an explicit mission, that \"something\" is whatever the pretraining average suggests — usually generic, occasionally harmful. That's fine for demos and expensive in production. The teams shipping reliable agents treat purpose like any other requirement: written down, versioned, and tested.\n\n\"You are a helpful assistant\" is not a purpose statement. It's a horoscope — it applies to everything and constrains nothing. A working purpose statement is a contract with four parts:\n\nWhy so strict? Because models are trained on the average of the internet. Every specific constraint you write pulls behavior away from that average and toward your application. And because the statement is written, you can test against it — which is what separates an agent from a demo.\n\nIn practice, instead of \"help with support,\" write: \"You are a billing support agent. You resolve invoice disputes and refund-status questions. Done means an answer with a cited invoice ID, or a clean escalation. Product and sales questions get transferred, not attempted.\"\n\nHere's the part junior tutorials skip: the model reads its capabilities from the tool list, not just your prose. Give a summarizer a database-delete tool and you've changed its purpose, whether you meant to or not. Tool scoping *is* prompt engineering.\n\nThe rule: every tool must map to a line in the purpose statement. If you can't name the sentence a tool serves, delete the tool.\n\n```\n# agent.py — a purpose-driven agent definition, no framework required\n\nPURPOSE = {\n    \"role\": \"Billing support agent for Acme.\",\n    \"scope\": \"Resolve invoice disputes and refund-status questions.\",\n    \"success\": \"Answer with a cited invoice ID, or escalate cleanly.\",\n    \"refusal\": \"For product or sales questions, transfer to the sales queue.\",\n}\n\n# Tools the mission actually needs — and nothing more\nTOOLS = {\n    \"lookup_invoice\": \"Fetch an invoice by ID. Returns amount, status, line items.\",\n    \"check_refund\": \"Check refund status for a given invoice ID.\",\n    \"escalate_to_sales\": \"Hand the conversation to the human sales queue.\",\n}\n# Note what is NOT here: no email tool, no delete tool, no web search.\n# Every extra tool is a new way for the agent to wander out of scope.\n\ndef build_system_prompt() -> str:\n    # Order matters: role first, then the job, then the guardrails.\n    return (\n        f\"You are {PURPOSE['role']} Your only job: {PURPOSE['scope']} \"\n        f\"Done means: {PURPOSE['success']} \"\n        f\"If a request is out of scope: {PURPOSE['refusal']}\"\n    )\n\ndef tools_for_model() -> list[dict]:\n    # Descriptions are written for the model, not for your teammates.\n    return [{\"name\": name, \"description\": desc} for name, desc in TOOLS.items()]\n\nif __name__ == \"__main__\":\n    print(build_system_prompt())\n```\n\nThis runs with zero dependencies, and that's the point: the hard part of agent design is the contract, not the plumbing. When you later plug this into your LLM client or framework of choice, this prompt and tool list are exactly what you version-control, review in pull requests, and argue about — like any other interface.\n\nIf purpose is a contract, contracts need tests. You don't need an eval platform on day one. A list of should-do and should-refuse inputs, run on every prompt or tool change, catches most drift before your users do.\n\n```\n// eval.ts — tiny scope tests for the billing agent\n\ntype Case = { input: string; expect: \"resolve\" | \"refuse\" };\n\nconst CASES: Case[] = [\n  { input: \"Invoice INV-1042 looks wrong, can you check?\", expect: \"resolve\" },\n  { input: \"Where is my refund for INV-993?\", expect: \"resolve\" },\n  { input: \"Write a blog post about our new product\", expect: \"refuse\" },\n  { input: \"Delete all invoices from last year\", expect: \"refuse\" },\n];\n\nasync function askAgent(prompt: string): Promise<string> {\n  // Wire this to your LLM client, passing buildSystemPrompt() + scoped tools.\n  return callModel(prompt); // your implementation\n}\n\nfor (const c of CASES) {\n  const out = await askAgent(c.input);\n  // Crude but effective: refusal phrasing signals the guardrail fired.\n  const refused = /sales queue|can(?:not|'t) help with that/i.test(out);\n  const ok = c.expect === \"refuse\" ? refused : !refused;\n  console.log(ok ? \"PASS\" : \"FAIL\", \"-\", c.input);\n}\n```\n\nThe regex check is deliberately crude — it won't grade answer quality, and it shouldn't yet. Its only job is to catch the worst failure mode: an agent happily doing work it was never created to do. Start here, wire it into CI, and upgrade to graded rubrics only once the scope is stable.\n\nReal-world tip: run these tests *before* adding any new tool. New capabilities are the number-one source of silent scope creep.\n\nWatch for two smells. First, your purpose statement needs the word \"and\" more than once or twice — \"resolve billing disputes and track shipments and answer product questions\" is three jobs wearing one nameplate. Second, the tool list spans domains that never appear in the same task.\n\nThe fix is unglamorous: one agent per job, each with its own four-part contract, plus a thin router that dispatches. Smaller scopes mean cheaper prompts, sharper tests, and failures that point at one contract instead of a pile of them. Multi-agent setups get complicated fast, so split only when the contract itself is straining — not because it looks impressive on an architecture diagram.\n\nAssuming the model \"gets it\" from the conversation or the tool names. It doesn't. Gaps get filled with the pretraining average — exactly the generic behavior you're trying to avoid.\n\nAdding tools \"because we might need them later.\" Every tool is an untested behavior surface, and the horror stories you've read about destructive agent actions usually started as a convenience.\n\n\"Be helpful, delightful, and world-class\" is untestable and therefore unenforceable. \"Resolve disputes with a cited invoice ID or escalate\" can be checked by a ten-line script.\n\nAn agent's purpose isn't a vibe — it's the most load-bearing line you'll write. Write it as a four-part contract (role, scope, success, refusal), scope every tool to that contract, and test the boundaries like any other requirement.\n\nNext steps:", "url": "https://wpnews.pro/news/tell-your-ai-agent-what-it-was-created-to-do", "canonical_source": "https://dev.to/shruti_sharma_a2350383861/tell-your-ai-agent-what-it-was-created-to-do-2i2n", "published_at": "2026-12-04 17:09:58+00:00", "updated_at": "2026-12-04 17:14:26.750696+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "artificial-intelligence"], "entities": [], "also_reported_by": [], "takeaway": "Write the agent's purpose as a four-part contract (role, scope, success, refusal) and delete any tool that doesn't map to a line in it, since the model reads capabilities from the tool list as much as from the prompt.", "recommendation": {"advice": "Define each agent's role, scope, success and refusal criteria in a versioned prompt, and remove any tool that doesn't map to a line in that purpose statement.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/tell-your-ai-agent-what-it-was-created-to-do", "markdown": "https://wpnews.pro/news/tell-your-ai-agent-what-it-was-created-to-do.md", "text": "https://wpnews.pro/news/tell-your-ai-agent-what-it-was-created-to-do.txt", "jsonld": "https://wpnews.pro/news/tell-your-ai-agent-what-it-was-created-to-do.jsonld"}}