RepoSnowflake (Arctic)Snowflake (Arctic)published Apr 24, 2026seen 5d

Snowflake-Labs/multiagent_orchestration

PLpgSQL

Open original ↗

Captured source

source ↗

Snowflake-Labs/multiagent_orchestration

Language: PLpgSQL

License: Apache-2.0

Stars: 1

Forks: 0

Open issues: 0

Created: 2026-04-24T20:11:29Z

Pushed: 2026-04-28T22:23:55Z

Default branch: main

Fork: no

Archived: no

README:

Cortex Multi-Agent Orchestration

Route user queries to specialized Cortex Agents via a Master Agent using custom tools (UDFs).

![Multi-Agent Orchestration Architecture](multi-agent-orchestration-snowflake-intelligence.png)

Prerequisites

  • Snowflake account with Cortex enabled
  • ACCOUNTADMIN role
  • Sub-agents already created in Cortex
  • Personal Access Token (PAT)

Setup

1. Generate PAT Token

User MenuMy ProfileAuthenticationGenerate Token

2. Run SQL Setup

Edit multi_agent_setup.sql - replace placeholders, then execute:

| Placeholder | Example | |-------------|---------| | ` | ABC12345 | | | MY_DB | | | AGENTS | | | SALES_AGENT | | | SYSADMIN | | | eyJhbGci...` |

3. Create UDF per Sub-Agent

Duplicate the UDF template, change function name and URL for each agent.

4. Configure Master Agent (UI)

1. AI & MLAgents+ Create Agent

2. About Tab - Add description:

A multi-domain routing agent that delegates user questions to specialized sub-agents based on query intent.

3. Tools Tab - Add custom tool for each sub-agent:

Tool Name: AGENT_1
Function: ASK_AGENT_1(VARCHAR)
Warehouse:
Description: Handles [domain] queries

4. Orchestration Tab - Set routing prompt:

You are an intelligent router. Analyze the user's inquiry:

Agent 1: Use for [domain 1] questions.
Agent 2: Use for [domain 2] questions.

Rule: Do not answer yourself. Invoke the appropriate tool.

5. Access Tab - Grant access to roles/users who need to use the Master Agent.

Usage

-- Direct sub-agent call (testing)
SELECT ASK_AGENT_1('Your question here');

-- Or query Master Agent via UI

Notes

  • Only Master Agent reasoning is visible; sub-agent internals are hidden
  • Latency depends on sub-agent query complexity
  • PAT tokens expire - regenerate as needed

Troubleshooting

| Error | Cause | Solution | |-------|-------|----------| | Could not read secret | Missing grants | GRANT READ ON SECRET ... TO ROLE | | API Error 401 | Invalid/expired token | Regenerate PAT, update secret | | API Error 403 | Insufficient permissions | Check role has USAGE on agent | | Connection error | Network rule issue | Verify network rule includes account URL | | Agent returned no text | Agent config issue | Check sub-agent in UI | | Tool not invoked | Orchestration prompt unclear | Refine routing instructions |

Resources

License

Copyright (c) Snowflake Inc. All rights reserved.

Licensed under the Apache 2.0 license.

Notability

notability 3.0/10

Low stars, new repo