Metadata-Version: 2.4
Name: reinogent
Version: 0.3.6
Summary: Official Python SDK, ADK (Agent Development Kit) & CLI for building, downloading, and running AI Models, MCP Servers, and Agents from ReinoGent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: transformers
Requires-Dist: torch>=2.1.0; extra == "transformers"
Requires-Dist: transformers>=4.41.0; extra == "transformers"
Requires-Dist: safetensors>=0.4.0; extra == "transformers"
Requires-Dist: accelerate>=0.30.0; extra == "transformers"
Provides-Extra: embeddings
Requires-Dist: sentence-transformers>=3.0.0; extra == "embeddings"
Provides-Extra: mcp
Requires-Dist: mcp>=1.0.0; extra == "mcp"
Provides-Extra: agent
Requires-Dist: fastapi>=0.115.0; extra == "agent"
Requires-Dist: uvicorn[standard]>=0.32.0; extra == "agent"
Requires-Dist: httpx>=0.27.0; extra == "agent"
Provides-Extra: publish
Requires-Dist: huggingface_hub>=0.25.0; extra == "publish"
Provides-Extra: all
Requires-Dist: torch>=2.1.0; extra == "all"
Requires-Dist: transformers>=4.41.0; extra == "all"
Requires-Dist: safetensors>=0.4.0; extra == "all"
Requires-Dist: accelerate>=0.30.0; extra == "all"
Requires-Dist: sentence-transformers>=3.0.0; extra == "all"
Requires-Dist: mcp>=1.0.0; extra == "all"
Requires-Dist: fastapi>=0.115.0; extra == "all"
Requires-Dist: uvicorn[standard]>=0.32.0; extra == "all"
Requires-Dist: httpx>=0.27.0; extra == "all"
Requires-Dist: huggingface_hub>=0.25.0; extra == "all"

# `reinogent` — Official Python SDK, ADK & CLI (`v0.3.6`)

Python **SDK**, **ADK (Agent Development Kit)**, and `reino` **CLI** for discovering, publishing, downloading, building, and running **AI Models**, **MCP Servers**, and **Autonomous Agents** on ReinoGent.

## Installation

```bash
pip install reinogent

# Optional extras when needed:
pip install "reinogent[publish]"       # Push large model weights to Hugging Face
pip install "reinogent[transformers]"  # Run Hugging Face Transformers models locally
pip install "reinogent[embeddings]"    # Run sentence-transformers embedding models
pip install "reinogent[mcp]"           # MCP SDK support
pip install "reinogent[agent]"         # Run AgentApp HTTP servers (FastAPI + Uvicorn)
pip install "reinogent[all]"           # All optional extras
```

---

## Authentication & Terminal-Scoped Sessions

By default, `reino login` creates a **terminal-scoped session** tied to your current shell window. When you run `reino logout` or close your terminal, the CLI session closes automatically.

```bash
# Sign in for the current terminal session (shows linked apps & folder tips)
reino login

# Check active session, linked GitHub/HF accounts, and suggested commands
reino status      # alias: reino whoami

# Keep credentials across terminal restarts (optional, for CI/headless use)
reino login --persist

# Close session immediately
reino logout

# Inspect linked GitHub & Hugging Face accounts and list your repositories
reino connections
reino connections repos github
reino connections repos huggingface
```

---

## Interactive Step-by-Step Publishing (`reino publish`)

Publish an **Agent**, **MCP Server**, or **AI Model** interactively without memorizing long flag combinations:

```bash
reino publish              # Choose Agent, MCP Server, or Model
reino publish agent        # Step-by-step Agent publisher
reino publish mcp          # Step-by-step MCP Server publisher
reino publish model        # Smart Model publisher (auto-fills if already uploaded!)

# Resume a saved draft anytime
reino publish agent --resume
```

### Wizard Navigation & Smart Features
- Type **`back`** at any prompt to edit the previous step.
- Type **`save`** to save a draft (`~/.reinogent/drafts/`) and resume later with `--resume`.
- Type **`cancel`** to exit cleanly (with an option to save progress).
- **Guided Path Validation**: When uploading local files/folders to GitHub or Hugging Face, `reino` shows path examples, strips accidental quotes, verifies contents, and prints actionable corrections if a path is invalid.
- **Intelligent Model Flow**: If your model is already on Hugging Face, GitHub, or Ollama, pick the repo or paste the URL — `reino` auto-fills the model card without asking for a local folder.

