Microsoft Agent Framework Integration
Prysm provides first-class integration with Microsoft Agent Framework, capturing agent runs, function/tool calls, and LLM chat completions through the framework's middleware system.
Installation
pip install prysmai[agent-framework]
Quick Start
from prysmai.integrations.agent_framework import (
PrysmAgentMiddleware,
PrysmFunctionMiddleware,
PrysmChatMiddleware,
)
import prysmai
# Initialize Prysm
prysmai.init(api_key="sk-prysm-...", project="my-project")
# Create middleware instances
agent_mw = PrysmAgentMiddleware(session_id="my-session")
function_mw = PrysmFunctionMiddleware(session_id="my-session")
chat_mw = PrysmChatMiddleware(session_id="my-session")
# Register with your Agent Framework runtime
runtime.add_middleware(agent_mw)
runtime.add_middleware(function_mw)
runtime.add_middleware(chat_mw)
What Gets Captured
| Middleware | Events | Data |
|---|---|---|
| PrysmAgentMiddleware | Agent start/end | Agent type, messages, timing, errors |
| PrysmFunctionMiddleware | Tool/function calls | Function name, args, result, duration |
| PrysmChatMiddleware | LLM completions | Messages, model, tokens, response |
Governance Mode
All three middleware classes accept a governance_session parameter to forward events to the governance engine for behavioral analysis:
from prysmai import GovernanceSession
session = GovernanceSession(api_key="sk-prysm-...", project="my-project")
agent_mw = PrysmAgentMiddleware(session_id="s1", governance_session=session)