maigp-light-a2a 1.0.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,46 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .venv/
8
+ .eggs/
9
+
10
+ # Node
11
+ node_modules/
12
+ dist/
13
+
14
+ # Go
15
+ bin/
16
+
17
+ # Rust
18
+ target/
19
+
20
+ # .NET
21
+ bin/
22
+ obj/
23
+
24
+ # Java
25
+ *.class
26
+ out/
27
+
28
+ # IDE
29
+ .idea/
30
+ .vscode/
31
+ .kiro/
32
+ *.swp
33
+
34
+ # OS
35
+ .DS_Store
36
+ Thumbs.db
37
+
38
+ # Secrets (never commit)
39
+ .env
40
+ *.pem
41
+ *.key
42
+ *.pdf
43
+ BACKLOG/
44
+ patent/
45
+ docs/.archive/
46
+ review/
@@ -0,0 +1,74 @@
1
+ # AIGP-Light Source Available License
2
+
3
+ Version 1.0, July 2026
4
+
5
+ Copyright (c) 2024-2026 Causum. All rights reserved.
6
+
7
+ ## Grant of Rights
8
+
9
+ Permission is hereby granted, free of charge, to any person or organization
10
+ obtaining a copy of this software and associated documentation files (the
11
+ "Software"), to:
12
+
13
+ 1. **Use** the Software for any purpose, including commercial applications,
14
+ without restriction.
15
+
16
+ 2. **Copy and distribute** the Software in unmodified form, provided this
17
+ license notice is included in all copies.
18
+
19
+ 3. **Integrate** the Software into applications, products, and services
20
+ without royalty or fee.
21
+
22
+ ## Restrictions
23
+
24
+ The following actions require prior written permission from Causum
25
+ (licensing@causum.com):
26
+
27
+ 1. **Modification** — You may not modify, alter, adapt, or create derivative
28
+ works based on the Software without explicit written permission from Causum.
29
+
30
+ 2. **Forking for distribution** — You may not distribute modified versions of
31
+ the Software, whether under this name or any other name.
32
+
33
+ 3. **Relicensing** — You may not sublicense or apply a different license to
34
+ the Software or any portion thereof.
35
+
36
+ ## What This Means in Practice
37
+
38
+ - ✅ Use in production — freely
39
+ - ✅ Use commercially — freely
40
+ - ✅ Bundle in your application — freely
41
+ - ✅ Read and learn from the source — freely
42
+ - ✅ Report issues and suggest changes — welcome
43
+ - ✅ Contribute changes back (via PR) — welcome (subject to CLA)
44
+ - ❌ Modify and distribute your own version — requires permission
45
+ - ❌ Fork and publish under a different name — requires permission
46
+ - ❌ Remove or change this license — prohibited
47
+
48
+ ## Contribution
49
+
50
+ Contributions submitted via pull request are welcome. By submitting a
51
+ contribution, you agree to assign copyright of your contribution to Causum
52
+ and agree that your contribution will be distributed under this same license.
53
+
54
+ ## No Warranty
55
+
56
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
59
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
61
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
62
+ SOFTWARE.
63
+
64
+ ## Contact
65
+
66
+ For modification permissions, commercial licensing inquiries, or questions:
67
+ - Email: licensing@causum.com
68
+ - Repository: https://github.com/owner-spec/aigp-protocol
69
+
70
+ ---
71
+
72
+ AIGP-Light is part of the AIGP protocol family.
73
+ AIGP is registered with the U.S. Copyright Office (Case #1-15160968741, #1-15180695311).
74
+ Patent-pending.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: maigp-light-a2a
3
+ Version: 1.0.0
4
+ Summary: AIGP-Light A2A Adapter — local detect & respond for Agent-to-Agent communication
5
+ Project-URL: Homepage, https://github.com/owner-spec/aigp-protocol
6
+ Project-URL: Repository, https://github.com/owner-spec/aigp-protocol
7
+ Author-email: Causum <engineering@causum.com>
8
+ License: # AIGP-Light Source Available License
9
+
10
+ Version 1.0, July 2026
11
+
12
+ Copyright (c) 2024-2026 Causum. All rights reserved.
13
+
14
+ ## Grant of Rights
15
+
16
+ Permission is hereby granted, free of charge, to any person or organization
17
+ obtaining a copy of this software and associated documentation files (the
18
+ "Software"), to:
19
+
20
+ 1. **Use** the Software for any purpose, including commercial applications,
21
+ without restriction.
22
+
23
+ 2. **Copy and distribute** the Software in unmodified form, provided this
24
+ license notice is included in all copies.
25
+
26
+ 3. **Integrate** the Software into applications, products, and services
27
+ without royalty or fee.
28
+
29
+ ## Restrictions
30
+
31
+ The following actions require prior written permission from Causum
32
+ (licensing@causum.com):
33
+
34
+ 1. **Modification** — You may not modify, alter, adapt, or create derivative
35
+ works based on the Software without explicit written permission from Causum.
36
+
37
+ 2. **Forking for distribution** — You may not distribute modified versions of
38
+ the Software, whether under this name or any other name.
39
+
40
+ 3. **Relicensing** — You may not sublicense or apply a different license to
41
+ the Software or any portion thereof.
42
+
43
+ ## What This Means in Practice
44
+
45
+ - ✅ Use in production — freely
46
+ - ✅ Use commercially — freely
47
+ - ✅ Bundle in your application — freely
48
+ - ✅ Read and learn from the source — freely
49
+ - ✅ Report issues and suggest changes — welcome
50
+ - ✅ Contribute changes back (via PR) — welcome (subject to CLA)
51
+ - ❌ Modify and distribute your own version — requires permission
52
+ - ❌ Fork and publish under a different name — requires permission
53
+ - ❌ Remove or change this license — prohibited
54
+
55
+ ## Contribution
56
+
57
+ Contributions submitted via pull request are welcome. By submitting a
58
+ contribution, you agree to assign copyright of your contribution to Causum
59
+ and agree that your contribution will be distributed under this same license.
60
+
61
+ ## No Warranty
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
64
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
66
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
67
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
68
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
69
+ SOFTWARE.
70
+
71
+ ## Contact
72
+
73
+ For modification permissions, commercial licensing inquiries, or questions:
74
+ - Email: licensing@causum.com
75
+ - Repository: https://github.com/owner-spec/aigp-protocol
76
+
77
+ ---
78
+
79
+ AIGP-Light is part of the AIGP protocol family.
80
+ AIGP is registered with the U.S. Copyright Office (Case #1-15160968741, #1-15180695311).
81
+ Patent-pending.
82
+ License-File: LICENSE.md
83
+ Keywords: a2a,agent-to-agent,aigp,detect,governance,multi-agent,respond
84
+ Classifier: Development Status :: 5 - Production/Stable
85
+ Classifier: Intended Audience :: Developers
86
+ Classifier: Programming Language :: Python :: 3
87
+ Classifier: Topic :: Security
88
+ Classifier: Topic :: Software Development :: Libraries
89
+ Requires-Python: >=3.10
90
+ Requires-Dist: maigp-light>=1.0.0
@@ -0,0 +1,142 @@
1
+ """AIGP-Light A2A Adapter — Local detect & respond for Agent-to-Agent communication.
2
+
3
+ Monitors inter-agent calls with behavioral detection and automated response.
4
+ No external governance service required.
5
+
6
+ Usage:
7
+ from aigp_light_a2a import LightA2AClient
8
+
9
+ governed = LightA2AClient(a2a_client, policy="aigp-light-a2a.yaml")
10
+ response = await governed.send_task(agent_url, task)
11
+ """
12
+
13
+ __version__ = "1.0.0"
14
+
15
+ from __future__ import annotations
16
+
17
+ import time
18
+ from dataclasses import dataclass
19
+ from typing import Any, Protocol
20
+
21
+ from aigp_light import AigpLight
22
+ from aigp_light.responses import CircuitOpenError, GovernanceBlockedError
23
+ from aigp_light.signals import CallObservation
24
+ from aigp_light.trace import TraceEmitter
25
+
26
+
27
+ class A2AClientProtocol(Protocol):
28
+ """Protocol for any A2A client."""
29
+ async def send_task(self, agent_url: str, task: dict) -> Any: ...
30
+
31
+
32
+ @dataclass
33
+ class A2ACallResult:
34
+ """Result from an A2A call for signal extraction."""
35
+ status: str # "completed", "failed", "rejected", "pending"
36
+ duration_ms: int = 0
37
+ input_tokens: int = 0
38
+ output_tokens: int = 0
39
+ content: str = ""
40
+ agent_id: str = ""
41
+
42
+
43
+ class LightA2AClient:
44
+ """AIGP-Light governed A2A client.
45
+
46
+ Wraps Agent-to-Agent protocol calls with local detect & respond:
47
+ - Monitors response latency per agent
48
+ - Detects agent unavailability (error rate)
49
+ - Circuit breaks unreliable agents
50
+ - Rate limits chatty inter-agent calls
51
+ - Detects rejection patterns (agent refusing tasks)
52
+ - Emits RFC-010 traces for audit trail
53
+
54
+ No external governance service. Policy from YAML/JSON.
55
+ """
56
+
57
+ def __init__(self, a2a_client: Any, policy: str | dict):
58
+ """Initialize with an A2A client and policy config.
59
+
60
+ Args:
61
+ a2a_client: Any object with send_task(agent_url, task) or similar
62
+ policy: Path to YAML/JSON config, or dict
63
+ """
64
+ self._client = a2a_client
65
+ if isinstance(policy, str):
66
+ self._gov = AigpLight.from_yaml(policy)
67
+ else:
68
+ self._gov = AigpLight.from_dict(policy)
69
+
70
+ async def send_task(
71
+ self,
72
+ agent_url: str,
73
+ task: dict,
74
+ *,
75
+ caller_agent_id: str = "",
76
+ session_id: str = "",
77
+ ) -> Any:
78
+ """Send a task to another agent with local governance.
79
+
80
+ Args:
81
+ agent_url: Target agent's A2A endpoint
82
+ task: Task payload (A2A Task object)
83
+ caller_agent_id: Identity of the calling agent
84
+ session_id: Session for trace linking
85
+
86
+ Returns:
87
+ A2A response (passthrough)
88
+
89
+ Raises:
90
+ CircuitOpenError: Target agent is circuit-broken
91
+ GovernanceBlockedError: Policy blocks this call
92
+ """
93
+ result = await self._gov.acall(
94
+ self._client.send_task,
95
+ agent_url, task,
96
+ )
97
+ return result
98
+
99
+ async def get_task(self, agent_url: str, task_id: str) -> Any:
100
+ """Poll task status with governance."""
101
+ result = await self._gov.acall(
102
+ self._client.get_task,
103
+ agent_url, task_id,
104
+ )
105
+ return result
106
+
107
+ async def cancel_task(self, agent_url: str, task_id: str) -> Any:
108
+ """Cancel a task with governance."""
109
+ result = await self._gov.acall(
110
+ self._client.cancel_task,
111
+ agent_url, task_id,
112
+ )
113
+ return result
114
+
115
+ def agent_health(self, agent_url: str) -> dict:
116
+ """Check governance health for a target agent."""
117
+ metrics = self._gov.metrics
118
+ return {
119
+ "agent_url": agent_url,
120
+ "circuit_open": metrics.get("circuit_open", False),
121
+ "error_rate": metrics.get("error_rate", 0),
122
+ "latency_p95_ms": metrics.get("latency_p95_ms", 0),
123
+ "total_calls": metrics.get("total_calls", 0),
124
+ }
125
+
126
+ @property
127
+ def metrics(self) -> dict:
128
+ """Current governance metrics."""
129
+ return self._gov.metrics
130
+
131
+ @property
132
+ def traces(self) -> list[dict]:
133
+ """All emitted traces."""
134
+ return self._gov.traces
135
+
136
+ def flush(self) -> None:
137
+ """Flush trace buffer."""
138
+ self._gov.flush()
139
+
140
+ def reset(self) -> None:
141
+ """Reset all state."""
142
+ self._gov.reset()
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "maigp-light-a2a"
7
+ version = "1.0.0"
8
+ description = "AIGP-Light A2A Adapter — local detect & respond for Agent-to-Agent communication"
9
+ license = {file = "LICENSE.md"}
10
+ requires-python = ">=3.10"
11
+ authors = [{name = "Causum", email = "engineering@causum.com"}]
12
+ dependencies = ["maigp-light>=1.0.0"]
13
+ keywords = ["aigp", "a2a", "agent-to-agent", "governance", "detect", "respond", "multi-agent"]
14
+ classifiers = [
15
+ "Development Status :: 5 - Production/Stable",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: Software Development :: Libraries",
19
+ "Topic :: Security",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/owner-spec/aigp-protocol"
24
+ Repository = "https://github.com/owner-spec/aigp-protocol"
25
+
26
+ [tool.hatch.build.targets.wheel]
27
+ packages = ["aigp_light_a2a"]