POST
/
v1
/
agents
/
run
/
{agent_id}
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}/"
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)
[
  {
    "key": "output",
    "description": "Output JSON data",
    "data_type": "application/json",
    "value": "{\"summary\": \"hello world!\"}"
  }
]

Authorizations

Authorization
string
header
required

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

Path Parameters

agent_id
string
required

Body

agent_input_key_1
string

Agent input key defined in agent settings; can be a file or a string

Minimum length: 1
agent_input_key_2
file

Agent input key defined in agent settings; can be a file or a string; more input keys can be added as needed

Response

200
application/json
Agent outputs
key
string
required

The key of the output

data_type
string
required

The MIME data type of the output

value
string
required

The value of the output, serialized as a string

description
string | null

The description of the output