### Push Security & `.gitignore` Protection

When pushing or uploading folders (`reino push` or `reino publish`), `reinogent` automatically:
- Excludes `.env`, `.env.*` (while keeping `.env.example` / `.env.sample`), private keys (`*.pem`, `*.key`, `id_rsa`), credentials (`credentials.json`, `.npmrc`), local databases, and `.gitignore` entries.
- Scans source files for accidental hardcoded tokens/API keys and ensures `.gitignore` protects sensitive files in the pushed repo (pass `--allow-secrets` only to override false positives on code files).

### Non-Interactive Pushing (`reino push`)

For scripts or CI pipelines, push directly with flags:

```bash
reino push agent . --repo my-agent --publish
reino push mcp . --repo my-mcp-server --publish
reino push model ./weights --repo my-model --publish
```

---

## Smart Discovery, Pulling & Running (`reino list`, `pull`, `run`)

Target any resource by **ID**, **slug**, or **name** (even multi-word names, and omitting the resource type when unambiguous):

```bash
# Browse the catalog
reino list agents
reino list models --african
reino list mcp --transport stdio

# Inspect metadata & required dependencies
reino info "Vera Agent"
reino deps agent "Vera Agent"
reino deps model bge-small-en-v1-5

# Pull resources (supports canonical slug, name, or ID)
reino pull vera-agent
reino pull "Vera Agent"                  # Auto-detects resource type
reino pull model bge-small-en-v1-5 --install-deps
reino pull mcp github-mcp-server --config
```

### Hosting & Modality-Aware `reino run`

`reino run` automatically reads `reino.json` or `reinogent_manifest.json` (or resolves a remote agent by name/ID) and handles it according to its **hosting type** and **supported modalities**:

- **Hosted Cloud Agents**: Authenticates, validates `--file` attachments against accepted input modalities (`text`, `image`, `file`, `audio`, `video`), and opens an interactive chat with `/attach <path>` or runs a single `--prompt`.
- **Voice Agents**: Explains real-time WebSocket audio streaming, launches the browser voice session (`--open`), or accepts audio/text turns when supported.
- **Local Agents**: Connects directly to the configured `local_endpoint` (`reino`, `openai`, `ollama`, `custom`), or runs `.env` & `requirements.txt` / `package.json` pre-flight checks before launching locally (`--serve` / `--install-deps`).
- **Open-Source Agents (no hosted endpoint)**: Inspects `.env` / `.env.example` and dependencies, prints clear setup steps (or lets you install/configure `.env` interactively), runs local entrypoints when ready, or suggests `reino chat` ADK execution.
- **External Web Apps**: Displays and optionally opens the live web app URL.

```bash
reino run .                              # Run bundle in current directory
reino run ./vera-agent                   # Run pulled agent bundle
reino run "Cloud Guardian"               # Run marketplace agent directly
reino run ./my-agent --file ./doc.pdf --prompt "Summarize this"
reino run ./my-agent --serve             # Start local agent HTTP server
```

---

## Build & Scaffold Agents (`reino init` & `AgentApp`)

```bash
# Guided scaffold (or pass flags directly)
reino init
reino init "Swahili Support Bot" --hosting local --model bge-small-en-v1-5 --mcp github-mcp-server
```

`reinogent.AgentApp` includes built-in CORS (for browser-direct Local Testing on ReinoGent), HMAC-SHA256 verification, and attachment helpers:

```python
import reinogent

app = reinogent.AgentApp(
    name="My Agent",
    model="<model-slug>",
    mcp_tools=["<mcp-slug>"],
)

@app.on_message
async def handle(ctx: reinogent.AgentContext):
    # Access ctx.input, ctx.history, ctx.attachments, ctx.image_attachments, ctx.text_attachments
    return f"Received: {ctx.input}"

if __name__ == "__main__":
    app.serve(port=8001)
```

---

## ReinoGent ADK (Local Agents + Live MCP Tools)

```python
from reinogent.adk import Agent, LocalAgentRunner, SequentialWorkflow, tool

@tool
def add(a: int, b: int) -> int:
    """Add two integers."""
    return a + b

# Build an agent with a local or cloud model + live MCP tools
with Agent(
    name="DevHelper",
    model="ollama/qwen2.5:7b",
    instructions="You are a concise developer assistant.",
    tools=[add],
    mcp_servers=["<mcp-slug>"],
) as agent:
    print(agent.ask("Add 12 + 8"))

# Or run a ReinoGent agent locally by name or ID with your own model:
with LocalAgentRunner.from_reinogent(
    agent_id="Cloud Guardian",
    model="ollama/llama3.2:3b",
    mcp_servers=["<mcp-slug>"],
) as local_agent:
    print(local_agent.ask("Summarize my latest tasks"))
```

