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

MiddlewareEventsData
PrysmAgentMiddlewareAgent start/endAgent type, messages, timing, errors
PrysmFunctionMiddlewareTool/function callsFunction name, args, result, duration
PrysmChatMiddlewareLLM completionsMessages, 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)