Skip to main content

ory-agent-framework

Ory Agent Security for the Microsoft Agent Framework (the successor to AutoGen + Semantic Kernel).

Gates every function/tool call through Ory Permissions via function middleware, records invocations, and propagates the user → agent identity — built on ory-argus.

pip install ory-agent-framework

This release supports the stable Microsoft Agent Framework 1.x middleware API from 1.20 through 1.26.0 (agent-framework>=1.20,<=1.26.0). The upper bound is raised only after a newer release has been tested.

from ory_agent_framework import ory_function_middleware

agent = chat_client.create_agent(
    instructions="…",
    tools=[search, send_email],
    # Register Ory explicitly as function middleware.
    middleware=[ory_function_middleware()],
)

ory_function_middleware() returns SDK-native function middleware. It uses the stable zero-argument continuation and reads successful output from context.result. In enforce mode a denied call short-circuits: it sets context.result to the denial and returns without invoking the function, so the model receives the denial as the function result and the run continues. In observe mode (default) the function runs and a permission.observe_deny activity event is recorded. Successful calls record tool.complete; exceptions record tool.fail before being re-raised.

Sub-agents

Name the functions that run another agent (an agent exposed as a tool):

ory_function_middleware(subagent_tools={"research_agent"})

An allowed call to one registers a sub-agent of that name with its own identity, and the function runs as that sub-agent, so function calls the nested agent makes (through the same middleware) are checked and recorded as the sub-agent's. An allowed handoff_to_<agent> call registers the sub-agent <agent>, but the receiving agent runs after the call returns, so its function calls are checked and recorded as the calling agent's.

MCP tools

Pass the agent's MCP tools as mcp_tools so the functions they generate are checked against the MCP server and tool (McpServer:<server> and McpTool:<server>:<tool>) instead of as native tools:

from agent_framework import MCPStreamableHTTPTool

github = MCPStreamableHTTPTool(name="github", url="https://api.githubcopilot.com/mcp/")

agent = chat_client.create_agent(
    tools=[github],
    middleware=[ory_function_middleware(mcp_tools=[github])],
)

The server is the MCP tool's name; to report a different one, map it instead: mcp_tools={github: "github"}. The tool is the raw remote MCP tool name, before the SDK normalizes it and applies tool_name_prefix. Agent Security resolves the reported name to a catalog server, so it need not match the catalog spelling exactly. The MCP tool's URL host or launched package (for MCPStdioTool, such as npx -y @playwright/mcp) is sent only as a hash, which lets Agent Security recognize the server under any name. Functions from an MCP tool that is not in mcp_tools are checked as native tools.

Credentials come from the shared ~/.config/ory-agent-plugins/config.json.

Metadata

Release files for ory-agent-framework 1.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ory-agent-framework 1.11.0
File Size Uploaded Provenance Actions
ory_agent_framework-1.11.0.tar.gz 9.3 kB Without provenance Details for ory_agent_framework-1.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ory-agent-framework 1.11.0
File Interpreter ABI Platform Actions
ory_agent_framework-1.11.0-py3-none-any.whl Python 3 none any Details for ory_agent_framework-1.11.0-py3-none-any.whl

Total release size: 15.6 kB

Release files / ory_agent_framework-1.11.0.tar.gz

Download URL ory_agent_framework-1.11.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a262c689456926455b69151324bc655e1245d319df49b4881956857c731a5ece
BLAKE2b-256 checksum
How to use checksums
f62bc0b06ebf73c9be7190c0136744dfc01bd1f54257499123f77ae958c329c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ory_agent_framework-1.11.0-py3-none-any.whl

Download URL ory_agent_framework-1.11.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c881c2bf1c677363db9522d5ce8d8fd42a8db8e42f7b2e08996a663835ead2f
BLAKE2b-256 checksum
How to use checksums
ecf4d622663b049683a3c3531b4d733e7a6b1a71ab8526f548279b74447ed67a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ory-agent-framework 1.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.11.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page