### Run Local Agents from the Terminal (`reino chat`)

```bash
reino chat "Cloud Guardian" --model ollama/qwen2.5:7b --mcp <mcp-slug>
reino chat --model ollama/llama3.2:3b --session my-session
```

---

## ReinoGent Web (`reino ui` / `reino studio`)

Open **ReinoGent Web** in your browser to chat, talk via live voice, configure models, test live MCP tools, and inspect execution streams:

```bash
reino ui                                         # Open ReinoGent Web
reino ui ./vera-agent                            # Open a pulled bundle in ReinoGent Web
reino ui "Vera Agent" --mode voice               # Open live voice in ReinoGent Web
reino ui --model ollama/qwen2.5:7b --mcp github-mcp-server
reino run "Vera Agent" --ui                      # Or pass --ui to `reino run`
```

From Python SDK/ADK:

```python
agent.launch_ui()   # Open ReinoGent Web for an ADK Agent
app.launch_ui()     # Open ReinoGent Web for a ReinoGent AgentApp
```

---

## Ecosystem Linking & External Interop (`link`, `export`, `serve-mcp`, `integrate`)

### Connect MCP <-> Agent <-> Model

```bash
# Link or unlink MCP servers & models to an agent (Hub or local `reino.json`)
reino link mcp github-mcp-server --to-agent my-agent
reino link model bge-small-en-v1-5 --to-agent my-agent
reino link model ollama/qwen2.5:7b --mcp github-mcp-server   # Generates a runnable Model+MCP bundle
reino link show "Vera Agent"
reino unlink mcp github-mcp-server --from-agent my-agent
```

In Python (`reinogent.compose` & `ExternalAgentAdapter`):

```python
from reinogent import compose, ExternalAgentAdapter, MCPToolset

# Wire any Model + local stdio or remote HTTP MCP servers
agent = compose(
    name="ResearchBot",
    model="ollama/qwen2.5:7b",
    mcp_servers=["github-mcp-server", MCPToolset.from_url("remote", "https://example.com/mcp")],
)

# Bring ANY external service (LangChain, CrewAI, AutoGen, OpenAI HTTP, webhook) into ReinoGent
adapter = ExternalAgentAdapter(name="My CrewAI", endpoint_url="http://127.0.0.1:9000/invoke")
# adapter.serve(port=8001)
```

### Connect External MCP Clients & Frameworks

```bash
# Export ready-to-paste or auto-merged config for Claude Desktop, Cursor, Windsurf, VS Code
reino export mcp github-mcp-server --client claude --write
reino export agent "Vera Agent" --client cursor

# Expose any ReinoGent agent, model, bundle, or the full catalog as a live stdio MCP server
reino serve-mcp --agent "Vera Agent"
reino serve-mcp --model ollama/llama3.2:3b

# Generate integration snippets or wrap external frameworks/resources into ReinoGent
reino integrate "Vera Agent" --framework langchain
reino integrate external --kind agent --source crewai --name my-crew --endpoint http://localhost:9000/invoke
```

---

## Upgrade & Diagnostics (`reino upgrade`, `reino doctor`)

```bash
reino doctor                         # Check Python, optional extras, CLI session, and local bundles
reino upgrade --check                # Check for newer ReinoGent SDK on PyPI
reino upgrade                        # Upgrade reinogent SDK/CLI
reino upgrade --all                  # Upgrade SDK + all pulled bundles & missing deps (preserves .env)
reino upgrade ./vera-agent           # Sync bundle metadata, code & requirements.txt
```

---

## Delete Resources (`reino delete`)

```bash
reino delete hf-file owner/repo path/to/file
reino delete hf-repo owner/repo
reino delete model <model-slug>
```

---

## Python SDK Helpers

```python
import reinogent

model = reinogent.load_model("<model-slug>")
local_dir = reinogent.download_model("<model-slug>", dest_dir="./weights")
mcp_cfg = reinogent.get_mcp_config("<mcp-slug>")
result = reinogent.run_agent("<agent-id>", "Hello", token="<your-token>")
is_valid = reinogent.verify_signature(body, x_reino_signature, x_reino_timestamp, SECRET_KEY)
```
