Skip to Content
References

src.uagents.envelope

Agent Envelope - Github

Envelope Objects

class Envelope(BaseModel)

Represents an envelope for message communication between agents.

Attributes:

  • version int - The envelope version.
  • sender str - The sender’s address.
  • target str - The target’s address.
  • session UUID4 - The session UUID that persists for back-and-forth dialogues between agents.
  • schema_digest str - The schema digest for the enclosed message.
  • protocol_digest Optional[str] - The digest of the protocol associated with the message (optional).
  • payload Optional[str] - The encoded message payload of the envelope (optional).
  • expires Optional[int] - The expiration timestamp (optional).
  • nonce Optional[int] - The nonce value (optional).
  • signature Optional[str] - The envelope signature (optional).

encode_payload

def encode_payload(value: JsonStr)

Encode the payload value and store it in the envelope.

Arguments:

  • value JsonStr - The payload value to be encoded.

decode_payload

def decode_payload() -> str

Decode 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_fn callback - The callback used for signing.

verify

def verify() -> bool

Verify 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