Using your crew's API in CrewAI Enterprise
How to turn your crew into an API within seconds and use it
This article assumes you already build your crew and deployed it on CrewAI
Assuming you have your crew live, you should have a base URL and a Bearer Token that got generated for you.
Now your crew is basically an API and you call it using two main REST endpoints:
[GET] /inputs
- List all required inputs for the crew kickoff[POST] /kickoff
- Starts a crew passing it's inputs and optional callbacks, you get back atask_id
-
[GET] /status/{task_id}
- Using thetask_id
from the /kickoff request you can now pull this endpoint to get the task completion
All endpoints are protected by a bearer token that is unique to your app, and that should be send using the authorization header.
Inputs Endpoint
The inputs endpoint is useful for you to programmatically learn the required inputs for your crew.
Meta
Allows you to pass in additional parameter
Kickoff Endpoint
The kickoff endpoint requires at least one attribute called input
this input should be a dictionary with all the attributes the crew expects, anything you interpolated on the agents or tasks.
The kickoff endpoint also supports 3 extra arguments:
taskWebhookUrl
- Callback that will be executed upon the end of each task-
stepWebhookUrl
- Callback that will be executed upon each agent inner thought crewWebhookUrl
- Callback that will be executed upon the end of the crew execution
Here is an example of an input for a Trip Planner crew:
{
"inputs": {
"budget": "1000 USD",
"interests": "games, tech, ai, relaxing hikes, amazing food",
"duration": "7 days",
"age": "35"
},
"meta": "....",
"taskWebhookUrl": "https://...",
"stepWebhookUrl": "https://...",
"crewWebhookUrl": "https://..."
}
Status Endpoint
The status endpoint allows you to tag along an execution by polling on this endpoint until you the get the full result of your crew.