Skip to main content

H3 Harness SDK for Python

Python SDK for building H3-compliant agent harnesses.

Install

pip install h3-harness-sdk

Quickstart

from h3_harness import (
    BaseHarness,
    Decision,
    DecisionType,
    End,
    TextResponse,
    create_router,
)
from fastapi import FastAPI


class MyHarness(BaseHarness):
    async def on_process(self, req):
        return Decision(
            decision=DecisionType.TEXT,
            text=TextResponse(content="Hello from Python!", finished=True),
        )

    async def on_result(self, req):
        return Decision(decision=DecisionType.END, end=End(reason="task_complete"))


app = FastAPI()
app.include_router(create_router(MyHarness()))

Testbed

from h3_harness.testbed import MockHermes
from h3_harness.examples.echo import EchoHarness

mock = MockHermes(EchoHarness())
decision = await mock.send_message("Hello!")
assert decision.text.content == "Echo: Hello!"

Examples

  • echo.py — Echo harness that mirrors user messages
  • minimal.py — Minimal harness with health endpoint, uvicorn runner
  • langchain_agent.py — LangChain integration: LLM call with text response

Development

make install   # create venv + install deps
make build     # verify imports
make test      # run tests
make lint      # ruff check
make fmt       # ruff format

Reference

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

h3_harness_sdk-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file h3_harness_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: h3_harness_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for h3_harness_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59908a8ac57b6cb950db7272b71f03dd2842ce4b1d1728a69810ac2944725708
MD5 13963e790b171cfdac9f94bad604ee6a
BLAKE2b-256 da6c22bca4b262621da51e4a7496466aef9703888ef8b51147749a2ee5502b7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page