Skip to content

feat: Add enum constraint to agent_name for transfer_to_agent #2437

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

qieqieplus
Copy link
Contributor

Current implementation of transfer_to_agent doesn't enforce strict constraints on agent names,
We could use JSON Schema's enum definition to implement stricter constraints:

Before

[{
	"type": "function",
	"function": {
		"name": "transfer_to_agent",
		"description": "Transfer the question to another agent.\n\nThis tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description.\n\nArgs:\n  agent_name: the agent name to transfer to.\n",
		"parameters": {
			"type": "object",
			"properties": {
				"agent_name": {
					"type": "string"
				}
			}
		}
	}
}]

After

[{
	"type": "function",
	"function": {
		"name": "transfer_to_agent",
		"description": "Transfer the question to another agent.\n\nThis tool hands off control to another agent when it's more suitable to answer the user's question according to the agent's description.\n\nArgs:\n  agent_name: the agent name to transfer to.\n",
		"parameters": {
			"type": "object",
			"properties": {
				"agent_name": {
					"type": "string",
					"enum": ["agent_a", "agent_b", "agent_c"]
				}
			}
		}
	}
}]

@adk-bot adk-bot added bot triaged [Bot] This issue is triaged by ADK bot core [Component] This issue is related to the core interface and implementation labels Aug 8, 2025
@adk-bot
Copy link
Collaborator

adk-bot commented Aug 8, 2025

Response from ADK Triaging Agent

Hello @qieqieplus, thank you for your contribution!

To help us review this PR, could you please:

  1. Associate a GitHub issue with this PR. If one doesn't exist, please create one.
  2. Add a "Testing Plan" section to the PR description explaining how you've tested these changes.

This information will help reviewers to review your PR more efficiently. Thanks!

@adk-bot adk-bot requested a review from Jacksunwei August 8, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot triaged [Bot] This issue is triaged by ADK bot core [Component] This issue is related to the core interface and implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants