Python: feat: governance filter for function calls — deterministic policy evaluation, cost tracking, audit (TealTiger)
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 32/100
Research direction
Start with the Python IFunctionInvocationFilter and FunctionInvocationContext entry points, along with Semantic Kernel's existing filter documentation and pipeline. Clarify whether the work belongs as a repository sample or an external integration, then define a bounded first scope and acceptance criteria for policy evaluation, cost tracking, audit records, and provider circuit breaking.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Semantic Kernel's Filter system (IFunctionInvocationFilter, IAutoFunctionInvocationFilter) provides the right interception points for governance, but there's no built-in or community governance filter that:
- Evaluates deterministic policies before function/plugin execution
- Enforces per-agent cost budgets (block calls that would exceed daily/session limits)
- Tracks and attributes LLM cost per agent, per plugin, per session
- Produces structured audit records for compliance (EU AI Act Article 12)
- Provides per-provider circuit breaking to prevent cascading failures
Today you'd need to implement custom IFunctionInvocationFilter logic in every project, which doesn't scale.
Describe the solution you'd like
A governance filter that plugs into SK's existing filter pipeline:
Python:
from semantic_kernel import Kernel
from sk_tealtiger import TealTigerFilter
kernel = Kernel()
# Zero-config: observe all function calls, track cost, detect PII
kernel.add_filter("function_invocation", TealTigerFilter())
# With policies
from tealtiger import TealEngine
engine = TealEngine(policies=company_policies, mode="ENFORCE")
kernel.add_filter("function_invocation", TealTigerFilter(engine=engine))
C# (if community demand exists):
var kernel = Kernel.CreateBuilder()
.AddFilter<TealTigerGovernanceFilter>()
.Build();
The filter would:
- Intercept
FunctionInvocationContextbefore execution - Evaluate policy against the function name, arguments, and caller context
- Return ALLOW (proceed), DENY (throw), or REVISE (modify args)
- Track token cost after execution and check against budget limits
- Emit structured audit entries with correlation IDs
- Circuit-break on repeated provider failures
Describe alternatives you've considered
- Custom
IFunctionInvocationFilterper project — works but verbose, no reuse across projects - External proxy/sidecar — adds network latency, incompatible with offline/in-process constraint
- Azure Content Safety service — cloud-dependent, LLM-based (non-deterministic), doesn't handle cost/budget/tool-restriction
Additional context
- TealTiger — open-source AI agent security platform (Apache-2.0, NVIDIA Inception)
- Published on PyPI (
tealtigerv1.3.0) and npm (tealtiger-ai-sdkv0.1.0) - Covers 8/10 OWASP Agentic Security Index categories
- All governance is deterministic and in-process — no external service, <5ms overhead, works offline
- Already integrated with LangChain, Vercel AI SDK, CrewAI, and proposals open for LlamaIndex, AG2, Haystack, Pydantic AI, Mastra
- SK's existing Filter system (per blog post) is the natural integration point
- EU AI Act compliance angle: structured audit records with
retention_until, input/output traceability
References:
- https://github.com/agentguard-ai/tealtiger — TealTiger source (Apache-2.0)
- https://pypi.org/project/tealtiger/ — TealTiger on PyPI (v1.3.0)
- https://www.npmjs.com/package/tealtiger-ai-sdk — Vercel AI SDK middleware (v0.1.0)
- https://devblogs.microsoft.com/agent-framework/filters-in-semantic-kernel/ — SK Filters blog post
- https://owasp.org/www-project-top-10-for-large-language-model-applications/ — OWASP Agentic Security Index
Contribution plan: Happy to contribute a Python IFunctionInvocationFilter implementation as a community sample or standalone pip package. Would this be welcome as a sample in the repo or as an external community integration?
- Dominant language
- C#
- Stars
- 28.8k
- Forks
- 4.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 48
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/semantic-kernel
-
Python: Bug: ChatMessageContent.from_element drops AudioContent and BinaryContent into raw TextContentPossibly taken @halcyon-past claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/semantic-kernel#14824 · 1 comment ·
Maintainers usually reply within 3 days
-
Python: Bug: Redis search returns None for every field that declares a storage_name, because RETURN lists the declared namePossibly taken @wasim-builds claimed this 9 days ago. Openpython triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/semantic-kernel#14753 · 1 comment ·
Maintainers usually reply within 3 days
-
.Net: gpt-image-1 is the default image model in the .NET OpenAI connector, and OpenAI shuts it down on October 23Possibly taken @nightcityblade claimed this 46 days ago. Open.NET triage
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
microsoft/semantic-kernel#14526 · 1 comment ·
Maintainers usually reply within 3 days
-
Python: VolatileMemoryStore.get_batch and get_nearest_matches ignore with_embeddings=False (deepcopy result is discarded)Possibly taken @VANDRANKI claimed this 48 days ago. Openpython triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/semantic-kernel#14522 ·
Maintainers usually reply within 3 days
-
.Net: Bug: BinaryContent does not decode the %xx escapes of a non-base64 data URIPossibly taken @Laurianti claimed this 48 days ago. Open.NET triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/semantic-kernel#14518 ·
Maintainers usually reply within 3 days
All issues in microsoft/semantic-kernel
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Support Flux ignore rules (drift detection ignore paths) in Microsoft.KubernetesConfiguration schemaOpen
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Azure/azure-resource-manager-schemas#3921 ·
Maintainers usually reply within 1 day
-
text-align: justify is ignored in HTML to PDF conversionPossibly taken @PrzemyslawKlys claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
asyncapi/modelina#2709 · 1 comment ·
Maintainers usually reply within 1 day