Arc Engine API (AEA) Helper Functions
Using the get_aea_helpers
Point
get_aea_helpers
PointThe get_aea_helpers
point provides various helper functions for interacting with the AEA API. This guide will explain how to utilize these helpers effectively in your projects.
Initialization
To begin using the get_aea_helpers
point, ensure it is properly initialized in your environment. The execute_process
function will set up the global _aea
object with all necessary helper functions.
Available Helper Functions
API Interaction
- getPayload(data, method): Constructs the payload for API requests.
- callAPI(url, payload, meta): Template for calling the API with logging.
Task Management
conversation_id
Some platform features call for a
conversation_id
.task_execution_id
andconversation_id
are interchangeable.conversation_id
is a legacy term that will be deprecated.
- restartTask(task_id, conversation_id): Restarts a task by deleting the current token and components, then recreating it in an initialized state.
- closeTask(task_id, conversation_id, reason): Closes the specified task with an optional reason.
- closeCurrentTask(reason) Closes the current task with an optional reason.
- unassignTask(conversation_id): Unassigns the user from a task.
- unassignCurrentTask() Unassigns the user of the current task.
- transferTask(conversation_id, agent_id, transfer_type): Transfers a task to another agent.
- transferTaskToMe(conversation_id) Transfers the specified conversation to the current agent.
- transferCurrentTask(agent_id) Transfers the current task to the specified agent.
- transferCurrentTaskToMe() Transfers the current task to the current user.
- findTasks(keys, daysAgo, projection, limit): Search for the task with provided params.
- findTokens(keys, daysAgo, projection, limit): Search for the tokens with the provided params.
- getTokens(token_ids, projection): Get the tokens with the provided token_ids
Point Management
- getEnabledPoints(domain, partitions, tokenId, options): Determines activated points by executing input fill.
- searchPoints(type, filters, fields, sort): Searches points based on type, filters, and optionally fields and sort.
- getPointsByNameFilter(names): Prepares an array of name filters for searching points.
- getPartition(type, name, options): Collects all points in partition. Options: filters, fields, sort, and limit.
Generic Functions
- genericPost(route, data): Makes a POST request to the API with the given route and data.
- setAPIKey(api_key): Sets the current API key.
Using the Helper Functions
Example: Closing Current Task
await _aea.closeCurrentTask('optionally include a reason here')
Example: Closing a Task
To close a task with a specific reason:
await _aea.closeTask('task_id_example', 'conversation_id_example', 'Task completed');
Example: Transferring a Task
To transfer a task to another agent:
await _aea.transferTask('conversation_id_example', 'agent_id_example');
Example: Getting Enabled Points
To get enabled points for specific domains and partitions:
const enabledPoints = await _aea.inputFill.values(['partition1', 'partition2'], { tokenId: 'example_token_id' });
Example: Restarting a Task
await _aea.restartTask('task_id_example', 'conversation_id_example');
Updated 2 months ago