POST
/
v1
/
agents
/
run
/
{agent_id}
/
async
/
Python
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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

agent_id
string<uuid>
required

Query Parameters

organization_id
string<uuid>

Organization ID. This is required for access control. It can be provided via query or request body depending on the endpoint.

Body

Serializer for agent execution requests with dynamic input fields.

Response

200
application/json

Agent job ID

The response is of type string.