Create Action

Use CreateAction to create a new Action with its routing, intent, priority, timing, and related Objects. Set every field that consumers need at creation time because the Action content is not rewritten after creation.

  • A provided action.id creates the Action with that identifier.

  • An omitted action.id lets the service assign one.

  • The initial state defaults to ACTION_STATE_DRAFT if you do not provide one.

package main

import (
	"context"
	"log"
	"time"

	"connectrpc.com/connect"
	"google.golang.org/protobuf/types/known/timestamppb"

	wdmsdk "github.com/raft-tech/raft-wdm-sdk-go"
	pb "github.com/raft-tech/raft-wdm-sdk-go/gen/raft/wdm/v1"
	svc "github.com/raft-tech/raft-wdm-sdk-go/gen/raft/wdm/v1/service"
)

func main() {
	cfg, err := wdmsdk.LoadConfig()
	if err != nil {
		log.Fatal(err)
	}

	client, err := wdmsdk.NewFromConfig(cfg)
	if err != nil {
		log.Fatal(err)
	}

	updatedAt := time.Now().UTC()
	_, err = client.ActionService().CreateAction(context.Background(), connect.NewRequest(&svc.CreateActionRequest{
		Action: &pb.Action{
			Id:       "isr-collect-alpha",
			Name:     "ISR Collection Alpha",
			Type:     "isr_collection",
			Scope:    pb.ActionScope_ACTION_SCOPE_TASK,
			State:    pb.ActionState_ACTION_STATE_ASSIGNED,
			Priority: pb.ActionPriority_ACTION_PRIORITY_HIGH,
			RequestedBy: &pb.Principal{
				Id:   "ops-cell-alpha",
				Type: pb.PrincipalType_PRINCIPAL_TYPE_USER,
			},
			AssignedTo: &pb.Principal{
				Id:   "uav-shadow-07",
				Type: pb.PrincipalType_PRINCIPAL_TYPE_OBJECT,
			},
			AuthorizedBy: &pb.Principal{
				Id:   "s2-battle-captain",
				Type: pb.PrincipalType_PRINCIPAL_TYPE_USER,
			},
			Intent: &pb.Intent{
				Purpose:  "Observe NAI 3 before the convoy crosses phase line BLUE",
				Method:   "Maintain a collection orbit with EO/IR coverage",
				EndState: "Report movement or changes near the route",
			},
			ObjectLinks: []*pb.ObjectLink{
				{
					ObjectId: "link16-track-47210",
					Type:     pb.ObjectLinkType_OBJECT_LINK_TYPE_TARGET,
				},
			},
			Provenance: &pb.ProvenanceRecord{
				Name:      "ops-center-01",
				UpdatedAt: timestamppb.New(updatedAt),
			},
		},
	}))
	if err != nil {
		log.Fatal(err)
	}
}
import com.google.protobuf.Timestamp;
import com.raft.wdm.Wdm;
import com.raft.wdm.raft.wdm.v1.Action;
import com.raft.wdm.raft.wdm.v1.ActionPriority;
import com.raft.wdm.raft.wdm.v1.ActionScope;
import com.raft.wdm.raft.wdm.v1.ActionState;
import com.raft.wdm.raft.wdm.v1.Intent;
import com.raft.wdm.raft.wdm.v1.ObjectLink;
import com.raft.wdm.raft.wdm.v1.ObjectLinkType;
import com.raft.wdm.raft.wdm.v1.Principal;
import com.raft.wdm.raft.wdm.v1.PrincipalType;
import com.raft.wdm.raft.wdm.v1.ProvenanceRecord;
import com.raft.wdm.raft.wdm.v1.service.CreateActionRequest;
import com.raft.wdm.v1.WdmV1Client;
import java.time.Instant;

