Skip to content

feat(subagent): add optional skill allowlist filter#1873

Merged
chickenlj merged 4 commits into
agentscope-ai:mainfrom
itxaiohanglover:feat/subagent-skill-filter
Jun 26, 2026
Merged

feat(subagent): add optional skill allowlist filter#1873
chickenlj merged 4 commits into
agentscope-ai:mainfrom
itxaiohanglover:feat/subagent-skill-filter

Conversation

@itxaiohanglover

Copy link
Copy Markdown
Contributor

Fixes #1845

Why

Subagents inherit all skills — there is no way to restrict which skills are available to a specific subagent. This is important for security and context management in multi-agent workflows.

What users will see

No new UI. When a subagent spec includes a skills allowlist, only those skills are available to the subagent.

Surface area

  • UI
  • CLI / env var
  • API / contract
  • Default behavior change — skills allowlist filters available skills
  • None

What changed

Added an optional skills allowlist to SubagentDeclaration, following the exact same pattern as the existing tools allowlist:

  1. SubagentDeclaration.java — added skills field, getter, and builder method
  2. AgentSpecLoader.java — parse skills: from agent spec YAML (same format as tools:)

When the skills list is non-empty, only skills whose names appear in the list are available. When empty or absent, all skills are inherited (backward compatible).

Example usage

name: research-agent
description: Research agent with limited skills
tools: [read_file, grep_files]
skills: [search_code, review_changes]

Validation

  • Follows the identical pattern as the existing tools filter (same field type, same builder method, same parsing logic)
  • Default is empty list = inherit all skills (no behavior change)
  • parseToolNames is reused for parsing — no new code, just a new field name

Note: This is a resubmission of #1858 which was accidentally closed during a fork sync. The branch and changes are identical.

@itxaiohanglover itxaiohanglover requested a review from a team June 22, 2026 17:01
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...cope/harness/agent/HarnessAgentBuilderSupport.java 37.50% 2 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

@AgentScopeJavaBot AgentScopeJavaBot added enhancement New feature or request area/harness agentscope-harness (test/runtime support) labels Jun 23, 2026

@AgentScopeJavaBot AgentScopeJavaBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Review

(inline comments could not be attached — line numbers fell outside PR hunks. See archived report.)

@itxaiohanglover

Copy link
Copy Markdown
Contributor Author

CI is fully green (ubuntu + windows + codecov all pass). This PR follows the exact same pattern as the existing tools allowlist — same field type, same builder method, same parsing logic. Would appreciate a review when you have time.

@chickenlj chickenlj merged commit fb0fd36 into agentscope-ai:main Jun 26, 2026
6 checks passed
zhaojinyu pushed a commit to zhaojinyu/agentscope-java that referenced this pull request Jun 26, 2026
Fixes agentscope-ai#1845

## Why

Subagents inherit all skills — there is no way to restrict which skills
are available to a specific subagent. This is important for security and
context management in multi-agent workflows.

## What users will see

No new UI. When a subagent spec includes a `skills` allowlist, only
those skills are available to the subagent.

## Surface area
- [ ] UI
- [ ] CLI / env var
- [ ] API / contract
- [x] Default behavior change — skills allowlist filters available
skills
- [ ] None

## What changed

Added an optional `skills` allowlist to `SubagentDeclaration`, following
the exact same pattern as the existing `tools` allowlist:

1. `SubagentDeclaration.java` — added `skills` field, getter, and
builder method
2. `AgentSpecLoader.java` — parse `skills:` from agent spec YAML (same
format as `tools:`)

When the `skills` list is non-empty, only skills whose names appear in
the list are available. When empty or absent, all skills are inherited
(backward compatible).

### Example usage

```yaml
name: research-agent
description: Research agent with limited skills
tools: [read_file, grep_files]
skills: [search_code, review_changes]
```

## Validation

- Follows the identical pattern as the existing `tools` filter (same
field type, same builder method, same parsing logic)
- Default is empty list = inherit all skills (no behavior change)
- `parseToolNames` is reused for parsing — no new code, just a new field
name

Note: This is a resubmission of agentscope-ai#1858 which was accidentally closed
during a fork sync. The branch and changes are identical.

---------

Co-authored-by: Chickenlj <ken.lj.hz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/harness agentscope-harness (test/runtime support) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

子智能体无法支持skill过滤

3 participants