Cortex Agent SDK for Python and TypeScript in Snowflake
The Cortex Agent SDK allows building applications that use Cortex Agents and Cortex Code in Python and TypeScript.
O que mudou
Use cases
Imagine you have a custom application and need to integrate AI to query enterprise data securely, maintain multi-turn conversations, and run long background tasks. With the SDK, you can:
- Query governed data using Cortex Analyst and Cortex Search.
- Maintain persistent multi-turn conversations.
- Run tasks in the background and reconnect by run ID.
- Integrate Cortex Code for agentic development workflows.
How to use
Install the TypeScript package:
npm install "@snowflake/cortex-agent-sdk@>=0.0.2"
Start a conversation and send a message:
import {
CortexAgentClient,
type AgentResponse,
type Conversation,
type Turn,
} from "@snowflake/cortex-agent-sdk";
const client: CortexAgentClient = new CortexAgentClient({
account: process.env.SNOWFLAKE_ACCOUNT!,
auth: process.env.SNOWFLAKE_PAT!,
});
const conversation: Conversation = await client.conversations.create({
thread: { origin_application: "my-app" },
agent: {
type: "inline",
spec: { models: { orchestration: "claude-sonnet-4-5" } },
},
});
const turn: Turn = await conversation.send("Explain Snowflake micro-partitions in three sentences.");
const answer: AgentResponse = await turn.result();
console.log(answer.text);
What happens in this code:
- Initializes the Cortex Agent client using environment variables for the account and token.
- Creates a new conversation linked to an inline agent.
- Sends an instruction for the agent to process.
- Awaits the result and prints the returned response.
Install the Python package:
pip install "snowflake-cortex-agent-sdk>=0.0.2"
Run a basic call in Python:
from cortex_agent_sdk import AgentResponse, Conversation, CortexAgentClient, Turn
client: CortexAgentClient = CortexAgentClient(account="my_account", auth="<token>")
conversation: Conversation = client.conversations.create(
origin_application="cortex_agent_sdk",
agent={"type": "inline", "spec": {}},
)
turn: Turn = conversation.send("What can Cortex Agent do?")
answer: AgentResponse = turn.result()
print(answer.text)
What happens in this code:
- Creates a client instance passing the account and authentication token.
- Sets up a new conversation session with an inline agent.
- Sends a question to the agent.
- Collects and displays the generated response text.
Limitations and requirements
- Stage: Public Preview.
- The Python SDK requires Python 3.10 or later.
- The TypeScript SDK requires Node.js 22.22 or later.
- Requires a Snowflake account with Cortex Agents enabled and valid credentials (PAT, OAuth, key-pair JWT, or session token).
- cortex agents
- python
- typescript
- sdk
- ai
Cortex Agent SDK (Public Preview)
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- SnowflakeGA
Geração de documentos em PDF, Word e PowerPoint no Snowflake CoWork
O Snowflake CoWork agora gera arquivos PDF, Word, PowerPoint e HTML diretamente de suas análises usando a ferramenta de execução de código do Cortex Agent.
snowflake cowork · cortex agent - SnowflakeAtualização
Mensagens de erro mais detalhadas na classificação de dados sensíveis
A view DATA_CLASSIFICATION_LATEST agora traz mensagens de erro específicas e códigos do Snowflake para falhas na classificação.
data governance · trust center - SnowflakeGA
Detalhes de predicados e tipos de query na LISTING_ACCESS_HISTORY
A visão LISTING_ACCESS_HISTORY agora traz detalhes de colunas usadas em filtros, agrupamentos e o tipo de query executada por consumidores em dados compartilhados.
data sharing · listings