Agents
Run Agent Async
Run agent asynchronously. Returns agent job id which can be used to check status and get results.
POST
/
v1
/
agents
/
run
/
{agent_id}
/
async
import requests
import os
agent_id = "YOUR_AGENT_ID" # Replace with your agent ID
your_api_key = "YOUR_API_KEY" # Replace with your API key
url = f"https://api.roe-ai.com/v1/agents/run/{agent_id}/async/"
headers = {
"Authorization": f"Bearer {your_api_key}",
}
# 'payload' is specific to your agent's inputs. This is an example for an Document Insight Agent.
# Option 1: Providing file ID
file_id = "YOUR_FILE_ID" # Replace with your file ID. Found on Roe AI if you uploaded your files there.
payload = {
"pdf_file": file_id,
# add other agent inputs here as needed, specific to your agent
}
response = requests.post(
url,
headers=headers,
json=payload
)
# Option 2: Directly uploading a file
# Path to the file you want to upload
file_path = "path/to/your/document.pdf"
payload = {
# add any other agent keys here
}
files = {
"pdf_file": (os.path.basename(file_path), open(file_path, "rb"), "application/pdf")
}
response = requests.post(
url,
headers=headers,
data=payload,
files=files
)
# View response
if response.status_code == 200:
results = response.json()
print(json.dumps(results, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
"123e4567-e89b-12d3-a456-426614174000"
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Path Parameters
Body
Response
200
application/json
Agent job ID
The response is of type string
.
import requests
import os
agent_id = "YOUR_AGENT_ID" # Replace with your agent ID
your_api_key = "YOUR_API_KEY" # Replace with your API key
url = f"https://api.roe-ai.com/v1/agents/run/{agent_id}/async/"
headers = {
"Authorization": f"Bearer {your_api_key}",
}
# 'payload' is specific to your agent's inputs. This is an example for an Document Insight Agent.
# Option 1: Providing file ID
file_id = "YOUR_FILE_ID" # Replace with your file ID. Found on Roe AI if you uploaded your files there.
payload = {
"pdf_file": file_id,
# add other agent inputs here as needed, specific to your agent
}
response = requests.post(
url,
headers=headers,
json=payload
)
# Option 2: Directly uploading a file
# Path to the file you want to upload
file_path = "path/to/your/document.pdf"
payload = {
# add any other agent keys here
}
files = {
"pdf_file": (os.path.basename(file_path), open(file_path, "rb"), "application/pdf")
}
response = requests.post(
url,
headers=headers,
data=payload,
files=files
)
# View response
if response.status_code == 200:
results = response.json()
print(json.dumps(results, indent=2))
else:
print(f"Error: {response.status_code}")
print(response.text)
"123e4567-e89b-12d3-a456-426614174000"