# How to wrap my agent with Aitm?

You may want to create a wrapper script (a shim) so that:

* your IDE/Agent orchestrator would detect your agent
* you would call then the wrapper script (ie *pi*) instead of *aitm pi*
* you can set your own [env](env "env")

## Example: Steps by step

* Create a wrapper script at *\~/.local/bin* for example for *pi*:

```bash
#!/usr/bin/env bash
set -Eeuo pipefail

# takes the second one in the path
PI_PATH="$(which -a pi | sed -n '2p')"
if [ ! -f "$PI_PATH" ]; then
  echo "Pi not found at $PI_PATH."
  exit 1
fi

# execute it
aitm cli exec "$PI_PATH" "$@"
```

* verify that it's first in your *PATH*

```bash
which -a pi
```

```txt
/home/user/.local/bin/pi
/node/bin/pi
```

## Configuration

### Shim directory

When searching for [command](executable#how-aitm-searches-the-executable "executable#how-aitm-searches-the-executable"), the files (not the symlink) in this directory and subdirectories are excluded to avoid recursion (ie *aitm* calls a shim that calls *aitm* that calls the shim)

By default, the shim directory is the user home directory.

You can set it with:

* the *AITM_SHIM_DIR* [env](env "env")
* the *-sd* or *--shim-dir* option

Example:

```bash
AITM_SHIM_DIR=$HOME/shims aitm
```
