-
Notifications
You must be signed in to change notification settings - Fork 110
[Sherpa] Add pre-packaged skills with persistence and subagent config for SMAI spaces #1143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fda6bed
Add pre-packaged skills with persistence and subagent config for SMAI…
aws-srijach ac0625c
Address PR review comments: manifest-driven skills, sync_agent.sh, pa…
aws-srijach 17b0a07
Add MCP server config and align agent config with SherpaIdePrototypes
aws-srijach b55c719
Remove mcp.json
aws-srijach 5f6b4cb
Fix build order: move skills clone after COPY dirs/ + rsync, extract …
aws-srijach db890cf
Skip skills/agent sync for shared spaces
aws-srijach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
template/v4/dirs/etc/sagemaker/sagemaker-default-agent.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "name": "sagemaker_default", | ||
| "description": "SageMaker AI assistant with pre-installed skills for model customization, evaluation, deployment, and HyperPod operations.", | ||
| "tools": ["@builtin"], | ||
| "allowedTools": [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs update based on what we have in jupyter MCP
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (ingore this already fixed) |
||
| "mcp::jupyter-mcp::read_notebook", | ||
| "mcp::jupyter-mcp::read", | ||
| "mcp::jupyter-mcp::ls" | ||
| ], | ||
| "mcpServers": {}, | ||
| "resources": [] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [ | ||
| { | ||
| "repo": "https://github.com/awslabs/agent-plugins.git", | ||
| "path": "plugins/sagemaker-ai/skills" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| #!/bin/bash | ||
| # Syncs pre-packaged SageMaker skills from image to user's EBS. | ||
| set -eu | ||
|
|
||
| IMAGE_SKILLS_DIR="/etc/sagemaker/skills" | ||
| EBS_SKILLS_DIR="$HOME/.agent/skills" | ||
| LOCK_FILE="$EBS_SKILLS_DIR/.sagemaker-lock" | ||
|
|
||
| # Agent targets to symlink skills into (add new agents here) | ||
| AGENT_SKILLS_DIRS=("$HOME/.kiro/skills") | ||
|
|
||
| compute_checksum() { | ||
| (cd "$1" && find . -type f -print0 | sort -z | xargs -0 sha256sum | sha256sum | awk '{print $1}') | ||
| } | ||
|
|
||
| get_locked_checksum() { | ||
| [ -f "$LOCK_FILE" ] && jq -r --arg s "$1" '.skills[$s].checksum // empty' "$LOCK_FILE" 2>/dev/null | ||
| } | ||
|
|
||
| set_locked_checksum() { | ||
| [ -f "$LOCK_FILE" ] || echo '{"skills":{}}' > "$LOCK_FILE" | ||
| jq --arg s "$1" --arg c "$2" '.skills[$s].checksum = $c' "$LOCK_FILE" > "$LOCK_FILE.tmp" | ||
| mv "$LOCK_FILE.tmp" "$LOCK_FILE" | ||
| } | ||
|
|
||
| mkdir -p "$EBS_SKILLS_DIR" | ||
| for dir in "${AGENT_SKILLS_DIRS[@]}"; do mkdir -p "$dir"; done | ||
|
|
||
| if [ ! -d "$IMAGE_SKILLS_DIR" ]; then | ||
| echo "No bundled skills found at $IMAGE_SKILLS_DIR, skipping." | ||
| exit 0 | ||
| fi | ||
|
|
||
| for skill_path in "$IMAGE_SKILLS_DIR"/*/; do | ||
| [ -d "$skill_path" ] || continue | ||
| skill_name=$(basename "$skill_path") | ||
| ebs_skill="$EBS_SKILLS_DIR/$skill_name" | ||
| image_checksum=$(compute_checksum "$skill_path") | ||
|
|
||
| if [ ! -d "$ebs_skill" ]; then | ||
| cp -r "$skill_path" "$ebs_skill" | ||
| set_locked_checksum "$skill_name" "$image_checksum" | ||
| echo "Installed skill '$skill_name'" | ||
| else | ||
| recorded_checksum=$(get_locked_checksum "$skill_name") | ||
| current_checksum=$(compute_checksum "$ebs_skill") | ||
|
|
||
| if [ "$current_checksum" = "$recorded_checksum" ]; then | ||
| if [ "$image_checksum" != "$recorded_checksum" ]; then | ||
| rm -rf "$ebs_skill" | ||
| cp -r "$skill_path" "$ebs_skill" | ||
| set_locked_checksum "$skill_name" "$image_checksum" | ||
| echo "Updated skill '$skill_name'" | ||
| else | ||
| echo "Skill '$skill_name' already current, skipping" | ||
| fi | ||
| else | ||
| echo "Skipping skill '$skill_name' — user modified" | ||
| fi | ||
| fi | ||
|
|
||
| # Create symlinks for all agent targets | ||
| for agent_dir in "${AGENT_SKILLS_DIRS[@]}"; do | ||
| link="$agent_dir/$skill_name" | ||
| if [ ! -e "$link" ]; then | ||
| ln -s "$ebs_skill" "$link" | ||
| echo "Created symlink $link -> $ebs_skill" | ||
| fi | ||
| done | ||
| done | ||
|
|
||
| echo "Skills sync complete." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
| # Syncs agent config (subagent, default agent settings) for SMAI spaces. | ||
| set -eu | ||
|
|
||
| AGENT_CONFIG_SRC="/etc/sagemaker/sagemaker-default-agent.json" | ||
| AGENT_CONFIG_DST="$HOME/.kiro/agents/sagemaker-default-agent.json" | ||
| KIRO_CLI_SETTINGS="$HOME/.kiro/settings/cli.json" | ||
|
|
||
| # Install subagent config (always overwrite) | ||
| mkdir -p "$HOME/.kiro/agents" | ||
| cp "$AGENT_CONFIG_SRC" "$AGENT_CONFIG_DST" | ||
| echo "Installed agent config to $AGENT_CONFIG_DST" | ||
|
|
||
| # Set default agent only if user hasn't configured one | ||
| mkdir -p "$HOME/.kiro/settings" | ||
| if [ ! -f "$KIRO_CLI_SETTINGS" ]; then | ||
| echo '{"chat.defaultAgent":"sagemaker_default"}' > "$KIRO_CLI_SETTINGS" | ||
| echo "Created default agent settings" | ||
| elif ! jq -e '."chat.defaultAgent"' "$KIRO_CLI_SETTINGS" >/dev/null 2>&1; then | ||
| jq '. + {"chat.defaultAgent":"sagemaker_default"}' "$KIRO_CLI_SETTINGS" > "$KIRO_CLI_SETTINGS.tmp" | ||
| mv "$KIRO_CLI_SETTINGS.tmp" "$KIRO_CLI_SETTINGS" | ||
| echo "Added default agent to existing settings" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tools, this is what tools are available