---
title: "Pass few arguments · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/names-and-functions/few-arguments
updated: 2026-10-20
licence: "All rights reserved"
---

# Pass few arguments

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Names and functions](https://agentwranglers.se/playbook/architecture/names-and-functions)
- Rule: Give a function at most three arguments. When it needs more, pass one named object that groups them.
- How: Group arguments that travel together into a parameter object or DTO, such as `ShippingAddress`. In Python use a dataclass, in PHP a small class with named arguments, in Java a record. Replace boolean flags with two functions, because a flag means the function does two things.
- Check: ESLint `max-params` set to 3, PHPMD `ExcessiveParameterList` with a minimum of 4, or Pylint `too-many-arguments` with `max-args=3`.

Example:

```ts
// Bad
createOrder(customerId, street, city, postcode, country, true);
// Good
createOrder({ customerId, shippingAddress, giftWrap: true });
```

```python
@dataclass(frozen=True)
class NewOrder:
    customer_id: str
    shipping_address: ShippingAddress
    gift_wrap: bool = False

create_order(NewOrder(customer_id, shipping_address, gift_wrap=True))
```

```php
createOrder(new NewOrder(customerId: $customerId, shippingAddress: $address, giftWrap: true));
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/names-and-functions/few-arguments`.

- Previous: [Keep nesting shallow](https://agentwranglers.se/playbook/architecture/names-and-functions/shallow-nesting)
- Next: [Make each function do one thing](https://agentwranglers.se/playbook/architecture/names-and-functions/one-thing-per-function)
- [Names and functions](https://agentwranglers.se/playbook/architecture/names-and-functions)
