Semantic Kernel

Add a KernelFilter that screens every function call.

Step 1: Set up A2A TrustGate

Run the quickstart wizard — prints API key setup, MCP config, CLAUDE.md snippet, and wrapper generators:

npx a2a-trustgate quickstart

# Then run the interactive setup:
npx a2a-trustgate setup

Step 2: Install and integrate

dotnet add package A2A.TrustGate

public class SafetyFilter : IFunctionInvocationFilter
{
    public async Task OnFunctionInvocationAsync(
        FunctionInvocationContext ctx, Func<Task> next)
    {
        var client = new HttpClient();
        var res = await client.PostAsync(
            "https://a2ainfrastructure.com/v1/evaluate",
            JsonContent.Create(new { command = ctx.Function.Name }));
        var json = await res.Content.ReadFromJsonAsync<Result>();
        if (json.Decision != "allow")
            throw new Exception("Blocked by TrustGate");
        await next();
    }
}
Help

Help

Need help? Here are some quick links: