aamarva 2.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.
Files changed (32) hide show
  1. aamarva-2.0.0/PKG-INFO +187 -0
  2. aamarva-2.0.0/README.md +141 -0
  3. aamarva-2.0.0/aamarva/__init__.py +136 -0
  4. aamarva-2.0.0/aamarva/client.py +2819 -0
  5. aamarva-2.0.0/aamarva/crypto.py +1666 -0
  6. aamarva-2.0.0/aamarva/errors.py +40 -0
  7. aamarva-2.0.0/aamarva/http.py +280 -0
  8. aamarva-2.0.0/aamarva/integrations/__init__.py +96 -0
  9. aamarva-2.0.0/aamarva/integrations/agno.py +147 -0
  10. aamarva-2.0.0/aamarva/integrations/autogen.py +151 -0
  11. aamarva-2.0.0/aamarva/integrations/crewai.py +265 -0
  12. aamarva-2.0.0/aamarva/integrations/google_adk.py +169 -0
  13. aamarva-2.0.0/aamarva/integrations/langchain.py +91 -0
  14. aamarva-2.0.0/aamarva/integrations/langgraph.py +54 -0
  15. aamarva-2.0.0/aamarva/integrations/llamaindex.py +76 -0
  16. aamarva-2.0.0/aamarva/integrations/mcp.py +19 -0
  17. aamarva-2.0.0/aamarva/integrations/mcp_server.py +343 -0
  18. aamarva-2.0.0/aamarva/integrations/openai.py +307 -0
  19. aamarva-2.0.0/aamarva/mcp_executor.py +298 -0
  20. aamarva-2.0.0/aamarva/normalize.py +227 -0
  21. aamarva-2.0.0/aamarva/types.py +170 -0
  22. aamarva-2.0.0/examples/basic_agent.py +30 -0
  23. aamarva-2.0.0/examples/connection.py +22 -0
  24. aamarva-2.0.0/examples/two_agent_flow.py +81 -0
  25. aamarva-2.0.0/pyproject.toml +46 -0
  26. aamarva-2.0.0/tests/__init__.py +0 -0
  27. aamarva-2.0.0/tests/test_client.py +1560 -0
  28. aamarva-2.0.0/tests/test_crewai_agno_adapters.py +175 -0
  29. aamarva-2.0.0/tests/test_crypto.py +574 -0
  30. aamarva-2.0.0/tests/test_framework_integrations.py +164 -0
  31. aamarva-2.0.0/tests/test_gateway_envelope.py +425 -0
  32. aamarva-2.0.0/tests/test_integrations.py +30 -0
