The buzz around AI agents and autonomous workflows is undeniable. These intelligent systems promise to revolutionize how we work by taking on complex tasks, making decisions, and operating with minimal human intervention. But moving from theory to a deployed, robust agent can be daunting. How do you manage state, handle failures, and connect disparate services without getting lost in boilerplate code?
Enter Actions.do. We believe the future of automation is built on simple, powerful, and reusable building blocks. We call them Actions.
An Action encapsulates a single piece of business logic—from an API call to a data transformation—into a reusable, executable unit. These Actions are the fundamental "skills" or "tools" you can give to an agent. In this tutorial, we'll show you how to define your first Action and orchestrate it into a simple agentic workflow in just five minutes.
Before we dive in, let's clarify what we mean by an Action.
An Action is the smallest, indivisible unit of work in a workflow. It's a self-contained piece of code that performs a specific task, like sending an email, calling an external API, or transforming data.
Think of it as a single, reliable tool in your agent's toolbox. By defining your business processes as a collection of Actions, you embrace the "business as code" philosophy—making your workflows versionable, testable, and incredibly scalable.
Let's build one.
Every agent needs to communicate. Let's create a reusable Action that sends a notification to a specific Slack channel. This is a classic task execution example that can be used across countless workflows.
With Actions.do, you define this logic in code, giving you full control and flexibility.
import { Action } from 'actions.do';
// Define a reusable action to notify a Slack channel
const notifySlack = new Action({
id: 'notify-slack-channel',
handler: async (payload: { channel: string; message: string }) => {
const { channel, message } = payload;
console.log(`Sending to Slack #${channel}: ${message}`);
// The actual Slack API call would go here
// const slackResponse = await postToSlack(channel, message);
return { success: true, timestamp: new Date().toISOString() };
}
});
// This Action can now be executed by any workflow or API call.
Let's break this down:
You've just defined a modular, serverless function without worrying about the underlying infrastructure. This Action is now ready to be used by any agent.
An agent without a goal is just a collection of dormant tools. A workflow orchestrates your Actions, defining the sequence of tasks to achieve a specific outcome.
Let's create a simple workflow that triggers our notify-slack-channel Action whenever a new "urgent" support ticket is created. Workflows in Actions.do can be defined in a simple, declarative way (e.g., using JSON or YAML).
id: urgent-ticket-notifier
name: Urgent Support Ticket Notifier
trigger:
type: event
source: 'support-system'
filter: 'ticket.priority == "urgent"'
steps:
- name: SendSlackNotification
actionId: 'notify-slack-channel' # <-- We reference our Action here
input:
channel: 'dev-alerts'
message: "🚨 New Urgent Ticket: {{ trigger.event.data.ticketId }} - {{ trigger.event.data.summary }}"
This workflow tells our system: "When an event from the support-system comes in with a priority of 'urgent', execute the notify-slack-channel Action with this specific channel and a message constructed from the event data."
Your agent is now assembled and has a goal. The final step is to put it to work. Based on our workflow definition, this agent is triggered by an event. Actions can be triggered in multiple ways:
To trigger our workflow, an external system (like your helpdesk) would simply send a webhook or an API call to Actions.do. For testing, we could simulate this with a simple curl command to a secure endpoint provided by Actions.do.
curl -X POST https://api.actions.do/v1/events \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"source": "support-system",
"data": {
"ticketId": "TICKET-451",
"priority": "urgent",
"summary": "Production database is unresponsive."
}
}'
And that's it! The moment this event is received, Actions.do executes your workflow:
In just a few minutes, you've created a basic but powerful agentic workflow. The real power comes from the principles behind the Action.
You're no longer just building linear automations; you're creating a library of capabilities that can be composed and orchestrated to build truly intelligent and resilient agents.
Ready to stop gluing scripts together and start building with powerful, reusable blocks?
Get started with Actions.do today and turn your business logic into powerful, automated workflows.