Loading vLEI.wiki
Fetching knowledge base...
Fetching knowledge base...
This comprehensive explanation has been generated from 48 GitHub source documents. All source documents are searchable here.
Last updated: October 7, 2025
This content is meant to be consumed by AI agents via MCP. Click here to get the MCP configuration.
Note: In rare cases it may contain LLM hallucinations.
For authoritative documentation, please consult the official GLEIF vLEI trainings and the ToIP Glossary.
HIO (Hierarchical Asynchronous Coroutines and I/O) is a Python library providing weightless hierarchical asynchronous coroutines with structured concurrency and asynchronous I/O, serving as the foundational async infrastructure for KERIpy and related KERI implementations.
HIO is a Python library that implements hierarchical asynchronous coroutines and asynchronous I/O operations specifically designed to support the KERI protocol ecosystem. The library provides a lightweight, structured approach to concurrent programming that aligns with KERI's design philosophy of "minimal sufficient means."
HIO is implemented in Python and serves as the core async infrastructure layer for:
The library's name stands for "Weightless hierarchical asynchronous coroutines and I/O in Python" and emphasizes its design goal of providing powerful concurrency capabilities without unnecessary overhead.
HIO is not a protocol specification itself but rather an implementation infrastructure that enables KERI protocol implementations to handle:
When implementing concurrent operations in HIO:
.recur() override when you're simply constructing Doers and handing them to a parent - this is cleaner and more straightforwarddoing.doify only when you genuinely need sub-generator functionality with actual suspension pointssuper().recur() when overriding .recur() to maintain normal DoDoer execution flowUnderstand the distinction between:
yield statements (required by Python generator syntax)Many uses of yield in the doify pattern are syntactically required but not functionally necessary for the operation's logic.
Structure your KERI implementation to mirror the protocol's logical layers:
Leverage HIO's weightless design:
When building KERI services:
The style guide indicates upcoming documentation for:
The choice of HIO for KERIpy was deliberate and based on three key alignment factors:
HIO implements Rich Flow Based Programming with Hierarchical Structured Concurrency. This programming paradigm defines applications as networks of processes where:
This approach is particularly well-suited for KERI's event-driven architecture where key events flow through validation pipelines, witness networks, and watcher services.
The hierarchical aspect of HIO provides:
This structure prevents common async programming pitfalls like:
HIO's coroutines are described as weightless, meaning:
This efficiency is critical for KERI implementations that may need to:
HIO provides non-blocking I/O primitives for:
All I/O operations are designed to never block the event loop, ensuring responsive systems even under high load.
HIO introduces the Doer pattern as its primary abstraction for concurrent operations. According to the KERIpy/HIO Style Guide, there are two main patterns for working with Doers:
doing.doify WrapperThis pattern wraps methods that construct and hand off coroutines to parent Doers:
class MigrateDoDoer(doing.DoDoer):
def __init__(self, agency, **kwa):
super(MigrateDoDoer, self).__init__(doers=self.migrateAgentsDo(), **kwa)
self.agency = agency
@doing.doify
def migrateAgentsDo(self):
for agent in self.agency.agents:
doer = MigrateDoer(agent=agent)
self.extend([doer])
yield
In this pattern:
@doing.doify decorator converts the method into a generatorself.extend()yield statement is syntactically required but not functionally necessary.recur() OverrideA simpler approach that directly overrides the .recur() method:
class MigrateDoDoer(doing.DoDoer):
def __init__(self, agency, **kwa):
super(MigrateDoDoer, self).__init__(**kwa)
self.agency = agency
def recur(self, tyme):
self.migrateAgentsDo()
return super().recur(tyme=tyme)
def migrateAgentsDo(self):
for agent in self.agency.agents:
doer = MigrateDoer(agent=agent)
self.extend([doer])
This pattern:
@doing.doify wrapperyield statementssuper().recur() to maintain normal DoDoer executionKey Technical Consideration: When implementing a custom .recur() function in a DoDoer subclass, the superclass .recur() must be called to resume normal DoDoer execution of all contained coroutines.
While not fully documented in the provided sources, the style guide indicates that HIO includes a Cues system for inter-component communication. This appears to be a planned or emerging pattern for coordinating between different parts of a KERI implementation.
Based on the Trinity requirements.txt, HIO is installed as a standard Python package:
pip install hio>=0.6.12
HIO has minimal dependencies, aligning with its "weightless" design philosophy. The library builds upon:
asyncio frameworkFor KERI implementations, HIO is typically installed alongside:
HIO does not require explicit configuration files. Instead, it is used programmatically within Python applications. The hierarchical structure is established through code organization rather than external configuration.
While detailed API documentation is not provided in the source documents, the key abstractions mentioned include:
.recur() for periodic executionThe style guide emphasizes understanding when generator mechanics (yield, yield from) are genuinely needed versus when they're syntactically present but functionally unnecessary. This distinction is important for:
doing.doify and .recur() override patternsBased on the KERIA architecture description, HIO is used for:
The Message Router in KERIA uses HIO to handle:
The Agency component uses HIO for:
/boot requests to provision new agentsThe API Handler leverages HIO to:
Individual Agents use HIO for:
HIO builds upon very early work on hierarchical structured concurrency with lifecycle contexts from ioflo:
The ioflo project pioneered:
HIO represents an evolution and refinement of these concepts specifically optimized for KERI's requirements.
HIO is the standard async infrastructure for Python-based KERI implementations:
The reference Python implementation of KERI uses HIO for:
The cloud agent service uses HIO for:
The Python client library uses HIO for:
Other KERI implementations use different async frameworks:
Each implementation adapts the hierarchical structured concurrency concepts to the idioms and capabilities of its target language.
The selection of HIO for KERIpy reflects KERI's core design principles:
According to the style guide:
Use doing.doify when:
Use .recur() override when:
HIO's "weightless" design means:
This efficiency is critical for KERI implementations that may need to:
The hierarchical structure ensures:
This is particularly important for long-running KERI services like KERIA agents that must maintain reliability over extended periods.
HIO's flow-based programming model aligns naturally with KERI's event processing:
Each stage can be implemented as a Doer or DoDoer, creating a clean hierarchical structure that mirrors the protocol's logical organization.
The style guide indicates planned documentation for:
These additions will further enhance HIO's utility as the foundational async infrastructure for the KERI ecosystem.
Stay updated with the KERIpy style guide for evolving best practices.