# Connect your Python AI agent to iMessage

Connect your Python AI agent to iMessage with Keiki. Your model and tools run on your server; Keiki handles the iMessage line and delivery.

[View imessage-python-agent on GitHub](https://github.com/Mail-0/imessage-python-agent)

## How do I connect my AI agent to iMessage?

1. Clone [Mail-0/imessage-python-agent](https://github.com/Mail-0/imessage-python-agent). Copy `.env.example` to `.env`, add your model credentials, and run `uv sync --locked`.
2. Deploy the Python server and [configure your Keiki agent in push mode](https://onkeiki.com/docs/external-harness#configure-an-agent) with the public HTTPS URL ending in `/keiki/turn`. Set the agent’s signing secret as `KEIKI_SIGNING_SECRET` on your host.
3. [Attach an iMessage line](https://onkeiki.com/docs/channels#imessage-lines) and text the agent. Try asking whether the example shop is open on Saturday.

Your code, your model, your servers. Keiki only handles the channels.

## Details

- Stack: Python, Starlette, OpenAI-compatible Chat Completions
- Channels: iMessage
- Docs: [/docs/external-harness](https://onkeiki.com/docs/external-harness)
