Plan Agent
It's a type of agent capable of building a plan to execute a set of tasks in a specific order based on the user's input.
You can assign a set of Skills to a Plan Agent to add specific "capabilities" to the agent. For example, you can add a HTTP Request
skill to make an HTTP request to an external API. The agent will evaluate if the skill is necessary to complete the task and execute it if needed.
Use cases
- Automated Report Generation: A user requests a detailed monthly report on sales performance. The Plan Agent creates a plan to gather data from different departments (e.g., sales, marketing, customer service), performs data analysis, generates charts and summaries, and compiles them into a final report. It may use skills for data fetching, data analysis, and report generation.
- Multi-step Workflow Automation: A user needs to coordinate a series of tasks for onboarding a new employee. The Plan Agent builds a plan to send welcome emails, schedule orientation meetings, set up accounts in various systems, and order necessary equipment. It uses skills for email sending, calendar management, and system configuration.
- Customer Support Ticket Resolution: A customer submits a complex issue requiring multiple actions. The Plan Agent creates a plan to diagnose the issue, check the system status, escalate to the appropriate team if needed, and follow up with the customer. It may use skills for system monitoring, ticket management, and communication with the customer.
Should I use this agent?
✅ You need to execute a complex task that may require multiple steps to be completed, and you can't define the order in advance.
⛔ You need to execute a single task based on the user's input. In those cases, you may want to use one of the following agents:
Creating a Plan Agent
To create a Plan Agent, follow this guide.
Usage examples
Let's say you have a Plan Agent that automates the process of booking a flight. You can use the following code snippets to execute the agent:
cURL
curl --location 'https://api.serenitystar.ai/api/agent/booking/execute' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <YOUR_API_KEY>' \
--data '[
{
"Key": "message",
"Value": "I want to book a flight from New York to London on December 25th."
},
{
"Key": "stream",
"Value": "true"
}
]'
C#
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://api.serenitystar.ai/api/agent/booking/execute"),
Headers =
{
{ "X-API-KEY", "<YOUR_API_KEY>" },
{ "Content-Type", "application/json" },
},
Content = new StringContent(@"[
{
""Key"": ""message"",
""Value"": ""I want to book a flight from New York to London on December 25th.""
},
{
""Key"": ""stream"",
""Value"": ""true""
}
]", Encoding.UTF8, "application/json"),
};
var response = await client.SendAsync(request);
var responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseContent);
}
}
Python
import requests
import json
url = 'https://api.serenitystar.ai/api/agent/booking/execute'
headers = {
'Content-Type': 'application/json',
'X-API-KEY': '<YOUR_API_KEY>'
}
payload = json.dumps([
{
"Key": "message",
"Value": "I want to book a flight from New York to London on December 25th."
},
{
"Key": "stream",
"Value": "true"
}
])
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)