Trigger types
Event
Fires when an event occurs in a connected service, such as a new Slack mention or a GitHub pull request.
Scheduled
Fires on a recurring schedule: hourly, daily, weekly, or monthly.
API
Fires on demand when an authenticated HTTP request is made to the workspace session endpoint.
Create a trigger
1
Open your workspace
Go to guild.ai and open the workspace where the agent is installed.
2
Go to Triggers
In the left sidebar, open More and click Triggers, then click New trigger.
3
Choose a type
Select Event, Scheduled, or API, then configure the trigger.
4
Select an agent
Choose the agent the trigger will run when it fires.
Event triggers
Event triggers fire when a specific event occurs in a connected service.In the CLI and REST API, event triggers are referred to as
webhook triggers.Supported services
Configure the service, event type, and optional event action when creating the trigger. By default, the agent receives the event payload as its input.
Agent input
Webhook triggers support a customizable agent input, identical to the agent input on time triggers. Open the Edit Trigger dialog to edit it. On desktop, a schema-driven panel appears on the right side of the dialog. On mobile, a text field appears instead. When no input has been saved, the field pre-populates with a default based on the integration name, event type, and action.Custom agent input for webhook triggers
By default, the agent receives the raw webhook payload as its input. You can override this by providing a customagent_input object when creating the trigger. The custom input is merged with (or replaces) the default payload delivered to the agent.
Use custom agent input when you want to:
- Pass a fixed system prompt or configuration alongside the webhook payload
- Map specific webhook fields to a named input schema your agent expects
agent_input can also be set from the web UI when creating or editing a webhook trigger.
Pass the webhook payload unaltered
When you create or edit an event trigger in the web UI, select Pass the webhook payload unaltered to forward the raw webhook JSON payload directly to the agent. Checking this option disables and clears the input editor, so you do not need to define a custom input template to deliver the payload as-is. This option corresponds to an emptyagent_input in the CLI and REST API, which the backend treats as “forward the payload unaltered.”
Toggling Pass the webhook payload unaltered is non-destructive. If you uncheck it, the input editor restores the agent input template you previously entered.
Scope events with service_config
Use service_config to restrict event triggers to specific repositories, channels, or projects. Webhook triggers accept an optional service_config JSON object. When you omit it or set it to null, the trigger matches all events of the selected type (for example, every repository or every channel).
service_config must be a JSON object. Do not pass an array or string at the top level.
Pass service_config when you create or update a trigger with the CLI:
Session affinity with session_affinity_key
By default, Guild uses integration-specific logic to determine which session an incoming webhook event belongs to. Set session_affinity_key to extract the session correlation ID directly from the webhook payload instead.
session_affinity_key is a dot-notation path into the webhook payload. The value at that path becomes the remote_id that matches the event to an existing session. When the extracted value matches a prior event’s remote_id, the agent continues in that session rather than starting a new one. When set, session_affinity_key overrides the integration handler’s default session correlation logic.
For example, "event.thread_ts" extracts the Slack thread timestamp from a payload structured as {"event": {"thread_ts": "1234567890.123"}}.
If the path does not resolve — because the field is absent or an intermediate value is not an object — the trigger falls back to no affinity and starts a new session.
CLI
Scheduled triggers
Scheduled triggers fire on a recurring schedule and run the agent with a fixed input.In the CLI and REST API, scheduled triggers are referred to as
time triggers.Frequencies
CLI
API triggers
An API trigger runs the agent on demand via an authenticated HTTP request. API triggers require an API key to authenticate requests.Generate an API key
API keys are created and managed via the web UI:- Go to Triggers in your workspace and click New trigger.
- Select API and choose the agent this trigger will run.
- Once the trigger is created, copy the combined credentials string (
<api_key_id>:<api_key_secret>) displayed in the dialog. The generated string contains both the api_key_id and api_key_secret.
Creating and managing API keys is currently exclusive to the web UI. There is no CLI subcommand available for managing API keys.
Authentication
Guildcode uses HTTP Basic Authentication to authorize API requests. Pass the combined credentials string as the authentication parameter (for example, withcurl -u):
Trigger a session
To start a new agent session, make aPOST request to the workspace’s sessions endpoint:
Request body
The request body must be a JSON object with:session_type: Must be set to"api_trigger".agent_input: A JSON object matching the input schema of your agent.
Example
Interactive follow-up
If the agent is conversational or awaits subsequent inputs, you can post follow-up events directly to the session:Request body
mode: Set to"text"(default),"json", or"multimodal".content: The message content. For"text"mode, a string; for"json"mode, a JSON object; for"multimodal"mode, a non-empty array of content part objects.
mode is "multimodal", each content part is an object with a type field:
- When
typeis"text", the object must include a non-empty"text"string. - When
typeis"image"or"file", the object must include a valid"attachment_id"that references an uploaded attachment.
Example
Multimodal example
Send a message with both a text part and an image attachment:Retrieve session status
Retrieve the current execution state and metadata of a specific session:Example
Fetch session events (logs and thoughts)
Retrieve the chronological feed of logs, agent thought progress, LLM usage statistics, tool calls, and final outputs:Query parameters (Optional)
limit: Maximum number of events to return (default: 20).types: Filter by specific event types (e.g.,agent_console).
Example
Fetch session sub-tasks
Fetch a list of all sub-tasks spawned by parent agents or tool calls inside this session:Example
Real-time streaming (WebSockets)
If you are developing a real-time interface or monitoring tool, establish a WebSocket connection rather than polling. Pass your Basic Auth credentials in the connection headers.- Live Messages and Logs Feed:
wss://app.guild.ai/api/sessions/<session_id>/events/ws - Real-time LLM Token Streams:
wss://app.guild.ai/api/sessions/<session_id>/response-stream-drafts/ws - Sub-task Progress Feed:
wss://app.guild.ai/api/sessions/<session_id>/tasks/ws
Security and scope
- Workspace Scope: The API key carries workspace-level permissions. This allows it to read and write (including fetching status, event feeds, sub-tasks, and runtime statuses, as well as sending follow-up events/messages) to any session in the same workspace.
- Execution Identity: Sessions started via an API key do not run on behalf of a human user (
acting_user_idisNone). However, when viewing the session’s chat feed in the UI, any events generated by the API will display the avatar of the user who originally created the trigger.