My Actors worked fine until an AI agent called them
Описание и применение
Автоматизированный агент Claude вызвал проблемы в 14 Apify‑Actors из‑за некорректных схем ввода и обработки ошибок. Переработка схем ввода, добавление статусов и явных ошибок, а также корректный доступ к датасетам сделали Actors надёжными для AI‑вызываний.
Задача
An AI agent calling Apify Actors via MCP misinterpreted input schemas and output handling, causing empty results, permission errors, and incorrect data interpretation.
Результат
By refining input schemas, adding explicit status fields, and handling dataset access properly, the Actors became robust against AI agent calls, preventing silent failures and misinterpretations.
Рабочий процесс
- 1. Expose Actors as MCP tools and connect to Claude.
- 2. Agent sends a natural language task to find a product across stores.
- 3. Actor receives input, runs scraper, and returns results.
- 4. Agent interprets output; if empty array, assumes no data.
- 5. Issues arise: empty arrays for both missing data and errors, permission errors when accessing datasets, and ambiguous input fields.
- 6. Redesign input schema: remove site‑specific IDs, use enums, and document fields clearly.
- 7. Modify output to include status, lookupStatus, and lookupDetail fields.
- 8. Update product pipeline to pass dataset path or items directly, avoiding cross‑run dataset access.
- 9. Test with agents to ensure correct branching and error handling.
Доказательства
The agent picked my Actor, filled the input, started the run. Status: succeeded. Zero results, no error.
Empty result. The same thing the Actor returns when a company is genuinely absent from the registry.
An Actor with standard permissions cannot read the default dataset of a different run, and the API answers Insufficient permissions.
- Дата записи: 2026-09-05T19:15:00.149Z