Get Agent
Get an Agent
The Flyflow API allows you to retrieve the details of a specific agent by making a GET request to the /agent
endpoint. This endpoint returns the information associated with the specified agent ID.
Request
Endpoint
GET /agent
Headers
Authorization
: The API key prefixed withBearer
. Example:Bearer your_api_key
.
Query Parameters
id
(string, required): The unique identifier of the agent you want to retrieve.
cURL Example
curl -X GET \
-H "Authorization: Bearer your_api_key" \
"https://api.flyflow.dev/v1/agent?id=agent_id"
Replace agent_id
with the actual ID of the agent you want to retrieve.
Python Client Example
from flyflowclient import Flyflow
client = Flyflow(api_key='your_api_key')
agent_id = 'agent_id'
agent = client.get_agent(agent_id=agent_id)
print(agent)
Replace agent_id
with the actual ID of the agent you want to retrieve.
Response
Status Codes
200 OK
: The agent details were successfully retrieved.400 Bad Request
: The request is missing the requiredid
query parameter.401 Unauthorized
: The API key is missing or invalid.404 Not Found
: The specified agent ID does not exist.500 Internal Server Error
: An unexpected error occurred on the server side.
Response Body
If the agent details are successfully retrieved, the response body will be a JSON object containing the information associated with the agent:
{
"id": "agent_id",
"name": "Agent Name",
"phone_number": "+1234567890",
"system_prompt": "System prompt for the agent",
"initial_message": "Initial message for the agent",
"llm_model": "gpt-3.5-turbo",
"voice_id": "voice_id",
"webhook": "https://webhook-url.com",
"tools": [],
"filler_words": true,
"filler_words_whitelist": [],
"created_at": "timestamp",
"updated_at": "timestamp"
}
id
(string): The unique identifier of the agent.name
(string): The name of the agent.phone_number
(string): The phone number associated with the agent.system_prompt
(string): The system prompt for the agent.initial_message
(string): The initial message for the agent.llm_model
(string): The language model used by the agent (e.g., "gpt-3.5-turbo").voice_id
(string): The identifier of the voice used by the agent.webhook
(string): The webhook URL for the agent (if applicable).tools
(array): An array of tools available to the agent.filler_words
(boolean): Indicates whether filler words are enabled for the agent.filler_words_whitelist
(array): An array of whitelisted filler words for the agent.created_at
(string): The timestamp indicating when the agent was created.updated_at
(string): The timestamp indicating when the agent was last updated.
Error Handling
If an error occurs while retrieving the agent details, the API will return an appropriate error response with a corresponding status code and error message in the response body.
For example, if the specified agent ID does not exist:
{
"error": "Not Found",
"message": "Agent not found"
}
Make sure to handle errors appropriately in your application and provide the correct agent ID in the request.
Conclusion
Retrieving the details of a specific agent using the Flyflow API is straightforward. By making a GET request to the /agent
endpoint with the required id
query parameter, you can fetch the information associated with the specified agent. The API will return a JSON object containing the agent details upon success. Remember to handle errors and provide the necessary authentication and agent ID to ensure a smooth integration with the Flyflow platform.
Updated 6 months ago