---
title: "Run agent calls through the same business · Agent Wranglers"
url: https://agentwranglers.se/playbook/agents-as-users/safe-actions/same-rules-for-agents
id: AGT-23
level: Recommended
updated: 2026-10-22
tokens: 744
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Run agent calls through the same business rules as the app

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Safe actions](https://agentwranglers.se/playbook/agents-as-users/safe-actions.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: AGT-23
- Level: Recommended
- Chapter: [Safe actions](https://agentwranglers.se/playbook/agents-as-users/safe-actions.md)
- Rule: Agent tools call the same service functions as the app's own screens and API. No rule, limit or check exists in only one of them.
- Check: A test runs each business rule case through the HTTP API and through the MCP tool. Both give the same outcome. A search of the tool code finds no SQL and no direct database client.
- How: A separate agent endpoint that writes to the database directly skips the stock check, the price rule or the audit log sooner or later. Make each tool a thin adapter that maps arguments to an existing service call. Add a rule once, in the service, and every channel gets it. Tests for business rules run against the service, plus one test per channel that proves it calls the service. Validate arguments first, as [Design tools like a small public API](https://agentwranglers.se/playbook/ai-features/structured-output-and-tools/tool-design.md) says.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
server.registerTool('create_booking', bookingToolSpec, async (args, { auth }) =>
  toToolResult(await bookingService.create({ ...args, actor: actorsOf(auth.claims) })));
```

### Python example

```python
@mcp.tool(name="create_booking")
async def create_booking(slot: str, guests: int, ctx: Context) -> dict:
    return to_tool_result(await booking_service.create(slot=slot, guests=guests, actor=actors_of(ctx.auth.claims)))
```

## Sources

- [OWASP Top 10 for LLM Applications, LLM06 Excessive Agency](https://genai.owasp.org/llmrisk/llm062025-excessive-agency/)

## Related rules

- AIF-15 [Design tools like a small public API](https://agentwranglers.se/playbook/ai-features/structured-output-and-tools/tool-design.md) in AI features

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/agents-as-users/safe-actions/same-rules-for-agents">Agent Wranglers agents as users playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Return an undo handle with every agent change](https://agentwranglers.se/playbook/agents-as-users/safe-actions/undo-handle.md)
- [Safe actions](https://agentwranglers.se/playbook/agents-as-users/safe-actions.md)