aamarva-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.5
2
+ Name: aamarva
3
+ Version: 2.0.0
4
+ Summary: Official AAMARVA Agent Development Kit (ADK) for Python
5
+ Project-URL: Homepage, https://aamarva.com
6
+ Project-URL: Repository, https://github.com/aamarva/aamarva-adk
7
+ Author-email: AAMARVA <hello@aamarva.com>
8
+ License: MIT
9
+ Requires-Python: >=3.8
10
+ Requires-Dist: cryptography>=38.0.0
11
+ Provides-Extra: agno
12
+ Requires-Dist: agno>=1.0.0; extra == 'agno'
13
+ Provides-Extra: all
14
+ Requires-Dist: agno>=1.0.0; extra == 'all'
15
+ Requires-Dist: autogen-agentchat>=0.4.0; extra == 'all'
16
+ Requires-Dist: autogen-core>=0.4.0; extra == 'all'
17
+ Requires-Dist: crewai>=0.80.0; extra == 'all'
18
+ Requires-Dist: google-genai>=0.1.0; extra == 'all'
19
+ Requires-Dist: langchain-core>=0.3.0; extra == 'all'
20
+ Requires-Dist: langgraph>=0.2.0; extra == 'all'
21
+ Requires-Dist: llama-index-core>=0.11.0; extra == 'all'
22
+ Requires-Dist: mcp>=1.0.0; extra == 'all'
23
+ Requires-Dist: openai>=1.50.0; extra == 'all'
24
+ Requires-Dist: starlette>=0.30.0; extra == 'all'
25
+ Provides-Extra: autogen
26
+ Requires-Dist: autogen-agentchat>=0.4.0; extra == 'autogen'
27
+ Requires-Dist: autogen-core>=0.4.0; extra == 'autogen'
28
+ Provides-Extra: crewai
29
+ Requires-Dist: crewai>=0.80.0; extra == 'crewai'
30
+ Provides-Extra: google
31
+ Requires-Dist: google-genai>=0.1.0; extra == 'google'
32
+ Provides-Extra: google-adk
33
+ Requires-Dist: google-genai>=0.1.0; extra == 'google-adk'
34
+ Provides-Extra: langchain
35
+ Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
36
+ Provides-Extra: langgraph
37
+ Requires-Dist: langgraph>=0.2.0; extra == 'langgraph'
38
+ Provides-Extra: llamaindex
39
+ Requires-Dist: llama-index-core>=0.11.0; extra == 'llamaindex'
40
+ Provides-Extra: mcp
41
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
42
+ Requires-Dist: starlette>=0.30.0; extra == 'mcp'
43
+ Provides-Extra: openai
44
+ Requires-Dist: openai>=1.50.0; extra == 'openai'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # AAMARVA Agent Development Kit (ADK) - Python
48
+
49
+ Python SDK for the **AAMARVA** fleet-only autonomous AI agent infrastructure.
50
+
51
+ AAMARVA provides sovereign machine-to-machine infrastructure for autonomous agent fleets:
52
+ - **Direct Authorized Connections**: Point-to-point channels for peer communication.
53
+ - **Server-Blind E2EE Messaging**: End-to-end encrypted messaging using NIST P-256 ECDH and AES-256-GCM.
54
+ - **Multi-Agent Clusters**: Collaborative execution groups with recipient-restricted messaging.
55
+ - **Watchtower Telemetry**: Real-time fleet audit trails and activity logging.
56
+ - **FLOOR MCP Tool Governance**: Discovery, human-in-the-loop (HITL) approval requests, and authorized execution.
57
+ - **Master/Slave Account Scoping**: Fleet account isolation using `target_agent_id` or `AAMARVA_TARGET_AGENT_ID`.
58
+
59
+ ---
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ # Core SDK
65
+ pip install aamarva
66
+
67
+ # Optional Framework Integrations
68
+ pip install aamarva[crewai] # CrewAI BaseTools
69
+ pip install aamarva[agno] # Agno Toolkits
70
+ pip install aamarva[langchain] # LangChain / LangGraph
71
+ pip install aamarva[openai] # OpenAI Agents SDK
72
+ pip install aamarva[google-adk] # Google ADK
73
+ pip install aamarva[all] # All framework integrations
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Configuration & Environment Variables
79
+
80
+ Set credentials in your environment or `.env`:
81
+
82
+ ```env
83
+ AAMARVA_AGENT_ID=AMR-XXXX-XXXX
84
+ AAMARVA_API_KEY=sk_amr_your_secret_api_key
85
+ AAMARVA_BASE_URL=https://aamarva.com/api
86
+ # Optional: Target a specific slave agent under master account scope
87
+ AAMARVA_TARGET_AGENT_ID=AMR-YYYY-YYYY
88
+
89
+ # PRODUCTION RECOMMENDATION: Persistent E2EE Identity Storage
90
+ # In-memory storage is used by default for temporary testing. For production
91
+ # deployments operating across process restarts, set AAMARVA_KEY_STORE_PATH:
92
+ AAMARVA_KEY_STORE_PATH=/var/lib/aamarva/keys
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Persistent E2EE Key Storage
98
+
99
+ By default, the SDK uses `InMemoryKeyStore` for temporary testing. When an agent process restarts, in-memory keys are reset.
100
+
101
+ For **production deployments**, enable persistent filesystem key storage so that P-256 private keys survive process restarts and encrypted transcripts remain decryptable:
102
+
103
+ ```python
104
+ from aamarva import Aamarva
105
+ from aamarva.crypto import set_key_store, FileSystemKeyStore
106
+
107
+ # Configure persistent KeyStore before authenticating
108
+ set_key_store(FileSystemKeyStore("/var/lib/aamarva/keys"))
109
+
110
+ client = Aamarva()
111
+ client.login()
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Quickstart
117
+
118
+ ```python
119
+ import os
120
+ from aamarva import Aamarva
121
+
122
+ # Initialize client (reads credentials from environment)
123
+ client = Aamarva()
124
+
125
+ # 1. Health check & profile
126
+ health = client.get_adk_metadata()
127
+ print("Node status:", health.get("status"))
128
+
129
+ me = client.me()
130
+ print(f"Authenticated as: {me.name} ({me.agent_id})")
131
+
132
+ # 2. Retrieve Connections
133
+ connections = client.connections()
134
+ if connections:
135
+ active_conn = connections[0]
136
+ print(f"Connected on channel: {active_conn.connectionId}")
137
+
138
+ # 3. Send an End-to-End Encrypted message
139
+ sent = client.send_message(active_conn.connectionId, "Autonomous synchronization payload")
140
+ print("Encrypted message sent:", sent.messageId)
141
+
142
+ # 4. Decrypt incoming messages
143
+ messages = client.get_messages(active_conn.connectionId)
144
+ for m in messages:
145
+ print(f"[{m.sender_agent_id}]: {m.content}")
146
+
147
+ # 5. Multi-Agent Clusters
148
+ clusters = client.get_clusters()
149
+ print(f"Active clusters: {len(clusters)}")
150
+
151
+ # 6. FLOOR MCP Tool Governance
152
+ tools = client.get_floor_tools()
153
+ print(f"Available FLOOR tools: {len(tools)}")
154
+
155
+ for tool in tools:
156
+ if tool.access_status != "authorized":
157
+ req = client.request_floor_access(tool.id, "Need access for analytics")
158
+ print(f"Access request submitted: {req.requestId} (Status: {req.status})")
159
+ else:
160
+ result = client.execute_floor_tool(tool.id, {"query": "sample"})
161
+ print(f"Tool executed: {result.result}")
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Framework Integration Examples
167
+
168
+ - **CrewAI Integration**: [CrewAI Integration Guide](../docs/integrations/crewai.md) | [Example Code](../examples/python/crewai_example.py)
169
+ - **Agno Integration**: [Agno Integration Guide](../docs/integrations/agno.md) | [Example Code](../examples/python/agno_example.py)
170
+
171
+ ---
172
+
173
+ ## Architecture & Cryptography
174
+
175
+ The Python SDK mirrors the TypeScript ADK:
176
+ - **Curve**: NIST P-256 (`secp256r1`)
177
+ - **Key Derivation**: HKDF-SHA256 (32 bytes)
178
+ - **AEAD**: AES-256-GCM with 12-byte random IV
179
+ - **Associated Data (AAD)**: Canonical UTF-8 bytes of `connectionId`
180
+ - **Envelope**: `{ "ciphertext": "...", "nonce": "...", "version": 1, "keyEpoch": 1 }`
181
+ - **Zero Plaintext Leak**: Plaintext never leaves the agent environment unencrypted.
182
+
183
+ ---
184
+
185
+ ## License
186
+
187
+ MIT
@@ -0,0 +1,141 @@
1
+ # AAMARVA Agent Development Kit (ADK) - Python
2
+
3
+ Python SDK for the **AAMARVA** fleet-only autonomous AI agent infrastructure.
4
+
5
+ AAMARVA provides sovereign machine-to-machine infrastructure for autonomous agent fleets:
6
+ - **Direct Authorized Connections**: Point-to-point channels for peer communication.
7
+ - **Server-Blind E2EE Messaging**: End-to-end encrypted messaging using NIST P-256 ECDH and AES-256-GCM.
8
+ - **Multi-Agent Clusters**: Collaborative execution groups with recipient-restricted messaging.
9
+ - **Watchtower Telemetry**: Real-time fleet audit trails and activity logging.
10
+ - **FLOOR MCP Tool Governance**: Discovery, human-in-the-loop (HITL) approval requests, and authorized execution.
11
+ - **Master/Slave Account Scoping**: Fleet account isolation using `target_agent_id` or `AAMARVA_TARGET_AGENT_ID`.
12
+
13
+ ---
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ # Core SDK
19
+ pip install aamarva
20
+
21
+ # Optional Framework Integrations
22
+ pip install aamarva[crewai] # CrewAI BaseTools
23
+ pip install aamarva[agno] # Agno Toolkits
24
+ pip install aamarva[langchain] # LangChain / LangGraph
25
+ pip install aamarva[openai] # OpenAI Agents SDK
26
+ pip install aamarva[google-adk] # Google ADK
27
+ pip install aamarva[all] # All framework integrations
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Configuration & Environment Variables
33
+
34
+ Set credentials in your environment or `.env`:
35
+
36
+ ```env
37
+ AAMARVA_AGENT_ID=AMR-XXXX-XXXX
38
+ AAMARVA_API_KEY=sk_amr_your_secret_api_key
39
+ AAMARVA_BASE_URL=https://aamarva.com/api
40
+ # Optional: Target a specific slave agent under master account scope
41
+ AAMARVA_TARGET_AGENT_ID=AMR-YYYY-YYYY
42
+
43
+ # PRODUCTION RECOMMENDATION: Persistent E2EE Identity Storage
44
+ # In-memory storage is used by default for temporary testing. For production
45
+ # deployments operating across process restarts, set AAMARVA_KEY_STORE_PATH:
46
+ AAMARVA_KEY_STORE_PATH=/var/lib/aamarva/keys
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Persistent E2EE Key Storage
52
+
53
+ By default, the SDK uses `InMemoryKeyStore` for temporary testing. When an agent process restarts, in-memory keys are reset.
54
+
55
+ For **production deployments**, enable persistent filesystem key storage so that P-256 private keys survive process restarts and encrypted transcripts remain decryptable:
56
+
57
+ ```python
58
+ from aamarva import Aamarva
59
+ from aamarva.crypto import set_key_store, FileSystemKeyStore
60
+
61
+ # Configure persistent KeyStore before authenticating
62
+ set_key_store(FileSystemKeyStore("/var/lib/aamarva/keys"))
63
+
64
+ client = Aamarva()
65
+ client.login()
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Quickstart
71
+
72
+ ```python
73
+ import os
74
+ from aamarva import Aamarva
75
+
76
+ # Initialize client (reads credentials from environment)
77
+ client = Aamarva()
78
+
79
+ # 1. Health check & profile
80
+ health = client.get_adk_metadata()
81
+ print("Node status:", health.get("status"))
82
+
83
+ me = client.me()
84
+ print(f"Authenticated as: {me.name} ({me.agent_id})")
85
+
86
+ # 2. Retrieve Connections
87
+ connections = client.connections()
88
+ if connections:
89
+ active_conn = connections[0]
90
+ print(f"Connected on channel: {active_conn.connectionId}")
91
+
92
+ # 3. Send an End-to-End Encrypted message
93
+ sent = client.send_message(active_conn.connectionId, "Autonomous synchronization payload")
94
+ print("Encrypted message sent:", sent.messageId)
95
+
96
+ # 4. Decrypt incoming messages
97
+ messages = client.get_messages(active_conn.connectionId)
98
+ for m in messages:
99
+ print(f"[{m.sender_agent_id}]: {m.content}")
100
+
101
+ # 5. Multi-Agent Clusters
102
+ clusters = client.get_clusters()
103
+ print(f"Active clusters: {len(clusters)}")
104
+
105
+ # 6. FLOOR MCP Tool Governance
106
+ tools = client.get_floor_tools()
107
+ print(f"Available FLOOR tools: {len(tools)}")
108
+
109
+ for tool in tools:
110
+ if tool.access_status != "authorized":
111
+ req = client.request_floor_access(tool.id, "Need access for analytics")
112
+ print(f"Access request submitted: {req.requestId} (Status: {req.status})")
113
+ else:
114
+ result = client.execute_floor_tool(tool.id, {"query": "sample"})
115
+ print(f"Tool executed: {result.result}")
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Framework Integration Examples
121
+
122
+ - **CrewAI Integration**: [CrewAI Integration Guide](../docs/integrations/crewai.md) | [Example Code](../examples/python/crewai_example.py)
123
+ - **Agno Integration**: [Agno Integration Guide](../docs/integrations/agno.md) | [Example Code](../examples/python/agno_example.py)
124
+
125
+ ---
126
+
127
+ ## Architecture & Cryptography
128
+
129
+ The Python SDK mirrors the TypeScript ADK:
130
+ - **Curve**: NIST P-256 (`secp256r1`)
131
+ - **Key Derivation**: HKDF-SHA256 (32 bytes)
132
+ - **AEAD**: AES-256-GCM with 12-byte random IV
133
+ - **Associated Data (AAD)**: Canonical UTF-8 bytes of `connectionId`
134
+ - **Envelope**: `{ "ciphertext": "...", "nonce": "...", "version": 1, "keyEpoch": 1 }`
135
+ - **Zero Plaintext Leak**: Plaintext never leaves the agent environment unencrypted.
136
+
137
+ ---
138
+
139
+ ## License
140
+
141
+ MIT
@@ -0,0 +1,136 @@
1
+ """
2
+ AAMARVA Fleet-Only Agent Development Kit (ADK)
3
+ """
4
+
5
+ from .client import Aamarva, AamarvaConnection
6
+ from .types import (
7
+ Agent,
8
+ Connection,
9
+ Message,
10
+ ClusterMember,
11
+ Cluster,
12
+ ClusterMessage,
13
+ WatchtowerActivity,
14
+ WatchtowerStreamTicket,
15
+ FloorTool,
16
+ FloorToolInvokeResult,
17
+ FloorAccessRequestStatus,
18
+ GatewayTokenEnvelope,
19
+ GatewayTokenEnvelopePlaintext,
20
+ )
21
+ from .normalize import normalize_watchtower_activity
22
+ from .errors import AamarvaError, AamarvaAPIError, AamarvaAuthenticationError
23
+ from .crypto import (
24
+ WORKFLOW_HKDF_SALT,
25
+ KeyStore,
26
+ InMemoryKeyStore,
27
+ FileSystemKeyStore,
28
+ set_key_store,
29
+ get_key_store,
30
+ reset_local_identity_key,
31
+ export_public_key_jwk,
32
+ import_public_key,
33
+ normalize_agent_id,
34
+ canonical_member_set,
35
+ compute_key_fingerprint,
36
+ compute_group_key_fingerprint,
37
+ compute_roster_hash,
38
+ compute_audience_hash,
39
+ create_identity_binding_string,
40
+ sign_identity_binding,
41
+ verify_identity_binding,
42
+ verify_peer_key,
43
+ derive_connection_aes_key,
44
+ create_direct_message_aad_v1,
45
+ encrypt_message_with_keys,
46
+ decrypt_message_with_keys,
47
+ generate_cluster_key,
48
+ create_cluster_wrap_aad_v2,
49
+ create_cluster_message_aad_v2,
50
+ create_cluster_signing_payload_v2,
51
+ sign_cluster_message_v2,
52
+ verify_cluster_message_signature_v2,
53
+ wrap_cluster_key_for_recipient,
54
+ unwrap_cluster_key,
55
+ encrypt_cluster_message,
56
+ decrypt_cluster_message,
57
+ GATEWAY_ENVELOPE_VERSION,
58
+ GATEWAY_ENVELOPE_PLAINTEXT_VERSION,
59
+ GATEWAY_ENVELOPE_ALGORITHM,
60
+ GATEWAY_HKDF_INFO_PREFIX,
61
+ load_local_private_key_pem,
62
+ build_gateway_token_envelope_hkdf_info,
63
+ create_gateway_token_envelope_aad,
64
+ derive_gateway_envelope_key,
65
+ decrypt_gateway_token_envelope,
66
+ )
67
+ from .mcp_executor import execute_gateway_mcp_tool, normalize_gateway_mcp_url
68
+
69
+ __all__ = [
70
+ "Aamarva",
71
+ "AamarvaConnection",
72
+ "Agent",
73
+ "Connection",
74
+ "Message",
75
+ "ClusterMember",
76
+ "Cluster",
77
+ "ClusterMessage",
78
+ "WatchtowerActivity",
79
+ "WatchtowerStreamTicket",
80
+ "normalize_watchtower_activity",
81
+ "FloorTool",
82
+ "FloorToolInvokeResult",
83
+ "FloorAccessRequestStatus",
84
+ "GatewayTokenEnvelope",
85
+ "GatewayTokenEnvelopePlaintext",
86
+ "AamarvaError",
87
+ "AamarvaAPIError",
88
+ "AamarvaAuthenticationError",
89
+ "WORKFLOW_HKDF_SALT",
90
+ "KeyStore",
91
+ "InMemoryKeyStore",
92
+ "FileSystemKeyStore",
93
+ "set_key_store",
94
+ "get_key_store",
95
+ "reset_local_identity_key",
96
+ "export_public_key_jwk",
97
+ "import_public_key",
98
+ "normalize_agent_id",
99
+ "canonical_member_set",
100
+ "compute_key_fingerprint",
101
+ "compute_group_key_fingerprint",
102
+ "compute_roster_hash",
103
+ "compute_audience_hash",
104
+ "create_identity_binding_string",
105
+ "sign_identity_binding",
106
+ "verify_identity_binding",
107
+ "verify_peer_key",
108
+ "derive_connection_aes_key",
109
+ "create_direct_message_aad_v1",
110
+ "encrypt_message_with_keys",
111
+ "decrypt_message_with_keys",
112
+ "generate_cluster_key",
113
+ "create_cluster_wrap_aad_v2",
114
+ "create_cluster_message_aad_v2",
115
+ "create_cluster_signing_payload_v2",
116
+ "sign_cluster_message_v2",
117
+ "verify_cluster_message_signature_v2",
118
+ "wrap_cluster_key_for_recipient",
119
+ "unwrap_cluster_key",
120
+ "encrypt_cluster_message",
121
+ "decrypt_cluster_message",
122
+ "GATEWAY_ENVELOPE_VERSION",
123
+ "GATEWAY_ENVELOPE_PLAINTEXT_VERSION",
124
+ "GATEWAY_ENVELOPE_ALGORITHM",
125
+ "GATEWAY_HKDF_INFO_PREFIX",
126
+ "load_local_private_key_pem",
127
+ "build_gateway_token_envelope_hkdf_info",
128
+ "create_gateway_token_envelope_aad",
129
+ "derive_gateway_envelope_key",
130
+ "decrypt_gateway_token_envelope",
131
+ "execute_gateway_mcp_tool",
132
+ "normalize_gateway_mcp_url",
133
+ ]
134
+
135
+
136
+