Agent Execution
import requests, json, os

# Example :
client_id = os.getenv("ONYX_CLIENT_ID", "sample_client_id")
client_secret = os.getenv("ONYX_CLIENT_SECRET", "sample_client_secret")
agent_id = "agent_0256b0b"

# Use variables any params you want to passed in the agent
variables =  {
    "product_description": "",
    "sender_profile": "",
    "size": ""
}

def run_job(client_id, client_secret, agent_id, variables):
    run_job_url = "https://0ii9so21w5.execute-api.us-east-1.amazonaws.com/prod/data_query/agentflow/run_job"
    headers = {"Content-Type": "application/json"}
    run_job_data = {
        "client_id": client_id,
        "client_secret": client_secret,
        "agent_id": agent_id,
        "input_data": variables,
    }
    
    response = requests.post(run_job_url, headers=headers, data=json.dumps(run_job_data))
    print("Run Job Response Status Code:", response.status_code)
    job_id = response.text

    print (f"Job ID: {job_id}")
    return job_id


job_id = run_job(client_id, client_secret, agent_id, variables)
print("Job ID:", job_id)

client_id
string

client_id can be found in your deployment console

client_secret
string

client_secret can be found in your deployment console

agent_id
string

agent_id is the unique identifier for the specific agent system you created within the agent canvas. This can be found in your deployment console.

input_data
list

input_data includes the specific variables you pass in to your agent system. Onyx allow’s you to paramterize but ensure the list of variable names passed in here is consistent with whats defined in your agent system.