Use the asynchronous Python client¶
Use the asynchronous client to run independent conversations concurrently without blocking an event loop.
Mapping¶
| Synchronous | Asynchronous |
|---|---|
CortexAgentClient | AsyncCortexAgentClient |
Conversation | AsyncConversation |
Turn | AsyncTurn |
conversation.send() | await conversation.send() |
turn.result() | await turn.result() |
Send a turn¶
Read events¶
Cancel, history, and attach¶
Call cancel(), result(), and events() on the AsyncTurn that send() returned. turn.id is the
server-assigned run ID. The root client does not recover a turn from that ID.
Concurrency and ordering¶
Independent conversations can run concurrently with asyncio.gather(). Calls to send() on the same conversation
are serialized so each request uses the previous successful assistant message as its parent.
Next steps¶
Legal notices¶
Where your configuration of Cortex Code uses a model provided on the Model and Service Pass-Through Terms, your use of that model is further subject to the terms for that model on that page.
The data classification of inputs and outputs are as set forth in the following table.
| Input data classification | Output data classification | Designation |
|---|---|---|
| Usage Data | Customer Data | Covered AI Features [1] |
For additional information, refer to Snowflake AI and ML.