{"id":31482322,"url":"https://github.com/snowflake-labs/sfguide-getting-started-with-cortex-agents","last_synced_at":"2025-10-02T07:47:41.237Z","repository":{"id":277282188,"uuid":"931186064","full_name":"Snowflake-Labs/sfguide-getting-started-with-cortex-agents","owner":"Snowflake-Labs","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-03T21:18:11.000Z","size":3548,"stargazers_count":16,"open_issues_count":1,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-03T21:39:07.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Snowflake-Labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-11T21:19:29.000Z","updated_at":"2025-08-21T17:19:08.000Z","dependencies_parsed_at":"2025-03-05T18:21:00.304Z","dependency_job_id":"11c1d9c6-f565-4855-809d-68e3c01088f8","html_url":"https://github.com/Snowflake-Labs/sfguide-getting-started-with-cortex-agents","commit_stats":null,"previous_names":["snowflake-labs/sfguide-getting-started-with-cortex-agents"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Snowflake-Labs/sfguide-getting-started-with-cortex-agents","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2Fsfguide-getting-started-with-cortex-agents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2Fsfguide-getting-started-with-cortex-agents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2Fsfguide-getting-started-with-cortex-agents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2Fsfguide-getting-started-with-cortex-agents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snowflake-Labs","download_url":"https://codeload.github.com/Snowflake-Labs/sfguide-getting-started-with-cortex-agents/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snowflake-Labs%2Fsfguide-getting-started-with-cortex-agents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277974415,"owners_count":25908396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-02T02:00:08.890Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-02T07:47:38.793Z","updated_at":"2025-10-02T07:47:41.231Z","avatar_url":"https://github.com/Snowflake-Labs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting Started with Cortex Agents\n\n![Alt Text](./agent_demo_video.gif)\n\n## Overview\nThis project utilizes Snowflake Cortex Agents to analyze sales conversations and extract actionable insights. \nBy leveraging semantic search and AI-driven analytics, the platform enables sales teams to gain deeper visibility into \ncustomer interactions, sales performance, and deal outcomes.\n\nThe core functionalities include:\n\n- Sales conversation analysis using Snowflake Cortex Search\n- Semantic search over sales data utilizing Cortex Analyst\n- Use Cortex Agents to use both under one API\n\nIn this quickstart you will:\n- Create a Cortex Search Service\n- Create a Semantic Model for Cortex Analyst\n- Create a Data Agent that can use Cortex Search and Cortex Analyst\n- Create a streamlit application to chat with the Agent via the API\n\n## Step-By-Step Guide\nYou can follow this guide here or in the [QuickStart Guide](https://quickstarts.snowflake.com/guide/getting_started_with_cortex_agents/index.html#0)\n\n#### 1. Run setup script\nFirst, let's get your account setup with some sample data. Run the script in `setup.sql` in a worksheet, with \n[snowsql](https://docs.snowflake.com/en/user-guide/snowsql), or any other way you prefer.\nIf you with to use a pre-existing database, schema, and warehouse, skip the first two steps of the setup script.\n\n#### 2. Upload semantic model\nUpload the Semantic Model yaml `sales_metrics_model.yaml`.\n\nIn Snowsight:\n- Navigate to Data (Or Catalog » Database Explorer) » Databases » SALES_INTELLIGENCE » DATA » Stages » MODELS\n- Click \"+ Files\" in the top right\n- Browse and select sales_metrics_model.yaml file\n- Click \"Upload\"\n\nOr with `snowsql` run: `PUT file://sales_metrics_model.yaml @sales_intelligence.data.models AUTO_COMPRESS=false;`\n\n#### 3. Create a PAT token to call the Snowflake REST APIs\nIn Snowsight:\n- Click on your profile (bottom left corner) » Settings » Authentication\n- Under `Programmatic access tokens`, click `Generate new token`\n- Select `Single Role` and select `sales_intelligence_rl`\n- Copy and save the token for later (you will not be able to see it again)\n\n#### 4. Create the Agent\nRun the following command on your terminal to create an Agent via the REST API, replacing the PAT token and account URL.\nYou can find your account URL in Snowsight: Click on your profile (bottom left corner) » Account » View account details.\n```\ncurl -X POST https://{ACCOUNT_URL}/api/v2/databases/snowflake_intelligence/schemas/agents/agents \\\n-H 'Content-Type: application/json' \\\n-H 'Accept: application/json' \\\n-H 'Authorization: Bearer {PAT_TOKEN}' \\\n-d @create_agent.json\n```\n\nAlternatively, you can create the Agent in Snowsight navigating to AI \u0026 ML » Agents » Create Agent (see step by step \nin the [QuickStart Guide](https://quickstarts.snowflake.com/guide/getting_started_with_cortex_agents/index.html?index=..%2F..index#3)).\n\nAfter creating you can chat with the Agent via Snowflake Intelligence.\nIn Snowsight, click on AI \u0026 ML » Snowflake Intelligence, select the `SALES_INTELLIGENCE_AGENT` in the chat bar, and ask\nany questions you'd like!\n\n#### 5. Run the streamlit\nNow that you have created your agent, run the sample streamlit to interact with it.\nMake sure to populate the PAT and HOST params correctly.\n(Note: this guide was built using Python 3.11)\n\n```\npython3 -m venv venv\nsource venv/bin/activate\npip3 install -r requirements.txt\n\nCORTEX_AGENT_DEMO_PAT=\u003cPAT\u003e \\\nCORTEX_AGENT_DEMO_HOST=\u003cACCOUNT_URL\u003e \\\nCORTEX_AGENT_DEMO_DATABASE=\"SNOWFLAKE_INTELLIGENCE\" \\\nCORTEX_AGENT_DEMO_SCHEMA=\"AGENTS\" \\\nCORTEX_AGENT_DEMO_AGENT=\"SALES_INTELLIGENCE_AGENT\" \\\nstreamlit run data_agent_demo.py\n```\n\nThe streamlit uses python code auto-generated using https://openapi-generator.tech/. It creates the pydantic classes in\n`/models` for the request and response objects based on the OpenAPI spec at `cortexagent-run.yaml`. You can regenerate\nthose files by running the script `openapi-generator.sh` (assuming you have docker installed and running locally).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowflake-labs%2Fsfguide-getting-started-with-cortex-agents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowflake-labs%2Fsfguide-getting-started-with-cortex-agents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowflake-labs%2Fsfguide-getting-started-with-cortex-agents/lists"}