Metadata-Version: 2.5
Name: emagine
Version: 0.1.0
Summary: Deploy and manage agents hosted on the Emagine platform.
Project-URL: Homepage, https://aria-portal.emaginest.com
Project-URL: Documentation, https://aria-portal.emaginest.com/docs
Author: Emagine Solutions Technology
License-Expression: LicenseRef-Proprietary
Keywords: agents,ai,cli,deploy,emagine
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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
Requires-Python: >=3.10
Requires-Dist: click<9,>=8.1
Requires-Dist: httpx<1,>=0.27
Requires-Dist: pathspec<1,>=0.12
Requires-Dist: tomli>=2; python_version < '3.11'
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: starlette==1.10.0; extra == 'test'
Requires-Dist: uvicorn==0.54.0; extra == 'test'
Description-Content-Type: text/markdown

# emagine

The command line for agents hosted on Emagine. Build an agent with any Python
framework, run `emagine deploy`, and call it at
`POST https://ai-api.emaginest.com/v1/agents/{slug}/invocations`.

## Install

```bash
uv tool install emagine
```

[uv](https://docs.astral.sh/uv/) installs `emagine` in an environment of its
own and puts the command on your `PATH` (if the shell does not find it, run
`uv tool update-shell`). Upgrade with `uv tool upgrade emagine`. Without uv,
`pip install emagine` works too, ideally in a virtual environment.

Python 3.10 or newer. It depends on `click`, `httpx` and `pathspec` only, with
no AWS SDK.

## Log in

```bash
emagine login
```

This asks for an API key with hidden input, checks it, and saves it to
`~/.config/emagine/credentials` with mode 0600 (under `$XDG_CONFIG_HOME` if
that is set). Use a live key with the `deploy` permission to manage agents,
and `chat` to invoke them. `EMAGINE_API_KEY` overrides the saved key, and
`EMAGINE_BASE_URL` overrides `https://ai-api.emaginest.com`.

## Quickstart

```bash
emagine init --template langgraph my-agent
cd my-agent
emagine agents create
emagine deploy
emagine invoke "hi"
```

`init` writes `emagine.toml`:

```toml
agent = "my-agent"      # the slug
python = "3.12"         # 3.10 to 3.14
entrypoint = "main.py"
```

Commands that act on an agent take its slug from `emagine.toml`, or from
`--agent` (or an argument) when run elsewhere.

## Commands

| Command | |
|---|---|
| `login` | Save an API key |
| `init --template NAME [DIR]` | Start a project from a template |
| `agents create [SLUG] [--name] [--health-use]` | Create a hosted agent. `--health-use` (PHI, needs a BAA) cannot be changed later |
| `agents list` | Your hosted agents |
| `agents delete SLUG [--yes]` | Delete one, after you type its slug |
| `deploy [--no-activate]` | Zip, upload, build and make live, polling every 3 seconds. Ctrl-C stops watching, not the deploy |
| `status [N]` | The agent and its newest deployment, or deployment N with its build log |
| `versions` | Recent deployments; `*` marks the live one |
| `activate N` | Make deployment N live. Activating an older one is the rollback |
| `logs [--since 10m] [--follow]` | Recent log lines |
| `env list` / `env set NAME [--value-stdin]` / `env unset NAME` | Environment variables. Values are asked for with hidden input (or read from stdin), never taken as an argument, and take effect on the next deploy |
| `invoke [PROMPT] [--data JSON\|@file] [--stream] [--session ID]` | Call the agent. The answer goes to stdout and the session id to stderr. `--stream` goes through ai-stream |
| `kb upload KB FILES...` | Upload PDF, DOCX, TXT or Markdown files to a knowledge base |

## What `deploy` sends

`deploy` packages the project directory, leaving out `.git`, `.venv`, `venv`,
`__pycache__`, `node_modules`, and anything the root `.gitignore` or
`.emagineignore` excludes. It refuses, naming each file, any symlink and any
file that looks like a secret (`.env*`, `*.pem`, `*.key`, `id_rsa*`). There is
no override: keep secrets in `emagine env set`. The zip may be at most 50 MB.
It must contain a `requirements.txt` or `pyproject.toml` and the entrypoint.
Every dependency must have a prebuilt Linux arm64 wheel.

## Templates

| Template | Framework | Python |
|---|---|---|
| `plain` | none: `httpx` only, streams token by token | 3.12 |
| `langgraph` | LangChain `create_agent` (LangGraph) with `langchain-mcp-adapters` | 3.12 |
| `strands` | Strands Agents | 3.12 |
| `crewai` | CrewAI (telemetry off) | 3.11 |
| `openai-agents` | OpenAI Agents SDK (tracing off) | 3.12 |

Every template has the same `main.py`, an HTTP shell on port 8080 serving
`GET /ping` and `POST /invocations`. Your code goes in `agent.py`. The agent
reads `MODEL` (default `anthropic.claude-haiku-4-5`) and, optionally,
`KNOWLEDGE_BASE`, a slug whose documents it can search through MCP. Each
template's README shows how to run it locally first.

## Development

```bash
pip install -e '.[test]'
pytest
python scripts/check_templates.py   # every template resolves to arm64 wheels (needs uv)
python scripts/smoke_templates.py   # every template installs and answers a local stand-in gateway
```
