You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -59,6 +60,7 @@ When a person authorizes an AI agent to act — and that agent delegates to anot
59
60
|[`hdp-crewai`](./packages/hdp-crewai)|[PyPI](https://pypi.org/project/hdp-crewai/)| Python | CrewAI | CrewAI middleware — attaches HDP to any crew |
60
61
|[`hdp-grok`](./packages/hdp-grok)|[PyPI](https://pypi.org/project/hdp-grok/)| Python | Grok / xAI | Grok middleware — attaches HDP to any xAI conversation |
61
62
|[`hdp-autogen`](./packages/hdp-autogen)|[PyPI](https://pypi.org/project/hdp-autogen/)| Python | AutoGen | AutoGen middleware — attaches HDP to any AutoGen agent or GroupChat |
63
+
|[`hdp-agent-framework`](./packages/hdp-agent-framework)|[PyPI](https://pypi.org/project/hdp-agent-framework/)| Python | Microsoft agent-framework | agent-framework middleware — attaches HDP to any Agent or workflow |
`hdp-agent-framework` attaches HDP to any Microsoft agent-framework `Agent` via the native `ChatMiddleware` and function middleware protocols. A single `middleware.configure(agent)` call appends both middlewares to `agent.middleware` — no other changes required.
432
+
433
+
```python
434
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
435
+
from agent_framework import Agent
436
+
from agent_framework.foundry import FoundryChatClient
437
+
from azure.identity.aio import AzureCliCredential
438
+
from hdp_agent_framework import HdpMiddleware, HdpPrincipal, ScopePolicy, verify_chain
middleware.configure(agent) # attaches chat + function middleware — one line
455
+
await agent.run("Analyse Q1 EMEA sales and write a summary.")
456
+
457
+
result = verify_chain(middleware.export_token(), private_key.public_key())
458
+
print(result.valid, result.hop_count)
459
+
```
460
+
461
+
| # | Consideration | Behaviour |
462
+
|---|---|---|
463
+
| 1 |**Scope enforcement**| Tool calls are inspected against `authorized_tools`. `strict=True` raises `HDPScopeViolationError`; default logs and records in the audit trail. |
464
+
| 2 |**Delegation depth**|`max_hops` is enforced; hops beyond the limit are skipped and logged. |
465
+
| 3 |**Token size / perf**| Ed25519 = 64 bytes/hop. All operations are non-blocking — failures log, never halt agents. |
466
+
| 4 |**Verification**|`verify_chain(token, public_key)` validates root + every hop offline. |
467
+
| 5 |**Agent integration**|`configure()` appends `HdpMiddleware` and `_function_middleware` to `agent.middleware` — idempotent, duck-typed, no hard dependency on agent-framework internals. |
`llama-index-callbacks-hdp` covers all three LlamaIndex hook points. Use whichever layer fits your pipeline — they share the same ContextVar-backed session so all three can be active simultaneously.
0 commit comments