···5050 uv sync
5151 cd ..
5252 ```
5353+### Embedding Pi
5454+5555+[Pi](https://github.com/badlogic/pi-mono) is a minimal coding agent for agentic harness. We embed Pi in Tiles so that it can sit in between the CLI and inference layer to provide more powerful features for the regular knowledge work, agent harness and whatever that comes in future is just an extension away thus making Tiles flexible and can ride the wave of standards.
5656+5757+Current approach on how we integrate Pi is, we pack the pi bun binary with the tiles installer and use Pi in rpc mode from Tiles. So Pi interacts with the Tiles model inference and communicates with the Tiles Pi via stdin, stdout json.
5858+5959+6060+#### Setting up PI
6161+6262+For development, Tiles expect a `pi` folder under `.tiles_dev/tiles/` (This folder is created first time when we run tiles from the root directory with `cargo run`). We can run `just build_w_pi` which will handle downloading and extracting the relevant Pi binary.
6363+6464+53655466## Running Tiles (Development)
5567···74867587> **Tip:** Refer to the `justfile` for additional common commands and automation. For troubleshooting, see [CONTRIBUTING.md](CONTRIBUTING.md) and open an issue if you need help.
76887777-### Building Tiles installer (Development)
8989+## Building Tiles installer (Development)
78907991Install [venvstacks](https://github.com/lmstudio-ai/venvstacks?tab=readme-ov-file#installing) for portable py runtime
8092···91103```
9210493105Now `tiles` should be available in PATH
9494-9595-9696-### Development with PI
9797-9898-[Pi](https://github.com/badlogic/pi-mono) is a minimal coding agent for agentic harness. Instead of providing harness by ourselves we will be leveraging Pi.
9999-100100-101101-Current approach on how we integrate Pi is, we pack the pi bun binary with the tiles installer and we switch to Pi repl from tiles cli, if harness is required. There are two ways we can do communicate with Pi, either via rpc mode or directly use the pi binary and get into the whole Pi ecosystem.
102102-103103-For better maintainability and to be update with Pi, using rpc mode is the way. But as we are in experimental mode with Pi, for now we wont use rpc instead completely use Pi's repl and UI. So at this stage we use our own fork for tighter integration with Tiles system. But this can change later. So Pi will be available under a flag `tiles -p` or `tiles run -p <MODELFILE_PATH>`
104104-105105-106106-#### Setting up PI
107107-108108-`git clone https://github.com/tilesprivacy/tiles-pi/tree/feat/integrate-w-tiles`
109109-110110-`npm install` - for installing the deps
111111-112112-```
113113-export TILES_PI_BUILD_ENV=debug # (other values: release)
114114-export TILES_PI_DEV_CONFIG_PATH=<TILES_REPO_PATH>/.tiles_dev/tiles
115115-```
116116-117117-Set these env vars. `TILES_PI_BUILD_ENV` is used to find the correct config.toml file for Pi to read. tiles-pi rely on config.toml for user data directory, current model etc. At this point config.toml act as a shared memory for tiles-pi and tiles. For development we use `debug` value. If debug mode then it uses `TILES_PI_DEV_CONFIG_PATH`. So internally all the app-files, user-data etc are in a .tiles_dev folder at the root of project. Pi also creates it agent directory here under `.tiles_dev/tiles/data/pi/agent`.
118118-119119-If mode is anything other than debug, then its release mode and the config.toml path is fixed, so need to worry about. Important thing to note is pi/agent directory will be in the tiles user data directory.
120120-121121-To work with Pi we need to run Pi on a terminal and tiles inference py server on another, and tiles daemon shld also be running background.
122122-123123-- Running Pi
124124- - From root of `tiles-pi` run `npm run build && ./pi-test.sh`
125125-- Running py server
126126- - From root of `tiles` run `just serve`
127127-- Running tiles daemon
128128- - First check if daemon is already running by `curl -X GET http://127.0.0.1:1729/`, if its returning tiles version, then daemon is running and its fine.
129129-130130- - If above curl failed, then do `cargo run -- -x`. This will run tiles in non-repl mode, simultaneously running a deamon in background.
131131-132132-Now these are running, u can jump into pi repl and do stuff with the model
133133-134134-Later if we need to test the e2e integration in development, we need to build the tiles-pi binary and extract the artificats into `.tiles_dev/tiles/pi`.
135135-For that we can run `just build_w_pi`.
136106137107138108## Additional Resources
···11+# Tiles toolchain
22+# Here we can find all the info related to libs,tools that either Tiles embed with it or Tiles rely on development. This is used for tracking the versions etc, which then can be used by other programs or scripts to derive values runtime.
33+44+55+[embedded-tools]
66+pi = "v0.67.68"
77+sqlcipher = "4.10.0"
88+99+[dev-tools]
1010+venvstacks = "0.8.0"
1111+1212+# grep '^pi' toolchain.toml | head -1 | awk -F'"' '{print $2}'