Automating tasks with an LLM

The OpenAPI schema at /openapi.json describes every endpoint of the agent server precisely enough for an LLM to call the API. Give the schema to a model or to a coding assistant, and administrative and reporting tasks can be done in plain language.

What the schema gives a model

The schema names every endpoint, the fields of each request with their types and constraints, and the shape of each response, which is what a tool-calling model needs. Most agent frameworks and coding assistants accept an OpenAPI document and turn each endpoint into a tool. The model reads the descriptions, chooses the endpoint, and fills in the body.

$ curl http://127.0.0.1:9020/openapi.json > search2o-openapi.json

Giving the model access

  1. Create a service account for the automation, with the lowest role that covers the task. The user role covers search and conversations, the developer role covers agents and agent reports, and the administrator role covers users and usage reports.
  2. Give the model's tool layer the service account's key, so that every call carries Authorization: Bearer …. See Authentication.
  3. Tell the model the base URL of the agent server, and that every endpoint under /api/ is a POST with a JSON body.

Suitable tasks

  • Reporting. "Which agents failed most last week, and with what error?" The model calls getAgentErrorReport for the window and reads the result; a follow-up calls getAgentErrorDetailReport for one agent.
  • User administration. "Add these twelve people as developers." The model calls addUsers with the list, up to 25 at a time.
  • Agent housekeeping. "Retag every agent that mentions finance in its title as corporate." The model lists agents with getAgentList, then calls updateTag for each match.
  • Running agents. "Run the morning briefing for the payments team and send me the answer." The model calls execAgent without stream and returns the output; see Running agents.

Limiting access

A model with the schema can call anything the service account may call, including deleteAgent, deleteUsers and updateRole. The service account's role is the boundary, so keep it as low as the task allows; the developer role is enough when a report is all that is needed. Every call the model makes is an ordinary API call: Search2o Cloud checks it against the role, records it against the service account, and shows it in the reports like any other.

For people rather than models

The same schema is rendered for people: Swagger UI at /docs sends a request from the browser, and ReDoc at /redoc is a reference to read. See Overview.