Skip to main content

Snowflake Cortex Agent SDK for Python

The SDK centers on conversations, durable turns, and completed responses. It uses background runs internally while hiding run and thread bookkeeping.

from cortex_agent_sdk import (
    AgentResponse,
    Conversation,
    ConversationMessage,
    CortexAgentClient,
    Turn,
)

client: CortexAgentClient = CortexAgentClient(account="my_account", auth="<token>")
conversation: Conversation = client.conversations.create(
    origin_application="cortex_agent_sdk",
    agent={"type": "inline", "spec": {"models": {"orchestration": "auto"}}},
)
turn: Turn = conversation.send("What is Snowflake Arctic?")
answer: AgentResponse = turn.result()
print(answer.text)

history: list[ConversationMessage] = conversation.history()

Set a default agent when creating a conversation. A send can override it for one turn when needed:

inline_turn: Turn = conversation.send(
    "Summarize the context.",
    agent={"type": "inline", "spec": {"models": {"orchestration": "auto"}}},
)

data_turn: Turn = conversation.send(
    "Which products grew fastest?",
    agent={
        "type": "data",
        "spec": {"database": "ANALYTICS", "schema": "PUBLIC", "name": "SALES_AGENT"},
    },
)

coding_turn: Turn = conversation.send(
    "Fix the failing test.",
    agent={
        "type": "coding",
        "spec": {
            "models": {"orchestration": "claude-sonnet-4-5"},
            "permission_policy": "always_allow",
            "workspace_mounts": [{"name": "USER$MY_USER.PUBLIC.DEFAULT$"}],
        },
    },
)

Use turn.events() for event-level progress and turn.cancel() to stop a run.

The asynchronous API mirrors the sync API:

from cortex_agent_sdk import AgentResponse, AsyncConversation, AsyncCortexAgentClient, AsyncTurn

async with AsyncCortexAgentClient(account="my_account", auth="<token>") as client:
    conversation: AsyncConversation = await client.conversations.create(
        origin_application="cortex_agent_sdk", agent={"type": "inline", "spec": {}}
    )
    turn: AsyncTurn = await conversation.send("Analyze this data.")
    answer: AgentResponse = await turn.result()

The root client exposes conversations and feedback. Advanced streaming and explicit run/thread management live under cortex_agent_sdk.api:

from cortex_agent_sdk.api import CortexAgentClient

api_client: CortexAgentClient = CortexAgentClient(
    account="my_account",
    auth="<token>",
)

Authentication headers are rebuilt for every attempt. refresh_auth runs only for recognized token/session expiry responses; by default the SDK refreshes once and replays the request once. SDK-generated errors do not include credential values.

Requires Python 3.10 or newer.

Metadata

Release files for snowflake-cortex-agent-sdk 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snowflake-cortex-agent-sdk 0.0.2
File Size Uploaded Provenance Actions
snowflake_cortex_agent_sdk-0.0.2.tar.gz 156.8 kB Without provenance Details for snowflake_cortex_agent_sdk-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for snowflake-cortex-agent-sdk 0.0.2
File Interpreter ABI Platform Actions
snowflake_cortex_agent_sdk-0.0.2-py3-none-any.whl Python 3 none any Details for snowflake_cortex_agent_sdk-0.0.2-py3-none-any.whl

Total release size: 344.1 kB

Release files / snowflake_cortex_agent_sdk-0.0.2.tar.gz

Download URL snowflake_cortex_agent_sdk-0.0.2.tar.gz
Size 156.8 kB
Tags Source
SHA-256 checksum
How to use checksums
74bfb75fb3fe79a45753c494ae937cc69bae4efa951113df7bee2570ad719140
BLAKE2b-256 checksum
How to use checksums
786f34ee8631a69dcce624d9073fac581b984fcc339a21d5b1a2dc015265223c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.8

Release files / snowflake_cortex_agent_sdk-0.0.2-py3-none-any.whl

Download URL snowflake_cortex_agent_sdk-0.0.2-py3-none-any.whl
Size 187.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc84370efe34a6b78a5b7f9b8af6ccf23c4abe9a9570baccdebf57423c987796
BLAKE2b-256 checksum
How to use checksums
b3b34f20734d69f15a22051663b522103d91bb043a670fa17d1cef1235824163
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.8

Security for snowflake-cortex-agent-sdk 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page