uagents-core 0.3.1__tar.gz → 0.3.2__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.
- {uagents_core-0.3.1 → uagents_core-0.3.2}/PKG-INFO +1 -1
- {uagents_core-0.3.1 → uagents_core-0.3.2}/pyproject.toml +1 -1
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/registration.py +7 -1
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/storage.py +1 -1
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/utils/registration.py +36 -1
- {uagents_core-0.3.1 → uagents_core-0.3.2}/README.md +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/__init__.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/config.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/contrib/__init__.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/contrib/protocols/__init__.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/contrib/protocols/chat/__init__.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/contrib/protocols/subscriptions/__init__.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/envelope.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/helpers.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/identity.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/logger.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/models.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/protocol.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/types.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/utils/__init__.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/utils/messages.py +0 -0
- {uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/utils/resolver.py +0 -0
@@ -70,7 +70,7 @@ class VerifiableModel(BaseModel):
|
|
70
70
|
class AgentRegistrationAttestation(VerifiableModel):
|
71
71
|
protocols: list[str]
|
72
72
|
endpoints: list[AgentEndpoint]
|
73
|
-
metadata: dict[str, str | dict[str, str]] | None = None
|
73
|
+
metadata: dict[str, str | list[str] | dict[str, str]] | None = None
|
74
74
|
|
75
75
|
|
76
76
|
# Agentverse related models
|
@@ -107,3 +107,9 @@ class AgentUpdates(BaseModel):
|
|
107
107
|
avatar_url: str | None = Field(default=None, max_length=4000)
|
108
108
|
short_description: str | None = Field(default=None, max_length=300)
|
109
109
|
agent_type: AgentType | None = "custom"
|
110
|
+
|
111
|
+
|
112
|
+
class AgentStatusUpdate(VerifiableModel):
|
113
|
+
is_active: bool = Field(
|
114
|
+
..., description="Indicates whether the agent is currently active"
|
115
|
+
)
|
@@ -56,7 +56,7 @@ class ExternalStorage:
|
|
56
56
|
raise RuntimeError("No identity or API token available for authentication")
|
57
57
|
|
58
58
|
def upload(
|
59
|
-
self, asset_id: str,
|
59
|
+
self, asset_id: str, content: bytes, mime_type: str = "text/plain"
|
60
60
|
) -> dict:
|
61
61
|
url = f"{self.storage_url}/assets/{asset_id}/contents/"
|
62
62
|
headers = self._get_auth_header()
|
@@ -19,6 +19,7 @@ from uagents_core.logger import get_logger
|
|
19
19
|
from uagents_core.protocol import is_valid_protocol_digest
|
20
20
|
from uagents_core.registration import (
|
21
21
|
AgentRegistrationAttestation,
|
22
|
+
AgentStatusUpdate,
|
22
23
|
AgentUpdates,
|
23
24
|
AgentverseConnectRequest,
|
24
25
|
ChallengeRequest,
|
@@ -66,7 +67,7 @@ def register_in_almanac(
|
|
66
67
|
identity: Identity,
|
67
68
|
endpoints: list[str],
|
68
69
|
protocol_digests: list[str],
|
69
|
-
metadata: dict[str, str | dict[str, str]] | None = None,
|
70
|
+
metadata: dict[str, str | list[str] | dict[str, str]] | None = None,
|
70
71
|
*,
|
71
72
|
agentverse_config: AgentverseConfig | None = None,
|
72
73
|
timeout: int = DEFAULT_REQUEST_TIMEOUT,
|
@@ -269,3 +270,37 @@ def register_in_agentverse(
|
|
269
270
|
exc_info=e,
|
270
271
|
)
|
271
272
|
return False
|
273
|
+
|
274
|
+
|
275
|
+
def update_agent_status(active: bool, identity: Identity):
|
276
|
+
"""
|
277
|
+
Update the agent's active/inactive status in the Almanac API.
|
278
|
+
|
279
|
+
Args:
|
280
|
+
active (bool): The status of the agent.
|
281
|
+
identity (Identity): The identity of the agent.
|
282
|
+
"""
|
283
|
+
almanac_api = AgentverseConfig().url + DEFAULT_ALMANAC_API_PATH
|
284
|
+
|
285
|
+
status_update = AgentStatusUpdate(
|
286
|
+
agent_identifier=identity.address, is_active=active
|
287
|
+
)
|
288
|
+
status_update.sign(identity)
|
289
|
+
|
290
|
+
logger.debug(
|
291
|
+
msg="Updating agent status in Almanac API",
|
292
|
+
extra=status_update.model_dump(),
|
293
|
+
)
|
294
|
+
|
295
|
+
status, _ = _send_post_request(
|
296
|
+
url=f"{almanac_api}/agents/{identity.address}/status",
|
297
|
+
data=status_update,
|
298
|
+
)
|
299
|
+
|
300
|
+
if status:
|
301
|
+
logger.info(
|
302
|
+
msg=f"Agent status updated to {'active' if active else 'inactive'}",
|
303
|
+
extra={"agent_address": identity.address},
|
304
|
+
)
|
305
|
+
|
306
|
+
return status
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{uagents_core-0.3.1 → uagents_core-0.3.2}/uagents_core/contrib/protocols/subscriptions/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|