Metadata-Version: 2.4
Name: ai-ify
Version: 0.4.0
Summary: Embed a subscription-backed AI agent inside any app, controlled the way the developer allows
Author: Brancaccio Lab
License-Expression: MIT
Project-URL: Homepage, https://github.com/Jay2owe/ai-ify
Project-URL: Documentation, https://github.com/Jay2owe/ai-ify/blob/main/docs/embedding-guide.md
Project-URL: Issues, https://github.com/Jay2owe/ai-ify/issues
Project-URL: Changelog, https://github.com/Jay2owe/ai-ify/blob/main/CHANGELOG.md
Keywords: ai agent,embedded assistant,agent client protocol,claude,codex
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: src/aiify/static/vendor/PAGE_CONTROLLER_LICENSE
Requires-Dist: agent-client-protocol<0.13,>=0.12
Provides-Extra: web
Requires-Dist: fastapi>=0.115; extra == "web"
Requires-Dist: uvicorn>=0.30; extra == "web"
Requires-Dist: websockets>=12; extra == "web"
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Requires-Dist: httpx>=0.27; extra == "test"
Requires-Dist: playwright<2,>=1.49; extra == "test"
Provides-Extra: release
Requires-Dist: build>=1.2; extra == "release"
Requires-Dist: twine>=6.1; extra == "release"
Dynamic: license-file

# ai-ify

Embed an AI agent inside any app. The person chats with it in a panel inside
the app (or opens a console on the same conversation); the agent runs on the
Claude or Codex subscription already logged in on the machine, and controls the
app only in the ways the app's developer allows: backend actions, named UI
commands, and an automatic tree of the page's controls.

## Install

```bash
pip install "ai-ify[web]"     # chat panel for FastAPI apps
pip install ai-ify            # control port and the aiify command only
```

Also needed: Node.js with `npx` (the first chat downloads the agent adapter, which
brings its own copy of Claude Code or Codex), and a Claude or ChatGPT subscription.
People who are not signed in get a "Sign in" card in the panel. No API key is used.

## Use

```python
from aiify import Agent, Profile
from aiify.actions import from_functions

agent = Agent(
    app="myapp",
    actions=from_functions({"notes.add": add_note, "notes.clear": clear_notes},
                           destructive=["notes.clear"]),
    profiles={"default": Profile(provider="claude")},
)
agent.mount(fastapi_app)          # chat panel + websocket + local control port
```

and in the page:

```html
<script src="/aiify/panel.js" defer></script>
```

The app can add its own context: rules on what the person typed or the model in use
(`When(prompt="cost", add_instructions=price_note)`), and buttons that start the
assistant with their own set-up (`launches={"explain": Launch(...)}`, then
`<button data-aiify-launch="explain">`). See `python -m aiify.context context`.
Hooks before and after each message, suggested prompts, locked pickers, one-off
questions from code (`await agent.ask(...)`), attachments, app notes, and queued or
scheduled messages are each one switch: `python -m aiify.context chat-options`.

By default the agent searches local guidance with `aiify how` and reads an app map
when one is shipped. Extra web-route actions require `Agent(routes=True)` or a
list of path patterns. Developers can add an app map, written once by their
own agent from the source: `python -m aiify.appmap build myapp.main:app`. See
`python -m aiify.context discovery`.

Developers can also prepare missing backend actions before shipping:
`python -m aiify.prepare build ./myapp` generates wrappers, usage guidance and
real-app tests; `python -m aiify.prepare verify ./myapp/aiify_prepared` checks them.
Pass the reviewed, verified bundle with `Agent(prepared="myapp/aiify_prepared")`;
its actions and guidance start enabled. Each helper can be switched off explicitly. See `python -m aiify.context preparation`.

Destructive actions show a "Run it?" card before they run. Agents (the embedded
one, or any other on the machine) reach the running app with the `aiify` command:
`aiify apps`, `aiify --app myapp action.list`, `aiify --app myapp ui tree`.

## Documentation

- Usage guide, shipped with the package: `python -m aiify.context [topic]`, or
  `from aiify import context; print(context.read())`. Also as
  [README_AI.md](https://github.com/Jay2owe/ai-ify/blob/main/README_AI.md).
- [Embedding guide](https://github.com/Jay2owe/ai-ify/blob/main/docs/embedding-guide.md),
  with Circadian Workbench as the worked example.
- [Message format](https://github.com/Jay2owe/ai-ify/blob/main/docs/protocol.md).

## Development

```bash
python -m venv .venv
.venv/bin/python -m pip install -e ".[web,test]"     # Windows: .venv\Scripts\python.exe
.venv/bin/python -m pytest -m "not browser"          # browser tests need Edge or Playwright's Chromium
```

Releases are published by GitHub Actions when a `vX.Y.Z` tag matching the
package version is pushed ([RELEASING.md](https://github.com/Jay2owe/ai-ify/blob/main/RELEASING.md)).

Install name `ai-ify`, import name `aiify`. MIT licence. The bundled
`page-controller` (Alibaba, MIT) builds the page control tree.
