Create an agent association
const url = 'https://app.prefactorai.com/api/v1/agent_association';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"association_type":"judge","from_agent_id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","to_agent_id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","trigger":"on_demand"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.prefactorai.com/api/v1/agent_association \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "association_type": "judge", "from_agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "to_agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "trigger": "on_demand" }'Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
Kind of association. Only judge is allowed for now. For a judge association, from_agent must have role judge
Example
judgeA valid agent ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyA valid agent association ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyNull
A valid agent ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyWhen the association runs: on_demand or on_completion. There is no default; you must set it
Example
on_demandResponses
Section titled “Responses”Success
object
object
A valid account ID
Kind of association. For judge, from_agent is the judge and to_agent is the agent it scores
A valid agent ID
A valid agent association ID
When the association was created
A valid agent ID
When the association runs: on_demand or on_completion. There is no default
Type of resource (always ‘agent_association’)
When the association was last updated
Response status when the operation succeeds
Example
{ "details": { "account_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "association_type": "judge", "from_agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "inserted_at": "2024-01-01T00:00:00Z", "to_agent_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "trigger": "on_demand", "type": "agent_association", "updated_at": "2024-01-01T00:00:00Z" }, "status": "success"}default
Section titled “default”Error
object
object
object
object
Milliseconds until the client may retry.
object
A valid knowledgebase document revision ID
Example
{ "code": "bad_request", "status": "error"}