# AI Agent APIs

All runners which include GenAI base runner and have GenAI models assigned to them can service the following common APIs for describing and interacting with agents.

## Gets detailed view of AI agent capabilities

> Returns sagas, states, systems and scripting languages an agent can utilize.

```json
{"openapi":"3.0.0","info":{"title":"Rierino - Core Platform - AI Agent APIs","version":"1.0.0"},"servers":[{"url":"https://gateway_server","description":"API gateway server"}],"paths":{"/api/request/{channel}/GetAIAgent":{"get":{"summary":"Gets detailed view of AI agent capabilities","description":"Returns sagas, states, systems and scripting languages an agent can utilize.","tags":["ai"],"parameters":[{"$ref":"#/components/parameters/channelParam"},{"name":"id","in":"query","description":"Id of agent to view","required":false,"schema":{"type":"string"}}],"responses":{"200":{"$ref":"#/components/responses/GenericOK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Id of the agent"},"data":{"type":"object","properties":{"name":{"type":"string","description":"Name of the agent"},"description":{"type":"string","description":"Description of the agent"},"states":{"type":"array","description":"List of state managers accessible by agent"},"systems":{"type":"array","description":"List of external systems accessible by agent"},"sagas":{"type":"array","description":"List of sagas that can be executed by agent"},"prompts":{"type":"array","description":"List of predefined prompts"}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalError"},"501":{"$ref":"#/components/responses/NotImplemented"}}}}},"components":{"parameters":{},"responses":{"GenericOK":{"description":"OK"},"Unauthorized":{"description":"Authorization information is missing or invalid."},"Forbidden":{"description":"User does not have the required role for access."},"InternalError":{"description":"Server failed to process request due to internal errors."},"NotImplemented":{"description":"Feature is not implemented by the server."}}}}
```

## Calls an AI agent

> Makes a request to a specific AI agent with a message or prompt inputs.

```json
{"openapi":"3.0.0","info":{"title":"Rierino - Core Platform - AI Agent APIs","version":"1.0.0"},"servers":[{"url":"https://gateway_server","description":"API gateway server"}],"paths":{"/api/request/{channel}/CallAIAgent":{"post":{"summary":"Calls an AI agent","description":"Makes a request to a specific AI agent with a message or prompt inputs.","tags":["ai"],"requestBody":{"description":"AI agent request details","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"type":"string","description":"Id of the agent to call","required":true},"chat":{"type":"string","description":"Id of the ongoing chat with agent"},"message":{"type":"string","description":"Message/request to send to agent, required if prompt is not used"},"prompt":{"type":"string","description":"Id of the agent prompt to be used, required if message is not used"},"input":{"type":"object","description":"Input parameters which are used by the selected prompt"}}}}}},"responses":{"200":{"$ref":"#/components/responses/GenericOK","content":{"application/json":{"schema":{"type":"object","properties":{"response":{"type":"string","description":"Response text generated by the agent"},"chat":{"type":"string","description":"Id of the chat created/ongoing"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalError"},"501":{"$ref":"#/components/responses/NotImplemented"}}}}},"components":{"responses":{"GenericOK":{"description":"OK"},"Unauthorized":{"description":"Authorization information is missing or invalid."},"Forbidden":{"description":"User does not have the required role for access."},"InternalError":{"description":"Server failed to process request due to internal errors."},"NotImplemented":{"description":"Feature is not implemented by the server."}}}}
```

## Calls a 'panel' of AI agents

> Makes the same request to a list of AI agents and collects responses from all.

```json
{"openapi":"3.0.0","info":{"title":"Rierino - Core Platform - AI Agent APIs","version":"1.0.0"},"servers":[{"url":"https://gateway_server","description":"API gateway server"}],"paths":{"/api/request/{channel}/CallAIPanel":{"post":{"summary":"Calls a 'panel' of AI agents","description":"Makes the same request to a list of AI agents and collects responses from all.","tags":["ai"],"requestBody":{"description":"AI panel request details","content":{"application/json":{"schema":{"type":"object","properties":{"panel":{"type":"array","description":"List of AI agents to call","items":{"type":"object","properties":{"agent":{"type":"string","description":"Id of the agent to call"},"weight":{"type":"number","description":"Weight to assign to agent response"},"chat":{"type":"string","description":"Id of the ongoing chat with agent"}}}},"message":{"type":"string","description":"Message/request to send to agent, required if prompt is not used"},"prompt":{"type":"string","description":"Id of the agent prompt to be used, required if message is not used"},"input":{"type":"object","description":"Input parameters which are used by the selected prompt"}}}}}},"responses":{"200":{"$ref":"#/components/responses/GenericOK","content":{"application/json":{"schema":{"type":"object","properties":{"list":{"type":"array","items":{"properties":{"agent":{"type":"string","description":"Agent that generated the response"},"weight":{"type":"number","description":"Weight assigned to responding agent"},"response":{"type":"string","description":"Response text generated by the agent"},"chat":{"type":"string","description":"Id of the chat created/ongoing"}}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"500":{"$ref":"#/components/responses/InternalError"},"501":{"$ref":"#/components/responses/NotImplemented"}}}}},"components":{"responses":{"GenericOK":{"description":"OK"},"Unauthorized":{"description":"Authorization information is missing or invalid."},"Forbidden":{"description":"User does not have the required role for access."},"InternalError":{"description":"Server failed to process request due to internal errors."},"NotImplemented":{"description":"Feature is not implemented by the server."}}}}
```
