Metadata-Version: 2.5
Name: ory-antigravity
Version: 1.9.1
Summary: Ory Agent Security for the Google Antigravity SDK — per-tool authorization, activity logging, and identity propagation via the SDK's hook system. Built on ory-argus.
Author: Ory
License-Expression: Apache-2.0
Keywords: agent,ai,antigravity,authorization,gemini,google,ory,permissions
Requires-Python: >=3.10
Requires-Dist: google-antigravity>=0.1
Requires-Dist: ory-argus<2,>=1
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# ory-antigravity

Ory Agent Security for the [Google Antigravity SDK](https://antigravity.google/product/antigravity-sdk).

Authorizes every tool call against Ory Permissions via Antigravity's hook system, records
invocations, and propagates user → agent → sub-agent identity — built on
[`ory-argus`](https://pypi.org/project/ory-argus/).

```bash
pip install ory-antigravity
```

```python
from google.antigravity import Agent, LocalAgentConfig
from ory_antigravity import ory_hooks

config = LocalAgentConfig(hooks=ory_hooks(), ...)
agent = Agent(config)
```

`ory_hooks()` returns three hooks ready to drop into `config.hooks`:
`OnSessionStartHook` (auth gates), `PreToolCallDecideHook` (authorize), and
`PostToolCallHook` (activity log). Building your own `HookRunner`? The same object exposes them by
name: `ory_hooks().pre_tool_call_decide`, `.post_tool_call`, `.on_session_start`.

In **enforce** mode a denied tool is **aborted** — the decide
hook returns `HookResult(allow=False)` and Antigravity hands the model the denial instead of
running the tool. In **observe** mode (default) the tool runs and a `permission.observe_deny`
activity event is recorded. The `ask_question` builtin is treated as a user-interaction primitive (never
gated); when the model delegates via `start_subagent`, a sub-agent identity and
agent→subagent delegation are recorded.

Antigravity decide hooks fail **closed** (a raising hook aborts the tool). The
integration returns explicit decisions: network, rate-limit, and server errors
deny in enforce mode and allow in observe mode.

## MCP tools

Antigravity marks a call to a tool from one of the agent's MCP servers with
`ToolCall.server_name`. Such a call is checked against the MCP server and tool
(`McpServer:<server_name>` and `McpTool:<server_name>:<tool>`) instead of as a native tool.
Pass the same MCP server configs to `ory_hooks` to also send hashed fingerprints of each
server's URL host or launched package (such as `npx -y @playwright/mcp`), which let Agent
Security recognize the server under any name:

```python
from google.antigravity.types import McpStreamableHttpServer

mcp_servers = [McpStreamableHttpServer(name="github", url="https://api.githubcopilot.com/mcp/")]
config = LocalAgentConfig(mcp_servers=mcp_servers, hooks=ory_hooks(mcp_servers=mcp_servers), ...)
```

Agent Security resolves the reported name to a catalog server, so it need not match the catalog
spelling exactly. A call to a generic `call_mcp_tool` tool without `server_name` is parsed
from its `server_name` / `serverName` / `ServerName` and `tool_name` / `toolName` /
`ToolName` arguments, mirroring the TypeScript Antigravity adapter. Those argument names are
unverified: Antigravity does not document them, and `google-antigravity` 0.1.22 has no such
builtin. A call missing either name is checked as a native tool.

Credentials come from the shared `~/.config/ory-agent-plugins/config.json`, so a login from
any Ory harness or `ory-argus login` is reused automatically. See
[docs/sdk-integrations.md](https://github.com/ory-corp/ory-agent-plugins/blob/main/docs/sdk-integrations.md).
