Skip to content

capabilityhostprotocol/chp-adapter-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chp-adapter-template

A starter template for building a CHP capability adapter — a governed, evidence-wrapped capability that any CHP host auto-discovers and any agent can call. Click “Use this template” to create your own adapter repo.

Full guide: Build a CHP adapter in 15 minutes

What you get

chp_adapter_example/
  __init__.py        # exports the adapter class
  adapter.py         # ExampleAdapter — one `greet` capability
tests/
  test_adapter.py    # conformance + behavior tests
pyproject.toml       # packaging + the chp.adapters entry point
Makefile             # make test | conformance | build | publish
.github/workflows/   # test on PR, publish to PyPI on tag

Quick start

pip install -e ".[dev]"
make test          # conformance checks + behavior test

Make it yours

  1. Rename the package and class. Pick chp-adapter-<name>:
    • directory chp_adapter_example/chp_adapter_<name>/
    • class ExampleAdapter<Name>Adapter
    • in pyproject.toml: name, [tool.hatch.build.targets.wheel] packages, and the entry point <name> = "chp_adapter_<name>:<Name>Adapter"
    • the adapter_id / adapter_name / adapter_tags class attributes
  2. Implement your capability in adapter.py. Each capability is an async def method(self, ctx, payload) -> dict decorated with @capability (give it an input_schema; emit domain events with ctx.emit(...)).
  3. Test: make test. A conformant adapter scores 100.
  4. Publish: make build && make publish (or push a v* tag to let the release workflow publish via PyPI Trusted Publishing). Any environment that pip installs your package discovers the adapter automatically through the chp.adapters entry point — no host config needed.

Get listed in the registry

Once your adapter is on PyPI, open a PR against capabilityhostprotocol/chp-core adding one entry to the community array in registry/adapters.json:

{
  "id": "chp-adapter-<name>",
  "pypi": "chp-adapter-<name>",
  "github": "https://github.com/<you>/chp-adapter-<name>",
  "category": "data",
  "description": "One line on what it does.",
  "status": "experimental",
  "tier": 2,
  "maintainer": "community"
}

Maintainers review for spam/intent only — not your code. Accepted entries appear on the adapters directory.

License

Apache-2.0. Replace with your own license if you prefer.

About

Starter template for building a CHP capability adapter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors