From 778b8fa87874667d8b21848bb7ad98f20f3de7b0 Mon Sep 17 00:00:00 2001 From: Matt Senick <32623708+Matts52@users.noreply.github.com> Date: Tue, 16 Jun 2026 21:54:38 -0700 Subject: [PATCH] feat: document and test full Cortex Search tool_resource props (closes #3) Add filter, max_results, title_column, and id_column to the README specification-mode example for Cortex Search tool_resources. Add a compile-only integration test model (agent_with_search) that exercises all five props via source(), backed by a sources.yml placeholder. The Snowflake live-build script excludes this model since no real search service exists in the test environment; the DuckDB compile test covers it. Co-Authored-By: Claude Sonnet 4.6 --- README.md | 3 ++ .../models/agent_with_search.sql | 30 +++++++++++++++++++ integration_tests/models/schema.yml | 3 ++ integration_tests/models/sources.yml | 9 ++++++ scripts/run_integration_tests_snowflake.sh | 2 +- 5 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 integration_tests/models/agent_with_search.sql create mode 100644 integration_tests/models/sources.yml diff --git a/README.md b/README.md index 5db73ef..462e958 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,9 @@ tool_resources: Search1: name: "{{ source('cortex', 'policy_search_service') }}" max_results: 5 + filter: + "@eq": + region: "North America" title_column: "title" id_column: "doc_id" ``` diff --git a/integration_tests/models/agent_with_search.sql b/integration_tests/models/agent_with_search.sql new file mode 100644 index 0000000..5d59867 --- /dev/null +++ b/integration_tests/models/agent_with_search.sql @@ -0,0 +1,30 @@ +{{ + config( + materialized = 'cortex_agent', + comment = 'Agent with a Cortex Search tool (compile-only: no live search service in test env)', + profile = {'display_name': 'Search Agent', 'color': 'teal'} + ) +}} +models: + orchestration: claude-4-sonnet +orchestration: + budget: + seconds: 30 + tokens: 16000 +instructions: + response: "Be concise." + orchestration: "Use PolicySearch for policy questions." +tools: + - tool_spec: + type: "cortex_search" + name: "PolicySearch" + description: "Searches policy documents." +tool_resources: + PolicySearch: + name: "{{ source('cortex_test', 'policy_search_service') }}" + max_results: 5 + filter: + "@eq": + region: "North America" + title_column: "title" + id_column: "doc_id" diff --git a/integration_tests/models/schema.yml b/integration_tests/models/schema.yml index 575272b..dbdd151 100644 --- a/integration_tests/models/schema.yml +++ b/integration_tests/models/schema.yml @@ -23,3 +23,6 @@ models: - name: agent_raw_ddl description: "Cortex Agent created via raw_ddl pass-through mode." + + - name: agent_with_search + description: "Cortex Agent with a Cortex Search tool; verifies full tool_resources syntax including filter, max_results, title_column, id_column." diff --git a/integration_tests/models/sources.yml b/integration_tests/models/sources.yml new file mode 100644 index 0000000..0cd2596 --- /dev/null +++ b/integration_tests/models/sources.yml @@ -0,0 +1,9 @@ +version: 2 + +sources: + - name: cortex_test + database: "{{ env_var('SNOWFLAKE_TEST_DATABASE', 'DEV') }}" + schema: "{{ env_var('SNOWFLAKE_TEST_SCHEMA', 'PUBLIC') }}" + tables: + - name: policy_search_service + description: "Placeholder source for compile-time resolution of Cortex Search service." diff --git a/scripts/run_integration_tests_snowflake.sh b/scripts/run_integration_tests_snowflake.sh index 2d08cfe..9e527a9 100755 --- a/scripts/run_integration_tests_snowflake.sh +++ b/scripts/run_integration_tests_snowflake.sh @@ -34,7 +34,7 @@ echo "==> Installing dbt dependencies" dbt deps --target snowflake echo "==> Running dbt build" -dbt build --target snowflake +dbt build --target snowflake --exclude agent_with_search echo "==> Asserting agents exist" dbt run-operation assert_agents_exist --target snowflake