POST
/
v1
/
agents
/
run
/
{agent_id}
/
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}/"
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": "<string>",
    "description": "<string>",
    "data_type": "<string>",
    "value": "<string>",
    "cost": 123
  }
]

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.

metadata
any

Optional metadata as JSON object or JSON string

agent_input_key_example
string

Agent input keys are dynamic based on agent configuration. Can be text or file.

Minimum length: 1

Response

Agent job result

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

The description of the output

cost
number

The cost of the agent job execution