Skip to content

feat(apify): Actor run improvements - #5

Merged
matyascimbulka merged 5 commits into
masterfrom
feat/actor-run-improvments
Aug 1, 2025
Merged

feat(apify): Actor run improvements#5
matyascimbulka merged 5 commits into
masterfrom
feat/actor-run-improvments

Conversation

@matyascimbulka

Copy link
Copy Markdown
Collaborator

WHY

Improves the run Actor action to align it with other integrations. The new props for the action look like this:
Screenshot 2025-07-23 at 13 56 28

Links to #1, #3 and #9

Changes

  • Add search source for Actors: Store and Recently run Actors
  • Change how Actors (and tasks) are displayed. The current format is: title (username/name) (like Zapier)
  • Remove wait for finish input for synchronous runs. If the run takes too long it just kills the action.

@matyascimbulka matyascimbulka self-assigned this Jul 23, 2025
@matyascimbulka matyascimbulka added the enhancement New feature or request label Jul 23, 2025

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Apify Actor run action to improve user experience and align with other integrations. The changes add a new search source selection for Actors, update the display format to show more descriptive labels, and simplify synchronous runs by removing the wait timeout option.

  • Add Actor search source selection (Store vs Recently used Actors)
  • Update Actor and Task display format to include title and username/name format
  • Remove wait for finish input for synchronous runs and use build parameter instead

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
components/apify/sources/new-finished-actor-run-instant/new-finished-actor-run-instant.mjs Updates prop definition reference from userActorId to actorId
components/apify/apify.app.mjs Consolidates Actor selection logic, adds search source functionality, and updates display formatting
components/apify/actions/run-actor/run-actor.mjs Adds Actor source selection, removes wait timeout, and updates parameter handling
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread components/apify/apify.app.mjs Outdated
value,
] of Object.entries(data)) {
const editor = properties[key].editor;
const editor = properties[key]?.editor;

Copilot AI Jul 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding optional chaining here suggests that properties[key] might be undefined, but this could cause silent failures. The code should handle the case where the property doesn't exist more explicitly to avoid unexpected behavior in the setValue function.

Suggested change
const editor = properties[key]?.editor;
let editor;
if (properties[key]) {
editor = properties[key].editor;
} else {
console.warn(`Property "${key}" is not defined in the schema.`);
editor = undefined; // Or assign a default value if appropriate
}

Copilot uses AI. Check for mistakes.
Comment thread components/apify/actions/run-actor/run-actor.mjs Outdated
@drobnikj
drobnikj requested a review from protoss70 July 29, 2025 08:10

@drobnikj drobnikj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few notes

name: "Run Actor",
description: "Performs an execution of a selected Actor in Apify. [See the documentation](https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor)",
version: "0.0.4",
description: "Performs an execution of a selected actor in Apify. [See the documentation](https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor)",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you changed Actor->actor, it was correct before. It should be Actor.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ... I'm not sure. I'll change it back

type: "boolean",
label: "Run Asynchronously",
description: "Set to `true` to run the Actor asynchronously",
description: "Set to `true` to run the actor asynchronously",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actor

const summary = this.runAsynchronously
? `Successfully started Actor run with ID: ${response.data.id}`
: `Successfully ran Actor with ID: ${this.actorId}`;
? `Successfully started actor run with ID: ${response.data.id}`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actor

description: "Where to search for Actors. Valid options are Store and Recently used Actors.",
options: [
{
label: "Store",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label: "Store",
label: "Apify Store Actors",

Comment thread components/apify/apify.app.mjs Outdated
id: value, title, username, name,
}) => ({
label,
label: `${title} (${username}/${name})`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title is optional, so there can be a case that the title is missing in that case, let's show just the tech name ${username}/${name}

Comment thread components/apify/apify.app.mjs Outdated
id: value, title, username, name,
}) => ({
label,
label: `${title} (${username}/${name})`,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move to formating label into function to DRY

@matyascimbulka
matyascimbulka requested a review from drobnikj July 29, 2025 13:00

@drobnikj drobnikj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matyascimbulka
matyascimbulka merged commit b2de09c into master Aug 1, 2025
3 of 7 checks passed
@matyascimbulka
matyascimbulka deleted the feat/actor-run-improvments branch August 1, 2025 06:01
drobnikj pushed a commit that referenced this pull request Sep 3, 2026
…1826)

* feat(dappier): AI-optimized Dappier action set for MCP (real-time search, recommendations, analytics)

Initial AI-optimized Dappier components for the MCP tool surface, covering
issue PipedreamHQ#21660 (real-time web search, AI content recommendations, data-model
querying) plus the four Analytics API endpoints. Iterated against the MCP
eval suite (evals/dappier) — 9/10 green on Sonnet 5 (trials: 1); the one
failure is an upstream HTTP 500 on POST /app/v2/search, not a component
defect. agent-audit: 100/100.

- search-real-time-data (new, 0.0.1): real-time web/data search via a Dappier
  AI model (am_ id); returns a synthesized answer. Eval #9 passes.
- get-ai-recommendations (new, 0.0.1): AI-ranked content recommendations for a
  data model (dm_ id); optional additive `fields` projection trims large
  article payloads. Eval #10 blocked by an upstream 500 (server-side).
- get-ask-ai-analytics (new, 0.0.1): aggregate Ask AI widget analytics. Evals #1/#4/#5 pass.
- get-ask-ai-logs (new, 0.0.1): raw Ask AI conversation logs with page/limit
  pagination + paging guidance. Evals #2/#6 pass.
- get-sponsored-conversations-analytics (new, 0.0.1): sponsored-conversation
  (ad campaign) analytics. Eval #7 passes.
- get-session-intelligence (new, 0.0.1): session intent/topic breakdowns. Evals #3/#8 pass.
- dappier.app.mjs: shared analytics prop definitions + GET request methods.
- common/utils.mjs: validateDateRange (365-day cap) + pluckFields projection helper.
- common/constants.mjs: analytics interaction types, range + page-size bounds.

App package.json bumped 0.0.1 -> 0.1.0 (minor -- new actions).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(dappier): add trailing newline to package.json (eol-last)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(dappier): address review — numArticlesRef max, own-prop projection, date default wording

- get-ai-recommendations: numArticlesRef description said max 1000 but schema is max 100; corrected the doc.
- common/utils.mjs: pluckFields now uses Object.hasOwn so a requested field name that collides with an inherited prop (e.g. toString) is not copied; own result fields still are.
- dappier.app.mjs: reworded startDate default from the brittle/off-by-one '7 days before today' to 'the last 7 days (UTC), i.e. today and the six prior days', matching observed API behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(dappier): resolve one-sided analytics date windows before sending

Verified against the live API: omitting either start_date or end_date makes
Dappier reset BOTH bounds to its default trailing-7-day window, silently
discarding the bound the caller supplied — so a one-sided range returned the
wrong period. resolveDateRange() now fills the missing bound (missing end ->
today UTC; missing start -> 6 days before the end) and always sends both, so a
supplied bound is honored; both-omitted still defers to the API default. All
four analytics actions use it; start/end prop docs updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(dappier): match analytics date-range cap to the API (inclusive days)

Probed the live API: it accepts a 364-day start/end difference (365 inclusive
days) and returns 400 at a 365-day difference (366 inclusive days).
validateDateRange used '> 365 days difference', so a 365-day-difference window
slipped past the fail-fast and hit a raw API 400. Now counts inclusive days
(difference + 1) and caps at 365, matching the API exactly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(dappier): note session_intelligence wrapper in get-session-intelligence description

The API nests all six breakdowns under a single top-level `session_intelligence`
object (verified live). The description listed them as if they were root keys,
so an agent would look for them at the root and miss the `session_intelligence.`
prefix. Description-only; no behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(dappier): use camelCase widgetId in session-intelligence example

The example told the agent to pass `widget_id`, but the input prop is
`widgetId` (run() maps it to the `widget_id` query param). Match the example
to the prop the agent actually sets. Description-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(dappier): use camelCase prop names in remaining action examples

Same fix as get-session-intelligence, applied to the sibling descriptions:
the agent-facing 'Example:' hints used API param names (start_date, end_date,
campaign_id, data_model_id) instead of the camelCase input props (startDate,
endDate, campaignId, dataModelId). API-mapping mentions stay snake_case.
Description-only; no behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs(dappier): camelCase input-guidance for model-id props

The 'Provide a ...' input guidance used API param names — get-ai-recommendations
said 'Provide a data_model_id' (prop is dataModelId) and search-real-time-data
said 'Provide an ai_model_id' (prop is aiModelId). Use the camelCase input keys;
snake_case is retained only where describing the API request mapping
(query param / path template). Description-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Adding missing dependencies field

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: GTFalcao <gtfalcao96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants