Manta Developers
GitHub
Menu

Actions

How the agent changes things in the outside world, safely.

The agent never changes an ad account, a campaign or any other external system directly. It proposes an action plan, and the plan is executed only when it is approved.

Action plans

An action plan describes a desired state: what the world should look like after the change. Most of it is derived by rules from the current data. When a plan runs, Manta:

  1. compares the desired state with the current one
  2. validates the change
  3. applies it through the platform’s integration: deletions first, then updates and additions, ordered so that entities are changed before the entities that depend on them

Every run is recorded, so you can see what changed, when and why.

Manual actions

When a change cannot be applied automatically, it becomes a manual action: a task for a person, with what to do and why. Once someone resolves it, the plan continues.

Trust and auto-pilot

A plan starts out needing approval for every run. After it has run successfully several times, or once a user marks it as low risk, it becomes trusted, and only a trusted plan can run on a schedule by itself (auto-pilot).

Plans can also carry limits: a per-run limit, and a daily limit on how many actions of a plan’s kinds may start in a datastore. Actions past the daily limit wait for the next day.

In your app

@manta-eu/react includes the building blocks to show and run plans. Each one has its own import path:

import { useActionPlans } from "@manta-eu/react/hooks/useActionPlans";
import { useActionPlanDetail } from "@manta-eu/react/hooks/useActionPlanDetail";
import { useActionPlanExecution } from "@manta-eu/react/hooks/useActionPlanExecution";
import { useResolveManualAction } from "@manta-eu/react/hooks/useResolveManualAction";

import { ExecutePlanDialog } from "@manta-eu/react/components/planning/ExecutePlanDialog";
import { ActionPlanDetailView } from "@manta-eu/react/components/planning/ActionPlanDetailView";
import { ManualActionListView } from "@manta-eu/react/components/planning/ManualActionList";
import { RunHistoryTable } from "@manta-eu/react/components/planning/RunHistoryTable";
  • useActionPlans and useActionPlanDetail list and read plans.
  • useActionPlanExecution runs a plan, with a dry run first.
  • useResolveManualAction resolves manual actions.

@manta-eu/react/ldo-ui also exports a useActionPlanDetail, which reads a plan straight from the graph and takes different arguments. Import the one from hooks/useActionPlanDetail for the plan details shown above.

To create, change or delete one entity without a plan from rules, see Change one entity.

EmbeddedChat also takes an onSelectPlan callback, so your app can open its own plan view when the user picks a plan in the chat.

From a backend

A backend runs a plan with the executeActionPlan mutation. It defaults to a dry run, which validates the plan and returns the semantic diff without changing anything. See calling Manta from a backend for the endpoint and authentication.

mutation RunPlan($input: ExecuteActionPlanInput!) {
  executeActionPlan(input: $input) {
    success
    workflowId
    error
  }
}
{ "input": { "namedGraphIri": "<the plan's IRI>", "dryRun": true } }

Set dryRun to false to run it for real. The response’s workflowId identifies the run.

Pages in this chapter