***

title: Testing & Error Handling
position: 6
excerpt: How to test your plugins, debug failures, and handle errors in production.
deprecated: false
hidden: false
---------------------

For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.moveworks.com/agent-studio/guides/best-practices/llms.txt. For full documentation content, see https://docs.moveworks.com/agent-studio/guides/best-practices/llms-full.txt.

Building a plugin is only half the work. Before you publish, you need to verify it works — and plan for what happens when it doesn't.

# Testing Your Plugins

How you test depends on what you built.

## Testing Compound Actions

Compound actions have a **Test** button in the Agent Studio editor. Click it to:

1. Enter sample input arguments
2. Execute the compound action
3. View step-by-step logs showing what happened at each expression

This is the fastest way to validate your logic before wiring the compound action into a plugin.

<Callout intent="info">
  This is also how you test **scheduled trigger** plugins — since you can't manually fire a schedule, test the compound action directly using the Test button.
</Callout>

## Testing Script Actions

Script actions also have a **Test** button in the editor. Enter your input variables and run the script to verify the output before using it in a compound action.

## Testing Conversational Plugins

Conversational plugins must be tested **through the AI assistant** — not through Agent Studio. After publishing your plugin:

1. Open a chat with your AI assistant
2. Type one of your triggering utterances (e.g., "Check my PTO balance")
3. Walk through the conversation flow — fill slots, confirm actions, verify responses

<Callout intent="warning">
  Plugins take approximately 10 seconds to deploy after publishing. If your plugin doesn't trigger immediately, wait a moment and retry.
</Callout>

## Testing Ambient Agents (Webhook-Triggered)

For webhook-triggered plugins:

1. First, test your compound action using the **Test** button (see above)
2. Then send a test webhook to your listener URL using cURL or a tool like Postman
3. Check the plugin logs for execution results

```bash
curl -X POST "https://api.moveworks.ai/webhooks/v1/listeners/<LISTENER_ID>/notify" \
  -H "Content-Type: application/json" \
  -d '{"your": "test payload"}'
```

For details on webhook security and listener configuration, see [System Triggers](/agent-studio/system-triggers).

# Error Handling

## HTTP Action Errors

When an HTTP action returns a non-2xx status code, the action fails. Common scenarios:

| Status Code | Meaning                  | What to Do                                                              |
| ----------- | ------------------------ | ----------------------------------------------------------------------- |
| 400         | Bad Request              | Check your input mapping — a required field may be missing or malformed |
| 401 / 403   | Unauthorized / Forbidden | Verify your connector credentials and permissions                       |
| 404         | Not Found                | Check your endpoint URL and path parameters                             |
| 429         | Rate Limited             | Reduce request frequency or contact the API provider about rate limits  |
| 500         | Server Error             | The external system failed — use `try_catch` to handle gracefully       |

<Callout intent="info">
  HTTP actions have a **60 second timeout**. If your API is consistently slow, work with the API provider to optimize response times, or consider breaking the request into smaller calls.
</Callout>

## Error Handling in Compound Actions

Use [`try_catch`](/agent-studio/actions/compound-actions/try-catch-and-raise-error) to handle failures gracefully:

```yaml
- try_catch:
    try:
      steps:
        - action:
            action_name: update_record
            output_key: update_result
            input_args:
              record_id: data.record_id
    catch:
      on_status_code: [404, 500]
      steps:
        - raise:
            output_key: error_result
            message: >-
              Failed to update record {{record_id}}.
              Please try again or contact support.
```

You can filter by specific status codes using `on_status_code`, or catch all errors by omitting it.

Use [`raise`](/agent-studio/actions/compound-actions/try-catch-and-raise-error) to explicitly throw an error and exit the compound action when a precondition isn't met.

## Conversation Timeouts

Be aware of the execution time limits:

| Scope                     | Timeout                         |
| ------------------------- | ------------------------------- |
| Single action step        | 30 seconds (recommended target) |
| Determined execution plan | 45 seconds                      |
| Entire request lifecycle  | 160 seconds                     |

If an action might exceed 30 seconds, consider running it asynchronously — uncheck **Wait for Completion** on the action activity, or use `delay_config` in compound actions.

# Debugging with Logs

After executing a plugin, check the [Logs](/agent-studio/development-and-testing/logs) section in Agent Studio for detailed execution traces. Key log types:

* **Action logs**: Input/output for each action step
* **Compound action logs**: Step-by-step execution with status codes
* **Webhook logs**: Listener trigger events and payload data

For webhook-specific debugging, see [Webhook Logs Troubleshooting Guide](/agent-studio/system-triggers/webhook-logs-troubleshooting-guide).

# Checklist Before Publishing

Before making your plugin available to users:

* [ ] Tested the core action (HTTP or compound) with realistic input data
* [ ] Verified error handling — what happens if the API returns 400? 500?
* [ ] Checked response sizes — will the output trigger [SDA](/agent-studio/core-concepts/structured-data-analysis) (over 7K tokens)?
* [ ] Confirmed slot validation catches invalid input
* [ ] Tested with the AI assistant using natural language (for conversational plugins)
* [ ] Verified launch configuration restricts access appropriately
* [ ] Reviewed the [Golden Rule](/agent-studio/guides/best-practices/the-golden-rule) — no two action activities back-to-back without a slot in between