diff --git a/integrations/graphql-api/mutations/agent/trigger-agent.mdx b/integrations/graphql-api/mutations/agent/trigger-agent.mdx new file mode 100644 index 0000000..e840ae0 --- /dev/null +++ b/integrations/graphql-api/mutations/agent/trigger-agent.mdx @@ -0,0 +1,68 @@ +--- +title: "Trigger Agent" +--- + +The `triggerSchedule` mutation allows you to manually trigger an existing agent to run immediately. + +Refer [agent docs](/advanced-features/agents/agents) to learn more about agents. + +## Trigger Agent + +### Signature + +```graphql +triggerSchedule(id: String!): Boolean! +``` + + + This mutation can only be executed if you have view access for the agent. + + +## Arguments + + + The unique identifier of the agent schedule to trigger. You can find it in URL of agent edit page. + + +## Response + +Returns a `Boolean` indicating whether the trigger was successful. + +## Usage Example + +Trigger an existing agent schedule: + +```graphql +mutation TriggerAgent($scheduleId: String!) { + success: triggerSchedule(id: $scheduleId) +} +``` + + + +```bash Request +curl -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer your_api_key" \ + -d '{ + "query": "mutation TriggerAgent($scheduleId: String!) { success: triggerSchedule(id: $scheduleId) }", + "variables": { + "scheduleId": "schedule_987654321" + } + }' \ + https://{ACCOUNT}.askwisdom.ai/graphql +``` + + + + + +```json Response +{ + "data": { + "triggerSchedule": true + } +} +``` + + \ No newline at end of file