add_agent_redteam_task
Assigns a redteam task using a saved agent by specifying the agent’s version and task configuration, including system description, policy, and tools, for comprehensive testing.
Instructions
Add a redteam task using a saved agent.
Args: agent_saved_name: The saved name of the agent to be used for the redteam task. agent_version: The version of the agent to be used for the redteam task. agent_redteam_model_config: The configuration for the redteam task. ASK USER FOR ALL THESE DETAILS. Example usage: sample_redteam_model_config = { "test_name": redteam_test_name, "dataset_configuration": { #Ask user for all these details, do not fill it on your own (system_description, policy_description. Tools can be gotten from agent config otherwise ask user) "system_description": "Ask user for this", # Ask user for the system description of the agent for the custom use-case. (Mandatory exactly same as what the user has input) "policy_description": "Ask user for this", # Ask user for the policy which the agent for the custom use-case should follow. (Optional) "tools": [ { "name": "ask user for this", # The name of the tool to be used for the custom use-case. (Mandatory) "description": "ask user for this" # The description of the tool to be used for the custom use-case. (Mandatory) } ], #The following are the default values for the custom use-case. Change them only if the user asks for a different test size. "max_prompts": 500, # The maximum number of prompts to be used for the custom use-case. "scenarios": 2, # The number of scenarios to be used for the custom use-case. "categories": 2, # The number of categories to be used for the custom use-case. "depth": 1, # The depth of the custom use-case. } "redteam_test_configurations": { #IMPORTANT: Before setting the redteam test config, ask the user which tests they would want to run and the sample percentage "alignment_and_governance_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "input_and_content_integrity_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "infrastructure_and_integration_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "security_and_privacy_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "human_factors_and_societal_impact_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "access_control_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "physical_and_actuation_safety_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "reliability_and_monitoring_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } } }, }
Returns: A dictionary containing the response message and details of the added redteam task.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_redteam_model_config | Yes | ||
| agent_saved_name | Yes | ||
| agent_version | Yes |
Input Schema (JSON Schema)
Implementation Reference
- src/mcp_server.py:531-673 (handler)Handler function decorated with @mcp.tool(), which defines and registers the 'add_agent_redteam_task' tool. It calls redteam_client.add_custom_task_with_saved_model to add a redteam task for a saved agent.@mcp.tool() def add_agent_redteam_task(agent_saved_name: str, agent_version: str, agent_redteam_model_config: Dict[str, Any]) -> Dict[str, Any]: """ Add a redteam task using a saved agent. Args: agent_saved_name: The saved name of the agent to be used for the redteam task. agent_version: The version of the agent to be used for the redteam task. agent_redteam_model_config: The configuration for the redteam task. ASK USER FOR ALL THESE DETAILS. Example usage: sample_redteam_model_config = { "test_name": redteam_test_name, "dataset_configuration": { #Ask user for all these details, do not fill it on your own (system_description, policy_description. Tools can be gotten from agent config otherwise ask user) "system_description": "Ask user for this", # Ask user for the system description of the agent for the custom use-case. (Mandatory exactly same as what the user has input) "policy_description": "Ask user for this", # Ask user for the policy which the agent for the custom use-case should follow. (Optional) "tools": [ { "name": "ask user for this", # The name of the tool to be used for the custom use-case. (Mandatory) "description": "ask user for this" # The description of the tool to be used for the custom use-case. (Mandatory) } ], #The following are the default values for the custom use-case. Change them only if the user asks for a different test size. "max_prompts": 500, # The maximum number of prompts to be used for the custom use-case. "scenarios": 2, # The number of scenarios to be used for the custom use-case. "categories": 2, # The number of categories to be used for the custom use-case. "depth": 1, # The depth of the custom use-case. } "redteam_test_configurations": { #IMPORTANT: Before setting the redteam test config, ask the user which tests they would want to run and the sample percentage "alignment_and_governance_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "input_and_content_integrity_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "infrastructure_and_integration_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "security_and_privacy_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "human_factors_and_societal_impact_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "access_control_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "physical_and_actuation_safety_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } }, "reliability_and_monitoring_test": { "sample_percentage": 2, "attack_methods": { "basic": [ "basic" ], "advanced": { "static": [ "encoding" ] } } } }, } Returns: A dictionary containing the response message and details of the added redteam task. """ # Use a dictionary to configure a redteam task add_redteam_model_response = redteam_client.add_custom_task_with_saved_model(config=agent_redteam_model_config, model_saved_name=agent_saved_name, model_version=agent_version) # Print as a dictionary return add_redteam_model_response.to_dict()