Upload Cortex Agent
Tool usage: see parent
agent/SKILL.md.
Workflow
Step 1: Identify Agent and Target
- Ask for
DATABASE.SCHEMA.AGENT_NAME. The workspace must already contain a spec for this agent (from a prioragent-write/agent-read/ download).
Step 2: Save to Snowflake
Save the agent spec from workspace to Snowflake. You must provide the YAML content via one of these methods:
Option A (recommended): Use
--file-pathto load from workspace file:cortex agent-studio agent-save --fqn <DATABASE>.<SCHEMA>.<AGENT_NAME> --file-path <AGENT_NAME>.agent.yamlOption B: If the FQN is already registered in
cortex-project.yaml(from a prioragent-write), you can omit--fqn:cortex agent-studio agent-save --file-path <AGENT_NAME>.agent.yamlConfirm to the user:
Agent specification uploaded and saved to <DATABASE>.<SCHEMA>.<AGENT_NAME>.
Step 3: Check if saved version is not live and publish (optional)
Run via snowflake_sql_execute:
SHOW VERSIONS IN AGENT <DATABASE>.<SCHEMA>.<AGENT_NAME>;
If the result returns more than two rows (i.e. additional versions beyond the live version and VERSION$1), ask the user whether they want to publish the agent. Display this message verbatim:
The saved version is not in use, would you like to publish the saved version?
Only if they confirm, use agent-publish — do NOT use any other command (no ALTER AGENT, no agent-save, no SQL):
cortex agent-studio agent-publish --fqn <DATABASE>.<SCHEMA>.<AGENT_NAME>
Agent upload complete.