public final class CreateActionExample {
  public static void main(String[] args) {
    var options = Wdm.toOptions(Wdm.loadConfig(null, null));
    var updatedAt = Instant.now();

    try (var client = WdmV1Client.create(options)) {
      var req = CreateActionRequest.newBuilder()
          .setAction(Action.newBuilder()
              .setId("isr-collect-alpha")
              .setName("ISR Collection Alpha")
              .setType("isr_collection")
              .setScope(ActionScope.ACTION_SCOPE_TASK)
              .setState(ActionState.ACTION_STATE_ASSIGNED)
              .setPriority(ActionPriority.ACTION_PRIORITY_HIGH)
              .setRequestedBy(Principal.newBuilder()
                  .setId("ops-cell-alpha")
                  .setType(PrincipalType.PRINCIPAL_TYPE_USER))
              .setAssignedTo(Principal.newBuilder()
                  .setId("uav-shadow-07")
                  .setType(PrincipalType.PRINCIPAL_TYPE_OBJECT))
              .setAuthorizedBy(Principal.newBuilder()
                  .setId("s2-battle-captain")
                  .setType(PrincipalType.PRINCIPAL_TYPE_USER))
              .setIntent(Intent.newBuilder()
                  .setPurpose("Observe NAI 3 before the convoy crosses phase line BLUE")
                  .setMethod("Maintain a collection orbit with EO/IR coverage")
                  .setEndState("Report movement or changes near the route"))
              .addObjectLinks(ObjectLink.newBuilder()
                  .setObjectId("link16-track-47210")
                  .setType(ObjectLinkType.OBJECT_LINK_TYPE_TARGET))
              .setProvenance(ProvenanceRecord.newBuilder()
                  .setName("ops-center-01")
                  .setUpdatedAt(timestamp(updatedAt))))
          .build();

      client.getActionService()
          .createActionBlocking(req)
          .execute();
    }
  }

  private static Timestamp timestamp(Instant instant) {
    return Timestamp.newBuilder()
        .setSeconds(instant.getEpochSecond())
        .setNanos(instant.getNano())
        .build();
  }
}
import asyncio
from datetime import datetime, timezone

from google.protobuf.timestamp_pb2 import Timestamp
from raft.wdm.v1 import action_pb2
from raft.wdm.v1 import common_pb2
from raft.wdm.v1.service import action_service_pb2

import raft_wdm_sdk


def timestamp(dt: datetime) -> Timestamp:
    value = Timestamp()
    value.FromDatetime(dt)
    return value


async def main() -> None:
    updated_at = datetime.now(timezone.utc)

    async with raft_wdm_sdk.Client.from_config(raft_wdm_sdk.load_config()) as client:
        await client.action_service.create_action(
            action_service_pb2.CreateActionRequest(
                action=action_pb2.Action(
                    id="isr-collect-alpha",
                    name="ISR Collection Alpha",
                    type="isr_collection",
                    scope=action_pb2.ACTION_SCOPE_TASK,
                    state=action_pb2.ACTION_STATE_ASSIGNED,
                    priority=action_pb2.ACTION_PRIORITY_HIGH,
                    requested_by=common_pb2.Principal(
                        id="ops-cell-alpha",
                        type=common_pb2.PRINCIPAL_TYPE_USER,
                    ),
                    assigned_to=common_pb2.Principal(
                        id="uav-shadow-07",
                        type=common_pb2.PRINCIPAL_TYPE_OBJECT,
                    ),
                    authorized_by=common_pb2.Principal(
                        id="s2-battle-captain",
                        type=common_pb2.PRINCIPAL_TYPE_USER,
                    ),
                    intent=action_pb2.Intent(
                        purpose="Observe NAI 3 before the convoy crosses phase line BLUE",
                        method="Maintain a collection orbit with EO/IR coverage",
                        end_state="Report movement or changes near the route",
                    ),
                    object_links=[
                        action_pb2.ObjectLink(
                            object_id="link16-track-47210",
                            type=action_pb2.OBJECT_LINK_TYPE_TARGET,
                        ),
                    ],
                    provenance=common_pb2.ProvenanceRecord(
                        name="ops-center-01",
                        updated_at=timestamp(updated_at),
                    ),
                ),
            ),
        )


