Edits history of script submission #9139 for ' Folder create agent (taskade)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Taskade = {
    	token: string
    }
    
    export async function main(
    	auth: Taskade,
    	folderId: string,
    	body: {
    		name: string
    		data:
    			| {
    					type: 'data'
    					data: {
    						commands: {
    							name: string
    							prompt: string
    							id: string
    							isBackgroundJob?: false | true
    							searchToolEnabled?: false | true
    							mode?: 'default' | 'plan-and-execute-v1' | 'plan-and-execute-v2'
    						}[]
    						description?: string
    						persona?:
    							| 'standup-comedian'
    							| 'life-coach'
    							| 'career-counselor'
    							| 'nutritionist'
    							| 'product-manager'
    							| 'personal-trainer'
    							| 'life-hacker'
    							| 'travel-advisor'
    							| 'mindfulness-coach'
    							| 'financial-advisor'
    							| 'language-tutor'
    							| 'travel-guide'
    							| 'marketing-expert'
    							| 'software-developer'
    							| 'diy-expert'
    							| 'journalist'
    							| 'tech-writer'
    							| 'professional-chef'
    							| 'professional-salesperson'
    							| 'startup-tech-lawyer'
    							| 'startup-idea-generator'
    							| 'graphic-designer'
    							| 'academic-researcher'
    							| 'customer-support-agent'
    							| 'hr-consultant'
    							| 'entrepreneur'
    							| 'ecommerce-strategist'
    							| 'seo-expert'
    							| 'programming-genius'
    							| 'content-creator'
    							| 'socialmedia-influencer'
    							| 'investor'
    							| 'pr-specialist'
    							| 'business-mentor'
    							| 'negotiator'
    						tone?:
    							| 'authoritative'
    							| 'clinical'
    							| 'cold'
    							| 'confident'
    							| 'cynical'
    							| 'emotional'
    							| 'empathetic'
    							| 'formal'
    							| 'friendly'
    							| 'humourous'
    							| 'informal'
    							| 'ironic'
    							| 'optimistic'
    							| 'pessimistic'
    							| 'playful'
    							| 'sarcastic'
    							| 'serious'
    							| 'sympathetic'
    							| 'tentative'
    							| 'warm'
    							| 'creative'
    							| 'inspiring'
    							| 'casual'
    						avatar?: { type: 'emoji'; data: { value: string } }
    						knowledgeEnabled?: false | true
    					}
    			  }
    			| {
    					type: 'template'
    					template: {
    						type:
    							| 'Tasker'
    							| 'Researcher'
    							| 'Marketer'
    							| 'EmailWriter'
    							| 'Sales'
    							| 'CustomerSupport'
    							| 'ProjectManager'
    							| 'ContentCreator'
    							| 'Copywriter'
    							| 'LegalAdvisor'
    							| 'SeoSpecialist'
    							| 'ProductivityCoach'
    							| 'EngineeringExpert'
    							| 'Translator'
    							| 'Summarizer'
    							| 'ResumeBuilder'
    							| 'Storyteller'
    							| 'Tutor'
    							| 'BrandStrategist'
    							| 'SocialMediaSpecialist'
    							| 'BusinessStrategist'
    							| 'FinancialAnalyst'
    							| 'HumanResourcesManager'
    							| 'DataScientist'
    							| 'ITConsultant'
    							| 'FinancialAdvisor'
    							| 'HealthCoach'
    							| 'SustainabilityConsultant'
    							| 'UXDesigner'
    							| 'QualityAssuranceAnalyst'
    							| 'ProductManager'
    							| 'GrowthHacker'
    							| 'BusinessDevelopmentManager'
    							| 'PublicRelationsSpecialist'
    							| 'EventPlanner'
    							| 'DataAnalyst'
    							| 'Editor'
    							| 'CEO'
    							| 'InterviewCoach'
    							| 'TechSupportAdvisor'
    							| 'Doctor'
    							| 'BlogExpert'
    							| 'TweetOptimizer'
    							| 'EmailMarketer'
    							| 'CourseCreator'
    							| 'ScriptCreator'
    							| 'ScreenplayWriter'
    							| 'Proofreader'
    							| 'SalesColdEmailCoach'
    							| 'CodeExplainer'
    							| 'CreativeWritingCoach'
    							| 'AdvertisingCopywriter'
    							| 'VideoScriptWriter'
    							| 'ProjectArchitect'
    							| 'AICouncil'
    							| 'Negotiator'
    							| 'VCAssociate'
    							| 'Books'
    							| 'StartupMentor'
    							| 'SmallBusiness'
    							| 'WebDevelopment'
    							| 'PromptEngineer'
    							| 'ArticleWriter'
    							| 'WorkflowAgent'
    							| 'StrategyAgent'
    							| 'ViralAgent'
    							| 'SOPOnboardingAgent'
    							| 'PressReleaseAgent'
    						avatar?: { type: 'emoji'; data: { value: string } }
    					}
    			  }
    	}
    ) {
    	const url = new URL(`https://www.taskade.com/api/v1/folders/${folderId}/agents`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Bearer ' + auth.token
    		},
    		body: JSON.stringify(body)
    	})
    
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    
    	return await response.json()
    }
    

    Submitted by hugo697 581 days ago