strands-revsec 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2026 RevUp AI, Inc. All rights reserved.
2
+
3
+ Use of this software is subject to the RevSec terms of service.
@@ -0,0 +1,2 @@
1
+ recursive-include tests *.py
2
+ global-exclude __pycache__ *.py[cod]
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: strands-revsec
3
+ Version: 0.1.0
4
+ Summary: RevSec for Strands Agents: check each tool call before it runs (MCP tools against their MCP server), each prompt and tool result, and register the agent.
5
+ Author-email: "RevSec / RevUp AI, Inc." <hello@revupai.com>
6
+ License-Expression: LicenseRef-Proprietary
7
+ Project-URL: Homepage, https://revsec.app
8
+ Project-URL: Start a free trial, https://app.revsec.app/start?from=strands
9
+ Keywords: strands,strands-agents,hooks,ai-agents,ai-security,guardrails,mcp,tool-calls
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Security
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: revsec-sdk<0.6,>=0.5.0
22
+ Requires-Dist: strands-agents<2,>=1.54
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest>=7; extra == "test"
25
+ Requires-Dist: pytest-asyncio>=0.23; extra == "test"
26
+ Dynamic: license-file
27
+
28
+ # strands-revsec
29
+
30
+ RevSec for [Strands Agents](https://strandsagents.com). Add `RevSecHooks` to
31
+ your agent and RevSec checks each tool call before it runs: a call to an MCP
32
+ server's tool against that MCP server, a call to one of the agent's own tools
33
+ against the agent's own rules. A blocked call never runs, and the model is told
34
+ why. What the user asks is checked before it reaches the model, and what each
35
+ tool hands back before the model reads it. What happened is recorded, and the
36
+ agent is listed in your RevSec console with its model and tools.
37
+
38
+ Your rules live in RevSec, not in your code. If you ship agents to customers,
39
+ each customer account gets its own rules, approvals and evidence.
40
+
41
+ ## Get a key
42
+
43
+ - **Shipping agents to your customers?** [Start a free trial](https://app.revsec.app/start?from=strands)
44
+ and choose "AI we ship to our customers". Your Sandbox key is shown once, when you sign up.
45
+ - **Building agents for your own company?** [Book a demo](mailto:sales@revupai.com?subject=Book%20a%20RevSec%20demo).
46
+
47
+ ```bash
48
+ pip install strands-revsec
49
+ export REVSEC_API_KEY="<your key>"
50
+ export REVSEC_BASE_URL="https://app.revsec.app/fcc"
51
+ ```
52
+
53
+ ## Add it to your agent
54
+
55
+ Build your MCP clients with `revsec_mcp_client` (in place of `MCPClient`) and
56
+ add `RevSecHooks`:
57
+
58
+ ```python
59
+ from strands import Agent, tool
60
+ from strands_revsec import RevSecHooks, revsec_mcp_client
61
+
62
+ github = revsec_mcp_client("github", url="https://api.githubcopilot.com/mcp/")
63
+ notes = revsec_mcp_client("notes", command="npx", args=["-y", "@acme/notes-mcp"])
64
+
65
+ @tool
66
+ def lookup_order(order_id: str) -> str:
67
+ """Look up an order."""
68
+ ...
69
+
70
+ agent = Agent(
71
+ tools=[github, notes, lookup_order],
72
+ hooks=[RevSecHooks(agent_name="orders-agent")],
73
+ )
74
+ agent("Where is order A1?")
75
+ ```
76
+
77
+ That's all. Block a tool in RevSec and run the agent: the call doesn't run,
78
+ and the model gets a tool result saying `Blocked by RevSec: <the reason>`, so
79
+ it can tell the user or try something else.
80
+
81
+ - **MCP tools** are checked against their MCP server: the server's approval,
82
+ your MCP policies and its known vulnerabilities.
83
+ - **The agent's own tools** (functions in your code, like `lookup_order`) are
84
+ checked as the agent's: its status (a quarantined agent is stopped) and its
85
+ tool-call policies, such as "block `refund_order`". They are recorded with
86
+ the agent's tool calls, never as an MCP server.
87
+ - **What a tool sends out** (secrets, personal data) is scanned by your data
88
+ protection policies when you turn it on: `revsec.mcp.configure(..., dlp=True)`.
89
+ - **What a tool hands back** (a web page, a file, an MCP server's reply) is
90
+ checked before the model reads it: instructions hidden in it, secrets,
91
+ personal data. A result RevSec stops is replaced with one saying
92
+ `Withheld by RevSec: ...`; the call itself ran.
93
+ - **Calls RevSec stops, holds or flags** reach your SIEM, if one is connected
94
+ in the RevSec console.
95
+
96
+ ## MCP servers
97
+
98
+ RevSec files each MCP server under the name you give it, and is told its
99
+ address, or for a local server the package it runs; never the rest of its
100
+ launch command (which can carry tokens).
101
+
102
+ - `revsec_mcp_client(name, url=...)` for a remote server, or
103
+ `revsec_mcp_client(name, command=..., args=..., env=...)` for a local one.
104
+ Other keyword arguments go to `MCPClient` (`prefix=`, `startup_timeout=`, ...).
105
+ - `revsec_mcp_servers("mcp.json")` in place of `MCPClient.load_servers(...)`:
106
+ each server is filed under its key in the `mcpServers` config.
107
+ - An `MCPClient` you build yourself: `note_mcp_server(client, "github", url=...)`.
108
+
109
+ Calls to an MCP client RevSec can't name are still checked as MCP calls, under
110
+ `unnamed-mcp-server`, and a warning says how to name it.
111
+
112
+ Strands' MCP router tool reaches servers through one tool of the agent's
113
+ (`mcp_router`), so RevSec checks those calls as that one tool. Give the agent
114
+ the MCP clients themselves to check each server's calls.
115
+
116
+ ## Prompts
117
+
118
+ What the user asks is checked before it reaches the model, with the same Model
119
+ Security check RevSec runs for coding tools on a laptop: your prompt rules and
120
+ the built-in checks (prompt injection, secrets, personal data). A prompt
121
+ RevSec stops never reaches the model and isn't kept in the conversation; the
122
+ agent answers `Blocked by RevSec: <the reason>` instead, and the conversation
123
+ carries on. Each check is kept on the agent in RevSec, in the same
124
+ conversation as its tool calls, and the model it was about to call is listed
125
+ on the agent. No AI gateway is needed.
126
+
127
+ If your model calls go through the RevSec AI gateway (Settings → AI gateway in
128
+ the console), it checks prompts there; turn the check here off so each prompt
129
+ is checked once:
130
+
131
+ ```python
132
+ from revsec import mcp
133
+ mcp.configure(api_key=os.environ["REVSEC_API_KEY"], check_prompts=False)
134
+ ```
135
+
136
+ `check_tool_results=False` turns off the tool-result check.
137
+
138
+ ## Options
139
+
140
+ | Option | Default | What it does |
141
+ |---|---|---|
142
+ | `agent_name` | required | The agent's name in RevSec. Registering again updates the same agent. |
143
+ | `api_key` | `REVSEC_API_KEY` | Your RevSec key. |
144
+ | `base_url` | `REVSEC_BASE_URL` | Your RevSec address, ending in `/fcc`. |
145
+ | `register` | `True` | List the agent in RevSec on its first request, with its model and tools. |
146
+ | `description`, `owner_email`, `environment` | none | Shown on the agent in RevSec. |
147
+ | `customer_facing` | none | `True` when the agent talks to your customers; shown on the agent and used in its setup rating. |
148
+ | `on_block` | `"message"` | `"raise"` raises instead of telling the model or the user: `revsec.RevsecBlocked` for a stopped prompt, and Strands' `EventLoopException` for a blocked tool call (the `RevsecBlocked` is its `original_exception`). A tool result RevSec stops is always withheld, since Strands doesn't pass on an error raised after a tool has run. |
149
+
150
+ A customer account key, such as the Sandbox key you get when you sign up,
151
+ checks the agent's tool calls and registers the agent in that customer account.
152
+
153
+ Calls and checks in one conversation (one `Agent`, or one session when you use
154
+ a Strands session manager) are grouped into one chain in RevSec's Activity
155
+ Explorer.
156
+
157
+ ## When RevSec can't be reached
158
+
159
+ By default a call is allowed when RevSec can't be reached, so an outage never
160
+ stops your agent. To block instead:
161
+
162
+ ```python
163
+ from revsec import mcp
164
+ mcp.configure(api_key=os.environ["REVSEC_API_KEY"], failure_mode="fail_closed")
165
+ ```
166
+
167
+ `mcp.configure(api_key=..., enabled=False)` turns the checks off. This package
168
+ is built on [revsec-sdk](https://pypi.org/project/revsec-sdk/); its README
169
+ covers these settings.
170
+
171
+ Works with strands-agents 1.54 and later.
172
+
173
+ ## License
174
+
175
+ Copyright (c) 2026 RevUp AI, Inc. Use is subject to the RevSec terms of service.
@@ -0,0 +1,148 @@
1
+ # strands-revsec
2
+
3
+ RevSec for [Strands Agents](https://strandsagents.com). Add `RevSecHooks` to
4
+ your agent and RevSec checks each tool call before it runs: a call to an MCP
5
+ server's tool against that MCP server, a call to one of the agent's own tools
6
+ against the agent's own rules. A blocked call never runs, and the model is told
7
+ why. What the user asks is checked before it reaches the model, and what each
8
+ tool hands back before the model reads it. What happened is recorded, and the
9
+ agent is listed in your RevSec console with its model and tools.
10
+
11
+ Your rules live in RevSec, not in your code. If you ship agents to customers,
12
+ each customer account gets its own rules, approvals and evidence.
13
+
14
+ ## Get a key
15
+
16
+ - **Shipping agents to your customers?** [Start a free trial](https://app.revsec.app/start?from=strands)
17
+ and choose "AI we ship to our customers". Your Sandbox key is shown once, when you sign up.
18
+ - **Building agents for your own company?** [Book a demo](mailto:sales@revupai.com?subject=Book%20a%20RevSec%20demo).
19
+
20
+ ```bash
21
+ pip install strands-revsec
22
+ export REVSEC_API_KEY="<your key>"
23
+ export REVSEC_BASE_URL="https://app.revsec.app/fcc"
24
+ ```
25
+
26
+ ## Add it to your agent
27
+
28
+ Build your MCP clients with `revsec_mcp_client` (in place of `MCPClient`) and
29
+ add `RevSecHooks`:
30
+
31
+ ```python
32
+ from strands import Agent, tool
33
+ from strands_revsec import RevSecHooks, revsec_mcp_client
34
+
35
+ github = revsec_mcp_client("github", url="https://api.githubcopilot.com/mcp/")
36
+ notes = revsec_mcp_client("notes", command="npx", args=["-y", "@acme/notes-mcp"])
37
+
38
+ @tool
39
+ def lookup_order(order_id: str) -> str:
40
+ """Look up an order."""
41
+ ...
42
+
43
+ agent = Agent(
44
+ tools=[github, notes, lookup_order],
45
+ hooks=[RevSecHooks(agent_name="orders-agent")],
46
+ )
47
+ agent("Where is order A1?")
48
+ ```
49
+
50
+ That's all. Block a tool in RevSec and run the agent: the call doesn't run,
51
+ and the model gets a tool result saying `Blocked by RevSec: <the reason>`, so
52
+ it can tell the user or try something else.
53
+
54
+ - **MCP tools** are checked against their MCP server: the server's approval,
55
+ your MCP policies and its known vulnerabilities.
56
+ - **The agent's own tools** (functions in your code, like `lookup_order`) are
57
+ checked as the agent's: its status (a quarantined agent is stopped) and its
58
+ tool-call policies, such as "block `refund_order`". They are recorded with
59
+ the agent's tool calls, never as an MCP server.
60
+ - **What a tool sends out** (secrets, personal data) is scanned by your data
61
+ protection policies when you turn it on: `revsec.mcp.configure(..., dlp=True)`.
62
+ - **What a tool hands back** (a web page, a file, an MCP server's reply) is
63
+ checked before the model reads it: instructions hidden in it, secrets,
64
+ personal data. A result RevSec stops is replaced with one saying
65
+ `Withheld by RevSec: ...`; the call itself ran.
66
+ - **Calls RevSec stops, holds or flags** reach your SIEM, if one is connected
67
+ in the RevSec console.
68
+
69
+ ## MCP servers
70
+
71
+ RevSec files each MCP server under the name you give it, and is told its
72
+ address, or for a local server the package it runs; never the rest of its
73
+ launch command (which can carry tokens).
74
+
75
+ - `revsec_mcp_client(name, url=...)` for a remote server, or
76
+ `revsec_mcp_client(name, command=..., args=..., env=...)` for a local one.
77
+ Other keyword arguments go to `MCPClient` (`prefix=`, `startup_timeout=`, ...).
78
+ - `revsec_mcp_servers("mcp.json")` in place of `MCPClient.load_servers(...)`:
79
+ each server is filed under its key in the `mcpServers` config.
80
+ - An `MCPClient` you build yourself: `note_mcp_server(client, "github", url=...)`.
81
+
82
+ Calls to an MCP client RevSec can't name are still checked as MCP calls, under
83
+ `unnamed-mcp-server`, and a warning says how to name it.
84
+
85
+ Strands' MCP router tool reaches servers through one tool of the agent's
86
+ (`mcp_router`), so RevSec checks those calls as that one tool. Give the agent
87
+ the MCP clients themselves to check each server's calls.
88
+
89
+ ## Prompts
90
+
91
+ What the user asks is checked before it reaches the model, with the same Model
92
+ Security check RevSec runs for coding tools on a laptop: your prompt rules and
93
+ the built-in checks (prompt injection, secrets, personal data). A prompt
94
+ RevSec stops never reaches the model and isn't kept in the conversation; the
95
+ agent answers `Blocked by RevSec: <the reason>` instead, and the conversation
96
+ carries on. Each check is kept on the agent in RevSec, in the same
97
+ conversation as its tool calls, and the model it was about to call is listed
98
+ on the agent. No AI gateway is needed.
99
+
100
+ If your model calls go through the RevSec AI gateway (Settings → AI gateway in
101
+ the console), it checks prompts there; turn the check here off so each prompt
102
+ is checked once:
103
+
104
+ ```python
105
+ from revsec import mcp
106
+ mcp.configure(api_key=os.environ["REVSEC_API_KEY"], check_prompts=False)
107
+ ```
108
+
109
+ `check_tool_results=False` turns off the tool-result check.
110
+
111
+ ## Options
112
+
113
+ | Option | Default | What it does |
114
+ |---|---|---|
115
+ | `agent_name` | required | The agent's name in RevSec. Registering again updates the same agent. |
116
+ | `api_key` | `REVSEC_API_KEY` | Your RevSec key. |
117
+ | `base_url` | `REVSEC_BASE_URL` | Your RevSec address, ending in `/fcc`. |
118
+ | `register` | `True` | List the agent in RevSec on its first request, with its model and tools. |
119
+ | `description`, `owner_email`, `environment` | none | Shown on the agent in RevSec. |
120
+ | `customer_facing` | none | `True` when the agent talks to your customers; shown on the agent and used in its setup rating. |
121
+ | `on_block` | `"message"` | `"raise"` raises instead of telling the model or the user: `revsec.RevsecBlocked` for a stopped prompt, and Strands' `EventLoopException` for a blocked tool call (the `RevsecBlocked` is its `original_exception`). A tool result RevSec stops is always withheld, since Strands doesn't pass on an error raised after a tool has run. |
122
+
123
+ A customer account key, such as the Sandbox key you get when you sign up,
124
+ checks the agent's tool calls and registers the agent in that customer account.
125
+
126
+ Calls and checks in one conversation (one `Agent`, or one session when you use
127
+ a Strands session manager) are grouped into one chain in RevSec's Activity
128
+ Explorer.
129
+
130
+ ## When RevSec can't be reached
131
+
132
+ By default a call is allowed when RevSec can't be reached, so an outage never
133
+ stops your agent. To block instead:
134
+
135
+ ```python
136
+ from revsec import mcp
137
+ mcp.configure(api_key=os.environ["REVSEC_API_KEY"], failure_mode="fail_closed")
138
+ ```
139
+
140
+ `mcp.configure(api_key=..., enabled=False)` turns the checks off. This package
141
+ is built on [revsec-sdk](https://pypi.org/project/revsec-sdk/); its README
142
+ covers these settings.
143
+
144
+ Works with strands-agents 1.54 and later.
145
+
146
+ ## License
147
+
148
+ Copyright (c) 2026 RevUp AI, Inc. Use is subject to the RevSec terms of service.
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "strands-revsec"
7
+ # The version lives in strands_revsec/_version.py only; see [tool.setuptools.dynamic].
8
+ dynamic = ["version"]
9
+ description = "RevSec for Strands Agents: check each tool call before it runs (MCP tools against their MCP server), each prompt and tool result, and register the agent."
10
+ readme = "README.md"
11
+ requires-python = ">=3.10"
12
+ license = "LicenseRef-Proprietary"
13
+ license-files = ["LICENSE"]
14
+ authors = [
15
+ { name = "RevSec / RevUp AI, Inc.", email = "hello@revupai.com" },
16
+ ]
17
+ keywords = ["strands", "strands-agents", "hooks", "ai-agents", "ai-security", "guardrails", "mcp", "tool-calls"]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Topic :: Security",
27
+ ]
28
+ dependencies = [
29
+ # Uses the SDK's tool checks (revsec.tools for the agent's own tools,
30
+ # revsec.mcp for MCP tools), content checks (revsec.checks), outcome and
31
+ # registration; pinned below 0.6 because it also reuses a few of the
32
+ # SDK's internal helpers.
33
+ "revsec-sdk>=0.5.0,<0.6",
34
+ # 1.54 adds Agent.session_id; the hooks used here (cancel_tool, model-call
35
+ # cancel, writable tool results) are all older. Strands brings mcp.
36
+ "strands-agents>=1.54,<2",
37
+ ]
38
+
39
+ [project.optional-dependencies]
40
+ test = ["pytest>=7", "pytest-asyncio>=0.23"]
41
+
42
+ [project.urls]
43
+ Homepage = "https://revsec.app"
44
+ "Start a free trial" = "https://app.revsec.app/start?from=strands"
45
+
46
+ [tool.setuptools.dynamic]
47
+ version = { attr = "strands_revsec._version.__version__" }
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["."]
51
+ include = ["strands_revsec*"]
52
+
53
+ [tool.pytest.ini_options]
54
+ asyncio_mode = "auto"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,24 @@
1
+ """strands-revsec: RevSec for Strands agents.
2
+
3
+ Add one hook provider to the Agent: RevSec checks each tool call before it
4
+ runs (an MCP server's tool against that MCP server, the agent's own tools as
5
+ the agent's), what the user asks before it reaches the model, and what each
6
+ tool hands back before the model reads it; records what happened, and lists
7
+ the agent in your RevSec console with its model and tools.
8
+
9
+ from strands import Agent
10
+ from strands_revsec import RevSecHooks, revsec_mcp_client
11
+
12
+ notes = revsec_mcp_client("notes", command="npx", args=["-y", "@acme/notes-mcp"])
13
+ agent = Agent(tools=[notes, lookup_order], hooks=[RevSecHooks(agent_name="orders-agent")])
14
+
15
+ No AI gateway is needed. A team whose model calls go through the RevSec AI
16
+ gateway turns the prompt check here off: ``revsec.mcp.configure(check_prompts=False)``.
17
+
18
+ Set REVSEC_API_KEY and REVSEC_BASE_URL first (Settings → SDK in the console).
19
+ """
20
+ from strands_revsec._version import __version__
21
+ from strands_revsec.hooks import RevSecHooks
22
+ from strands_revsec.mcp import note_mcp_server, revsec_mcp_client, revsec_mcp_servers
23
+
24
+ __all__ = ["RevSecHooks", "revsec_mcp_client", "revsec_mcp_servers", "note_mcp_server", "__version__"]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"