Overview
Pair AI orchestration frameworks with HCS topics so each model/tool decision lands in an immutable, ordered stream. Use concise JSON envelopes (see references/decision-log-schema.md) and offload heavy payloads to IPFS/HTTPS with content hashes inside HCS messages.
When to use this skill
- Proving what the agent decided and when relative to on-chain/off-chain events.
- Designing GDPR workflows where personal data never enters plaintext public topics.
Prerequisites
- Running HCS topic + credentials from
hedera-environment-setup. - Understanding that public testnets are public — never log secrets or raw PII.
Workflow
Define schema — adopt JSON Schema in references; version
schema_versionfield per deployment.Instrument framework
- LangChain — custom callback handler serializes
on_chain_start,on_tool_end, etc. - LangGraph — wrap node transitions.
- AutoGen — hook reply events.
Starter: scripts/langchain-hcs-callback.js (pattern-level sample).
- LangChain — custom callback handler serializes
Publish —
TopicMessageSubmitTransactionper event or batch in chunk framing when necessary.Visualize — query Mirror REST chronologically for dashboards (scripts/query-audit-trail.js).
GDPR — hash identifiers, store DPIA references off-chain; see references/gdpr-considerations.md.
Examples
Example 1
“Every tool call from our agent should be traceable in order.”
Emit structured records with monotonic step_index and parent pointers for nested calls.
Example 2
“Compliance wants immutable AI logs for credit decisions.”
Include policy_version, model_id, feature_vector_hash, but not raw applicant rows.
Example 3
“Build a Grafana dashboard.”
ETL Mirror REST → columnar store keyed by consensus_timestamp.
Troubleshooting
| Issue | Mitigation |
|---|---|
| Message too large | Chunk + manifest hash |
| PII leak | Redact in callback before submit |
References
- Local: references/decision-log-schema.md, references/pipeline-architecture.md, references/gdpr-considerations.md
- Hedera AI resources: AI Studio on Hedera