Bookmark
Query Envelopes
query
async def query(destination: str,
message: Model,
resolver: Optional[Resolver] = None,
timeout: Optional[int] = 30) -> Optional[Envelope]
Query a remote agent with a message and retrieve the response envelope.
Arguments:
destination
str - The destination address of the remote agent.message
Model - The message to send.resolver
Optional[Resolver], optional - The resolver to use for endpoint resolution. Defaults to GlobalResolver.timeout
Optional[int], optional - The timeout for the query in seconds. Defaults to 30.
Returns:
Optional[Envelope]
- The response envelope if successful, otherwise None.
enclose_
response
def enclose_response(message: Model, sender: str, session: str) -> str
Enclose a response message within an envelope.
Arguments:
message
Model - The response message to enclose.sender
str - The sender's address.session
str - The session identifier.
Returns:
str
- The JSON representation of the response envelope.
enclose_
response_
raw
def enclose_response_raw(json_message: JsonStr, schema_digest: str,
sender: str, session: str) -> str
Enclose a raw response message within an envelope.
Arguments:
json_message
JsonStr - The JSON-formatted response message to enclose.schema_digest
str - The schema digest of the message.sender
str - The sender's address.session
str - The session identifier.
Returns:
str
- The JSON representation of the response envelope.