Skip to main content

HumanRPC

HumanRPC is a human-powered RPC framework designed for developing, staging, and deploying distributed systems.

Instead of waiting for every microservice, agent, or automated workflow to be fully built, your application calls typed, schema-validated endpoints. A human operator receives incoming requests in a real-time browser dashboard, provides or reviews a response, and HumanRPC delivers the result back to the waiting caller.

As you implement the automated versions of your endpoints, you can transition your code smoothly from human-only mockups to fully automated production services.


Features

  • Pydantic-First Validation: Fully typed request and response schemas verified at runtime.
  • Synchronous & Asynchronous Loops: Supports standard blocking ask() and async aask() client loops over HTTP and WebSockets.
  • Progressive Execution Modes:
    • manual: The human operator writes responses entirely from scratch in the UI.
    • assisted: The operator is in control but can trigger a local python function to pre-fill the form on-demand, editing it before submission.
    • review: The local function runs automatically to generate a draft. The human reviews, modifies, and approves it before returning the result to the caller.
    • automated: The local function runs immediately and returns. The human console is bypassed entirely (while preserving a historical record).
  • Strict Client-Side Security: Restrict which execution modes are permitted. Setting lock_mode=True forces the orchestration server to strictly follow your local client's security settings (e.g., ensuring a human-in-the-loop review can never be bypassed programmatically).
  • Simulated Behaviors: Mock exceptions, failures, ignores, or timeouts directly from the web dashboard.

Installation

pip install humanrpc

Quick Start

1. Boot the Orchestration Server

Start the local service and browser dashboard:

humanrpc serve

Open http://127.0.0.1:1078 in your web browser to access the operator workspace.

2. Define and Call Endpoints in Python

Below is an example showing how to register a fully human manual endpoint, a secure human-verified endpoint with automated drafts, and a fully automated execution bypass.

import asyncio
from pydantic import BaseModel
from humanrpc import Client

# 1. Define your typed payload contracts
class ChatRequest(BaseModel):
    message: str

class ChatResponse(BaseModel):
    reply: str

# An automated handler that generates drafts or automates the task locally
async def agent_copilot(request: ChatRequest) -> ChatResponse:
    return ChatResponse(reply=f"[Copilot Draft] Received: '{request.message}'")

async def main():
    client = Client(base_url="http://127.0.0.1:1078")

    # A. STRICTLY MANUAL ENDPOINT
    # Human writes the response from scratch in the browser console
    human_agent = client.endpoint(
        name="human_only",
        input_model=ChatRequest,
        response_model=ChatResponse,
        default_mode="manual"
    )

    # B. HITL GUARD / REVIEW ENDPOINT WITH CLIENT-SIDE SAFETY LOCK
    # The client-side 'agent_copilot' automatically drafts a response.
    # The human reviews, modifies, and approves it in the UI.
    # 'lock_mode=True' blocks the server from ever bypassing the human verification step.
    reviewed_agent = client.endpoint(
        name="reviewed_agent",
        input_model=ChatRequest,
        response_model=ChatResponse,
        handler=agent_copilot,
        default_mode="review",
        lock_mode=True
    )

    # C. FULLY AUTOMATED BYPASS
    # The client-side handler executes immediately and resolves programmatically.
    # No pending tasks ever appear in the human console.
    auto_agent = client.endpoint(
        name="automated_agent",
        input_model=ChatRequest,
        response_model=ChatResponse,
        handler=agent_copilot,
        default_mode="automated"
    )

    # Dispatch tasks asynchronously
    task1 = asyncio.create_task(human_agent.aask(ChatRequest(message="Hello Human!")))
    task2 = asyncio.create_task(reviewed_agent.aask(ChatRequest(message="Safety Guard Chat")))
    task3 = asyncio.create_task(auto_agent.aask(ChatRequest(message="Speedy Auto Chat")))

    # Resolve executions
    # Task 3 completes instantly. Task 1 and 2 wait for your actions in http://127.0.0.1:1078
    print(await task3)
    print(await task2)
    print(await task1)

if __name__ == "__main__":
    asyncio.run(main())

CLI Inspection Utilities

Inspect backend state and manually register or mock responses directly from your terminal:

# List all registered endpoint interfaces
humanrpc inspect endpoints

# Show all current pending tasks awaiting human review
humanrpc inspect pending

# Force-resolve a request with a successful mock payload
humanrpc respond success <request_id> '{"reply": "Forced success"}'

# Force-resolve a request with a simulated client exception
humanrpc respond exception <request_id> ValueError '{"message": "Invalid value"}'

Status

Early development.

Metadata

Release files for humanrpc 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for humanrpc 0.1.6
File Size Uploaded Provenance Actions
humanrpc-0.1.6.tar.gz 12.1 kB Without provenance Details for humanrpc-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for humanrpc 0.1.6
File Interpreter ABI Platform Actions
humanrpc-0.1.6-py3-none-any.whl Python 3 none any Details for humanrpc-0.1.6-py3-none-any.whl

Total release size: 27.0 kB

Release files / humanrpc-0.1.6.tar.gz

Download URL humanrpc-0.1.6.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
58a415cc6148298ac62ae4b83f27f52cd7b83f60fab35566b61a3f8ed0625248
BLAKE2b-256 checksum
How to use checksums
77ad65484db5ba61f8e23248725f3ca009f4c2d818e71ad0e4a9ea1cb5dca110
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / humanrpc-0.1.6-py3-none-any.whl

Download URL humanrpc-0.1.6-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad1909aab15eeb4cb28c8501b737af1412c2be63b247040168dbb9f95fffb528
BLAKE2b-256 checksum
How to use checksums
efe8847c50e1f0ea93d86d48642fb9bcc9a41afba7516851f692f0faa7168b0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for humanrpc 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page