src.uagents.envelope
Agent Envelope - Github
Envelope Objects
class Envelope(BaseModel)Represents an envelope for message communication between agents.
Attributes:
versionint - The envelope version.senderstr - The sender’s address.targetstr - The target’s address.sessionUUID4 - The session UUID that persists for back-and-forth dialogues between agents.schema_digeststr - The schema digest for the enclosed message.protocol_digestOptional[str] - The digest of the protocol associated with the message (optional).payloadOptional[str] - The encoded message payload of the envelope (optional).expiresOptional[int] - The expiration timestamp (optional).nonceOptional[int] - The nonce value (optional).signatureOptional[str] - The envelope signature (optional).
encode_payload
def encode_payload(value: JsonStr)Encode the payload value and store it in the envelope.
Arguments:
valueJsonStr - The payload value to be encoded.
decode_payload
def decode_payload() -> strDecode and retrieve the payload value from the envelope.
Returns:
str- The decoded payload value, or ” if payload is not present.
sign
def sign(signing_fn: Callable)Sign the envelope using the provided signing function.
Arguments:
signing_fncallback - The callback used for signing.
verify
def verify() -> boolVerify the envelope’s signature.
Returns:
bool- True if the signature is valid.
Raises:
ValueError- If the signature is missing.ecdsa.BadSignatureError- If the signature is invalid.
EnvelopeHistory Objects
class EnvelopeHistory(BaseModel)apply_retention_policy
def apply_retention_policy()Remove entries older than 24 hours
Last updated on