Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions integrations/graphql-api/mutations/agent/trigger-agent.mdx
Original file line number Diff line number Diff line change
@@ -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!
```

<Note>
This mutation can only be executed if you have view access for the agent.
</Note>

## Arguments

<ParamField path="id" type="String!" required>
The unique identifier of the agent schedule to trigger. You can find it in URL of agent edit page.
</ParamField>

## 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)
}
```

<RequestExample>

```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
```

</RequestExample>

<ResponseExample>

```json Response
{
"data": {
"triggerSchedule": true
}
}
```

</ResponseExample>