asyncio.run(main())
import { create } from "@bufbuild/protobuf";
import { timestampFromDate } from "@bufbuild/protobuf/wkt";
import { createClient, fromNodeConfig, loadConfig } from "@raft-tech/raft-wdm-sdk-typescript";
import { PrincipalType } from "@raft-tech/raft-wdm-sdk-typescript/gen/raft/wdm/v1/common_pb.js";
import {
  ActionPriority,
  ActionScope,
  ActionState,
  ObjectLinkType,
} from "@raft-tech/raft-wdm-sdk-typescript/gen/raft/wdm/v1/action_pb.js";
import { CreateActionRequestSchema } from "@raft-tech/raft-wdm-sdk-typescript/gen/raft/wdm/v1/service/action_service_pb.js";

const client = createClient(...fromNodeConfig(loadConfig()));

const updatedAt = new Date();

await client.actionService.createAction(
  create(CreateActionRequestSchema, {
    action: {
      id: "isr-collect-alpha",
      name: "ISR Collection Alpha",
      type: "isr_collection",
      scope: ActionScope.TASK,
      state: ActionState.ASSIGNED,
      priority: ActionPriority.HIGH,
      requestedBy: {
        id: "ops-cell-alpha",
        type: PrincipalType.USER,
      },
      assignedTo: {
        id: "uav-shadow-07",
        type: PrincipalType.OBJECT,
      },
      authorizedBy: {
        id: "s2-battle-captain",
        type: PrincipalType.USER,
      },
      intent: {
        purpose: "Observe NAI 3 before the convoy crosses phase line BLUE",
        method: "Maintain a collection orbit with EO/IR coverage",
        endState: "Report movement or changes near the route",
      },
      objectLinks: [
        {
          objectId: "link16-track-47210",
          type: ObjectLinkType.TARGET,
        },
      ],
      provenance: {
        name: "ops-center-01",
        updatedAt: timestampFromDate(updatedAt),
      },
    },
  }),
);
curl -X POST "${RDP_SERVER_URL}/api/v1/wdm/actions" \
  -H "X-API-KEY: ${RDP_API_KEY}" \
  -H "Content-Type: application/json" \
  --json @- <<JSON
{
  "action": {
    "id": "isr-collect-alpha",
    "name": "ISR Collection Alpha",
    "type": "isr_collection",
    "scope": "ACTION_SCOPE_TASK",
    "state": "ACTION_STATE_ASSIGNED",
    "priority": "ACTION_PRIORITY_HIGH",
    "requestedBy": {
      "id": "ops-cell-alpha",
      "type": "PRINCIPAL_TYPE_USER"
    },
    "assignedTo": {
      "id": "uav-shadow-07",
      "type": "PRINCIPAL_TYPE_OBJECT"
    },
    "authorizedBy": {
      "id": "s2-battle-captain",
      "type": "PRINCIPAL_TYPE_USER"
    },
    "intent": {
      "purpose": "Observe NAI 3 before the convoy crosses phase line BLUE",
      "method": "Maintain a collection orbit with EO/IR coverage",
      "endState": "Report movement or changes near the route"
    },
    "objectLinks": [
      {
        "objectId": "link16-track-47210",
        "type": "OBJECT_LINK_TYPE_TARGET"
      }
    ],
    "provenance": {
      "name": "ops-center-01",
      "updatedAt": "2026-05-27T21:31:04Z"
    }
  }
}
JSON

Creation Guidance

Create the Action with the context consumers need to route and execute it:

  • scope and type describe the kind of Action.

  • requestedBy, assignedTo, and authorizedBy describe routing and responsibility.

  • intent describes purpose, method, and desired end state.

  • priority, notBefore, notAfter, route, and area fields describe execution constraints when they apply.

  • objectLinks identify targets, assets, and related Objects.

  • provenance.updatedAt records when the producer last updated the source record.

The full contract is defined in the WDM protobuf spec. In the WDM distribution, see raft/wdm/v1/service/action_service.proto for CreateActionRequest and raft/wdm/v1/action.proto for Action.