agentapprovalprotocol 0.3.0__tar.gz → 0.3.1__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.
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/PKG-INFO +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/pyproject.toml +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/_gate.py +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_adk.py +3 -3
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_claude_agent_sdk.py +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_crewai.py +5 -5
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_gate.py +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_langgraph.py +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_openai_agents.py +4 -4
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_pydantic_ai.py +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/uv.lock +1 -1
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/.gitignore +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/README.md +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/__init__.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/_client.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/_wire.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/adk.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/claude_agent_sdk.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/crewai.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/langgraph.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/openai_agents.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/py.typed +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/pydantic_ai.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/receiver.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/testing.py +0 -0
- {agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/tests/test_wire_and_receiver.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agentapprovalprotocol
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Put an AI agent's tool calls behind an Agent Approval Protocol (AAP) approval provider.
|
|
5
5
|
Project-URL: Homepage, https://agentapprovalprotocol.io
|
|
6
6
|
Project-URL: Source, https://github.com/agentapprovalprotocol/agentapprovalprotocol
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/_gate.py
RENAMED
|
@@ -117,7 +117,7 @@ def _settled(request: Request) -> Deny | None:
|
|
|
117
117
|
"""The deny for a terminal request, or None when it may be consumed."""
|
|
118
118
|
if request.status == DENIED:
|
|
119
119
|
note = request.decision.note if request.decision else None
|
|
120
|
-
return Deny(f"The provider denied this call: {note}" if note else "The provider denied this call.", DENIED, request.id)
|
|
120
|
+
return Deny(f"The AAP provider denied this call: {note}" if note else "The AAP provider denied this call.", DENIED, request.id)
|
|
121
121
|
if request.status == CANCELLED:
|
|
122
122
|
return Deny(CANCELLED_TEXT, CANCELLED, request.id)
|
|
123
123
|
if request.status == EXPIRED:
|
|
@@ -119,7 +119,7 @@ async def test_denied_call_returns_the_reason_to_the_model():
|
|
|
119
119
|
runner, _ = build(provider, LlmAgent(name="support", model=Scripted(turn(REFUND), say("Understood.")), tools=[refund]))
|
|
120
120
|
_, events = await start(runner)
|
|
121
121
|
assert ran == []
|
|
122
|
-
assert responses(events, "refund") == [{"error": "The provider denied this call."}]
|
|
122
|
+
assert responses(events, "refund") == [{"error": "The AAP provider denied this call."}]
|
|
123
123
|
assert last_text(events) == "Understood."
|
|
124
124
|
|
|
125
125
|
|
|
@@ -204,7 +204,7 @@ async def test_async_denial_wakes_and_returns_the_reason():
|
|
|
204
204
|
await resumer(runner)(provider.only().body["context"]["resume"], await provider.async_client().get(request_id))
|
|
205
205
|
events = await session_events(runner, session_id)
|
|
206
206
|
assert ran == []
|
|
207
|
-
assert responses(events, "refund")[-1] == {"error": "The provider denied this call: Not this one."}
|
|
207
|
+
assert responses(events, "refund")[-1] == {"error": "The AAP provider denied this call: Not this one."}
|
|
208
208
|
assert last_text(events) == "Understood."
|
|
209
209
|
|
|
210
210
|
|
|
@@ -312,7 +312,7 @@ async def test_invented_tool_names_are_gated():
|
|
|
312
312
|
runner, _ = build(provider, LlmAgent(name="support", model=Scripted(turn(("c1", "wire_money", {"to": "x"})), say("Ok.")), tools=[refund]))
|
|
313
313
|
_, events = await start(runner)
|
|
314
314
|
assert provider.only().body["tool"] == "wire_money"
|
|
315
|
-
assert responses(events, "wire_money") == [{"error": "The provider denied this call."}]
|
|
315
|
+
assert responses(events, "wire_money") == [{"error": "The AAP provider denied this call."}]
|
|
316
316
|
|
|
317
317
|
|
|
318
318
|
async def test_gemini_built_in_tools_are_refused():
|
|
@@ -198,7 +198,7 @@ async def test_denied_call_returns_the_reason_to_the_model(cli):
|
|
|
198
198
|
(result,) = await run(hooks(provider).options(base))
|
|
199
199
|
assert ran == [] and result.result == "Understood."
|
|
200
200
|
(denied,) = api.tool_results()
|
|
201
|
-
assert denied["is_error"] and "The provider denied this call." in json.dumps(denied["content"])
|
|
201
|
+
assert denied["is_error"] and "The AAP provider denied this call." in json.dumps(denied["content"])
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
@needs_cli
|
|
@@ -157,7 +157,7 @@ def test_denied_call_returns_the_reason_to_the_model():
|
|
|
157
157
|
hooks(provider)
|
|
158
158
|
crew(llm)[0].kickoff()
|
|
159
159
|
assert ran == []
|
|
160
|
-
assert llm.tool_results() == ["The provider denied this call: Not this one."]
|
|
160
|
+
assert llm.tool_results() == ["The AAP provider denied this call: Not this one."]
|
|
161
161
|
|
|
162
162
|
|
|
163
163
|
def test_text_tool_calls_are_gated():
|
|
@@ -166,7 +166,7 @@ def test_text_tool_calls_are_gated():
|
|
|
166
166
|
hooks(provider)
|
|
167
167
|
out = crew(llm)[0].kickoff()
|
|
168
168
|
assert ran == [] and out.raw == "Not refunded."
|
|
169
|
-
assert "The provider denied this call." in llm.tool_results()[-1]
|
|
169
|
+
assert "The AAP provider denied this call." in llm.tool_results()[-1]
|
|
170
170
|
|
|
171
171
|
provider.auto = "approved"
|
|
172
172
|
llm = Scripted(model="scripted", native=False, turns=[react("refund", REFUND[2]), "Thought: done\nFinal Answer: Refunded."])
|
|
@@ -204,7 +204,7 @@ def test_parallel_calls_get_their_own_decisions():
|
|
|
204
204
|
hooks(provider)
|
|
205
205
|
crew(llm)[0].kickoff()
|
|
206
206
|
assert ran == [{"payment_id": "payment_456", "amount": 100}]
|
|
207
|
-
assert sorted(llm.tool_results()) == ["The provider denied this call: Too large.", "refunded payment_456"]
|
|
207
|
+
assert sorted(llm.tool_results()) == ["The AAP provider denied this call: Too large.", "refunded payment_456"]
|
|
208
208
|
assert len(provider.requests) == 2
|
|
209
209
|
|
|
210
210
|
|
|
@@ -223,7 +223,7 @@ def test_delegated_coworker_calls_are_gated():
|
|
|
223
223
|
Crew(agents=[lead, billing], tasks=[task]).kickoff()
|
|
224
224
|
assert ran == []
|
|
225
225
|
assert sorted(s.body["tool"] for s in provider.requests.values()) == ["delegate_work_to_coworker", "refund"]
|
|
226
|
-
assert billing_llm.tool_results() == ["The provider denied this call: No refunds today."]
|
|
226
|
+
assert billing_llm.tool_results() == ["The AAP provider denied this call: No refunds today."]
|
|
227
227
|
assert "The refund was denied." in lead_llm.tool_results()[0]
|
|
228
228
|
delegated = next(s for s in provider.requests.values() if s.body["tool"] == "delegate_work_to_coworker")
|
|
229
229
|
assert delegated.outcome["status"] == "succeeded"
|
|
@@ -235,7 +235,7 @@ def test_agent_kickoff_is_gated():
|
|
|
235
235
|
hooks(provider)
|
|
236
236
|
Agent(role="Support", goal="Refunds", backstory="b", llm=llm, tools=[refund]).kickoff("Refund payment_123")
|
|
237
237
|
assert ran == [] and len(provider.requests) == 1
|
|
238
|
-
assert llm.tool_results() == ["The provider denied this call."]
|
|
238
|
+
assert llm.tool_results() == ["The AAP provider denied this call."]
|
|
239
239
|
|
|
240
240
|
|
|
241
241
|
def test_mcp_tools_send_the_server_and_original_name():
|
|
@@ -42,7 +42,7 @@ def test_denial_carries_the_reviewers_note():
|
|
|
42
42
|
provider.decide(pending.request_id, "denied", "Refunds over 40 GBP need a manager.")
|
|
43
43
|
verdict = gate.check(call())
|
|
44
44
|
assert isinstance(verdict, Deny) and verdict.status == "denied"
|
|
45
|
-
assert verdict.reason == "The provider denied this call: Refunds over 40 GBP need a manager."
|
|
45
|
+
assert verdict.reason == "The AAP provider denied this call: Refunds over 40 GBP need a manager."
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
def test_same_call_cannot_run_twice_across_replicas():
|
|
@@ -67,7 +67,7 @@ def test_denied_call_returns_the_reason_to_the_model():
|
|
|
67
67
|
result = agent(provider, turn(REFUND), AIMessage("Understood.")).invoke({"messages": [HumanMessage("Refund it")]})
|
|
68
68
|
assert ran == []
|
|
69
69
|
message = next(m for m in result["messages"] if isinstance(m, ToolMessage))
|
|
70
|
-
assert message.status == "error" and message.content == "The provider denied this call."
|
|
70
|
+
assert message.status == "error" and message.content == "The AAP provider denied this call."
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
def test_async_mode_pauses_ignores_forged_resumes_and_wakes_on_the_decision():
|
|
@@ -90,7 +90,7 @@ async def test_denied_call_returns_the_reason_to_the_model():
|
|
|
90
90
|
agent = approvals(provider).protect(Agent(name="support", model=model, tools=[refund]))
|
|
91
91
|
await Runner.run(agent, "Refund it")
|
|
92
92
|
assert ran == []
|
|
93
|
-
assert outputs(model) == ["The provider denied this call."]
|
|
93
|
+
assert outputs(model) == ["The AAP provider denied this call."]
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
async def test_a_replayed_call_does_not_run_again():
|
|
@@ -181,7 +181,7 @@ async def test_async_mode_denial_returns_the_reason():
|
|
|
181
181
|
receiver = Receiver(secret=SECRET, client=provider.async_client(), resumers={"openai-agents": gate.resumer(agent)})
|
|
182
182
|
assert await receiver.wake(stored.id)
|
|
183
183
|
assert ran == [] and model.remaining_steps == 0
|
|
184
|
-
assert outputs(model) == ["The provider denied this call: Not today."]
|
|
184
|
+
assert outputs(model) == ["The AAP provider denied this call: Not today."]
|
|
185
185
|
|
|
186
186
|
|
|
187
187
|
async def test_parallel_calls_wait_for_their_own_decisions():
|
|
@@ -204,7 +204,7 @@ async def test_parallel_calls_wait_for_their_own_decisions():
|
|
|
204
204
|
await receiver.wake(ids["payment_123"])
|
|
205
205
|
assert ran == [second]
|
|
206
206
|
assert model.remaining_steps == 0
|
|
207
|
-
assert sorted(outputs(model)) == ["The provider denied this call: Not this one.", "refunded payment_456"]
|
|
207
|
+
assert sorted(outputs(model)) == ["The AAP provider denied this call: Not this one.", "refunded payment_456"]
|
|
208
208
|
assert len(provider.requests) == 2
|
|
209
209
|
|
|
210
210
|
|
|
@@ -341,7 +341,7 @@ async def test_local_mcp_denial_does_not_call_the_server():
|
|
|
341
341
|
agent = approvals(provider).protect(Agent(name="support", model=model, mcp_servers=[crm]))
|
|
342
342
|
await Runner.run(agent, "Update the contact")
|
|
343
343
|
assert crm.calls == []
|
|
344
|
-
assert outputs(model) == ["The provider denied this call."]
|
|
344
|
+
assert outputs(model) == ["The AAP provider denied this call."]
|
|
345
345
|
|
|
346
346
|
|
|
347
347
|
@pytest.mark.parametrize("status", ["approved", "denied"])
|
|
@@ -106,7 +106,7 @@ async def test_denied_call_returns_the_reason_to_the_model():
|
|
|
106
106
|
result = await agent(provider, turn(REFUND), done("Understood.")).run("Refund it")
|
|
107
107
|
assert ran == []
|
|
108
108
|
(part,) = returns(result.all_messages())
|
|
109
|
-
assert part.outcome == "failed" and part.content == "The provider denied this call."
|
|
109
|
+
assert part.outcome == "failed" and part.content == "The AAP provider denied this call."
|
|
110
110
|
assert result.output == "Understood."
|
|
111
111
|
|
|
112
112
|
|
|
File without changes
|
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/__init__.py
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/_client.py
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/_wire.py
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/adk.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/crewai.py
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/langgraph.py
RENAMED
|
File without changes
|
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/py.typed
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/pydantic_ai.py
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/receiver.py
RENAMED
|
File without changes
|
{agentapprovalprotocol-0.3.0 → agentapprovalprotocol-0.3.1}/src/agentapprovalprotocol/testing.py
RENAMED
|
File without changes
|
|
File without changes
|