Skip to main content

Agent HTTP API

The agent is a separate service from the FINOS Workspace API. It is a Hono application on Node that listens on port 7777 by default, and the web app talks to it directly from the browser. This page lists its routes, the checks that apply to them and the metrics that it serves. The questions that users ask travel over POST /v1/query, which has its own page, the agent query protocol.

Every route is defined next to the handler that answers it, in agent/src/app.ts and agent/src/routes/. The definition holds the method, the path, what the route does, the request that it takes and the answers that it gives, and the code writes them into an OpenAPI document, agent/reference-data/openapi.json. The tables on this page come from that document, so they list the routes that the application serves, with the parameters, the request body and the responses of each one. The export fails when a route has no definition or when a definition has no route.

Checks that apply to every route​

Origin. the agent answers cross-origin requests from the origins that AGENT_CORS_ORIGINS lists. The value * allows every origin. The setting is required when authentication is on. The responses expose the headers X-Trace-Id and X-Completion-Id to scripts.

Trace headers. Every response carries X-Trace-Id, which repeats the request's header of that name or holds a new identifier, and X-Completion-Id, which is new for every response.

Authentication. Every route under /v1 requires the header Authorization: Bearer with an agent token, unless the agent runs with AGENT_AUTH=none. A request without a valid token receives the status 401, the body {"error": "Not signed in"} and the header WWW-Authenticate: Bearer. The routes outside /v1 need no token. A test asks every route below for an answer without a token and fails when the column "Needs a token" differs from what the application does.

Body size. A request body under /v1 may not exceed AGENT_MAX_BODY_MB megabytes, which is 64 by default. The JSON helper routes accept at most 8 MiB, and /v1/transcribe accepts a little more than 4 MiB. A larger body receives the status 413.

service​

These routes tell whether the agent runs and what it can do. They need no token.

GET/​

Answers with the text Agent.

Answers with the plain text Agent. It tells a person who opens the address of the agent that the agent is running.

Responses

  • 200The text Agent.string

GET/agents.json​

The agent's descriptor, which the Workspace reads to learn the agent's name, skills and features.

Answers the descriptor of the agent: its name, what it does, the route that asks it a question, its skills and the features that this deployment offers. The FINOS Workspace reads the descriptor to show the agent in the interface and to know what it can do.

Responses

  • 200The descriptor of the agent, under its id.AgentsDescriptor
    AgentsDescriptor

    The agents that this service offers, each under its id.

    This schema has no named properties.

GET/ready​

Answers whether the agent is ready to take questions.

Answers {"status": "ready"}. With authentication on, the agent first calls the /health route of the Workspace API with a timeout of 3 seconds, and when that fails it answers 503 with {"status": "not ready", "reason": "the Workspace API does not answer"}.

Responses

  • 200The agent is ready to take questions.AgentReady
    AgentReady
    • statusstringrequired

      The state of the agent, which is ready when it takes questions.

  • 503The Workspace API does not answer.AgentNotReady
    AgentNotReady
    • statusstringrequired

      The state of the agent, which is not ready when the Workspace API does not answer.

    • reasonstringrequired

      Why the agent is not ready.

GET/status​

Answers with the state of the agent.

Answers {"status": "ok", "timestamp": ..., "sharedState": ...}. The timestamp says when the answer was made. sharedState is true when the agent keeps its state in Redis, which a deployment with more than one replica needs.

Responses

  • 200The state of the agent.AgentStatus
    AgentStatus
    • statusstringrequired

      The state of the agent, which is ok when it serves requests.

    • timestampstringrequired

      When the answer was made, as a time in ISO 8601.

    • sharedStatebooleanrequired

      Whether the agent keeps its state in Redis, which a deployment with more than one replica needs.

query​

This route asks the agent a question. It needs a token.

POST/v1/query​

Asks a question.

Asks the agent a question. The answer is a stream of events, as the agent query protocol describes. The request holds the conversation, the widgets of the dashboard, the tools that the workspace offers, the documents that the user sends and the state of the workspace.

needs a token

Request body

application/jsonQueryRequestrequired
QueryRequest
  • messagesmap<string, any>[]requiredminItems 1maxItems 20000

    The conversation, oldest first. A message has the role human, ai or tool.

    1 nested property
    • role"human" | "ai" | "tool"required

      Who wrote the message: the user, the agent, or the browser's result for a request of the agent.

  • modelstringmaxLength 200

    Accepted but not used. The agent reads the model from workspace_options.model.

  • widgetsobject

    The widgets that the agent may read, sorted into three tiers: primary, secondary and extra.

    3 nested properties
    • primarymap<string, any>[]maxItems 20000

      The widgets that the user selected or mentioned.

      13 nested properties
      • uuidstringmaxLength 500

        The widget's identifier on the dashboard. A widget of the catalog that is not on the dashboard has none, and the agent identifies it by its widget_id.

      • originstringmaxLength 500

        The name of the backend that serves the widget.

      • widget_idstringmaxLength 500

        The widget's id in its backend.

      • namestringmaxLength 2000

        What the model reads to choose a widget.

      • descriptionstringmaxLength 50000

        What the model reads to choose a widget.

      • widget_typestring | null

        The kind of widget, for example markdown, html or iframe.

      • paramsmap<string, any>[]maxItems 1000

        The widget's parameters. Each has a name, a type, a description, a default_value, a current_value, a list of options and multi_select.

      • columnsstring[] | null

        The column names of the rows that a widget on the dashboard has loaded.

      • categorystringmaxLength 500

        What the model reads to choose a widget.

      • sub_categorystringmaxLength 500

        What the model reads to choose a widget.

      • sourcestring | null

        Free-form details about the widget.

      • metadatamap<string, any>

        Free-form details about the widget. For a widget on the dashboard, it holds lastUpdated, the time of its last update in milliseconds since 1970.

      • mcp_toolobject

        A link from the widget to an MCP tool.

        3 nested properties
        • server_idstringrequiredmaxLength 500

          The id of the MCP server that has the tool.

        • tool_namestringrequiredmaxLength 500

          The name of the tool on that server.

        • argsmap<string, string | number | boolean>property names: maxLength 200

          The arguments that the tool receives, by name.

    • secondarymap<string, any>[]maxItems 20000

      The other widgets of the dashboard.

      13 nested properties
      • uuidstringmaxLength 500

        The widget's identifier on the dashboard. A widget of the catalog that is not on the dashboard has none, and the agent identifies it by its widget_id.

      • originstringmaxLength 500

        The name of the backend that serves the widget.

      • widget_idstringmaxLength 500

        The widget's id in its backend.

      • namestringmaxLength 2000

        What the model reads to choose a widget.

      • descriptionstringmaxLength 50000

        What the model reads to choose a widget.

      • widget_typestring | null

        The kind of widget, for example markdown, html or iframe.

      • paramsmap<string, any>[]maxItems 1000

        The widget's parameters. Each has a name, a type, a description, a default_value, a current_value, a list of options and multi_select.

      • columnsstring[] | null

        The column names of the rows that a widget on the dashboard has loaded.

      • categorystringmaxLength 500

        What the model reads to choose a widget.

      • sub_categorystringmaxLength 500

        What the model reads to choose a widget.

      • sourcestring | null

        Free-form details about the widget.

      • metadatamap<string, any>

        Free-form details about the widget. For a widget on the dashboard, it holds lastUpdated, the time of its last update in milliseconds since 1970.

      • mcp_toolobject

        A link from the widget to an MCP tool.

        3 nested properties
        • server_idstringrequiredmaxLength 500

          The id of the MCP server that has the tool.

        • tool_namestringrequiredmaxLength 500

          The name of the tool on that server.

        • argsmap<string, string | number | boolean>property names: maxLength 200

          The arguments that the tool receives, by name.

    • extramap<string, any>[]maxItems 20000

      The rest of the catalog.

      13 nested properties
      • uuidstringmaxLength 500

        The widget's identifier on the dashboard. A widget of the catalog that is not on the dashboard has none, and the agent identifies it by its widget_id.

      • originstringmaxLength 500

        The name of the backend that serves the widget.

      • widget_idstringmaxLength 500

        The widget's id in its backend.

      • namestringmaxLength 2000

        What the model reads to choose a widget.

      • descriptionstringmaxLength 50000

        What the model reads to choose a widget.

      • widget_typestring | null

        The kind of widget, for example markdown, html or iframe.

      • paramsmap<string, any>[]maxItems 1000

        The widget's parameters. Each has a name, a type, a description, a default_value, a current_value, a list of options and multi_select.

      • columnsstring[] | null

        The column names of the rows that a widget on the dashboard has loaded.

      • categorystringmaxLength 500

        What the model reads to choose a widget.

      • sub_categorystringmaxLength 500

        What the model reads to choose a widget.

      • sourcestring | null

        Free-form details about the widget.

      • metadatamap<string, any>

        Free-form details about the widget. For a widget on the dashboard, it holds lastUpdated, the time of its last update in milliseconds since 1970.

      • mcp_toolobject

        A link from the widget to an MCP tool.

        3 nested properties
        • server_idstringrequiredmaxLength 500

          The id of the MCP server that has the tool.

        • tool_namestringrequiredmaxLength 500

          The name of the tool on that server.

        • argsmap<string, string | number | boolean>property names: maxLength 200

          The arguments that the tool receives, by name.

  • contextany

    Items that the user attached, such as artifacts of earlier answers. A list has at most 500 items.

  • urlsstring[]maxItems 8

    Web addresses that appeared in the user's message. The agent fetches them for the model unless an administrator turned the web tools off.

  • timezonestringmaxLength 100

    The user's time zone, such as Europe/Paris.

  • workspace_stateany

    Where the user is: the current page, dashboard and tab, and the recent actions. The agent ignores a value that does not have this shape.

  • workspace_optionsmap<string, boolean | string>property names: maxLength 100

    The settings that the user picked from the features of the descriptor, as an object of names to booleans or strings. At most 100 keys.

  • skills_catalogobject[]maxItems 500

    The skills in the user's library.

    3 nested properties
    • slugstringrequiredmaxLength 200

      The slug of the skill.

    • descriptionstringrequiredmaxLength 4000

      What the skill is for.

    • updatedAtstringmaxLength 100

      When the skill was last changed.

  • plugin_artifactsobject[]maxItems 100

    The artifacts that the plugins of the organization offer the agent, each with the data it may fill in.

    6 nested properties
    • pluginstringrequiredmaxLength 100

      The id of the plugin that offers the artifact.

    • widgetstringrequiredmaxLength 100

      The id of the widget the artifact is.

    • namestringrequiredmaxLength 500

      The name the artifact is shown under.

    • descriptionstringrequiredmaxLength 4000

      What the artifact holds and when it is useful.

    • data_schemamap<string, any>required

      The JSON Schema of the data the artifact holds.

    • config_schemamap<string, any>

      The JSON Schema of the settings the user picks for the artifact, when it has any.

  • selected_skillsobject[]maxItems 20

    Skills that the user forced with a slash command, or that the model selected. The user's own skills carry contentMarkdown.

    4 nested properties
    • slugstringrequiredmaxLength 200

      The slug of the skill.

    • descriptionstringrequiredmaxLength 4000

      What the skill is for.

    • contentMarkdownstringmaxLength 500000

      The text of the skill. The user's own skills carry it.

    • source"forced_slash" | "model_selected"required

      Whether the user forced the skill with a slash command or the model selected it.

  • toolsobject[]maxItems 500

    The tools of the MCP servers that the user connected, which the agent may ask the browser to run.

    6 nested properties
    • namestringrequiredmaxLength 500

      The name that the agent uses for the tool, which joins the server's name and the tool's name.

    • tool_namestringmaxLength 500

      The name that the server knows.

    • server_idstringrequiredmaxLength 500

      The id of the MCP server.

    • urlstringrequiredmaxLength 4000

      The address of the MCP server.

    • descriptionstringmaxLength 20000

      What the tool does.

    • input_schemaobject

      The JSON Schema of the tool's arguments.

      2 nested properties
      • propertiesmap<string, map<string, any>>

        The schema of each argument, by name.

      • requiredstring[]maxItems 200

        The names of the arguments that a call must have.

  • documentsobject[]maxItems 50

    Files sent inline. The agent accepts them but treats the field as deprecated, because the web app sends a file as a widget in widgets.primary instead. Each needs content_b64 or url.

    5 nested properties
    • idstringrequiredmaxLength 200

      The id of the document.

    • namestringrequiredmaxLength 500

      The file name.

    • formatenumrequired

      The format of the file.

      One of"pdf""docx""txt""md""html"
    • content_b64stringmaxLength 35000000

      The content of the file, in base64. A document has this or url.

    • urlstringmaxLength 4000

      The link of the file. A document has this or content_b64.

Responses

  • 200The stream of events that answers the question.string
  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 503The agent is busy and cannot take the request now.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

generate​

These are the helper routes, which make one call to the model and never run tools. They need a token. Helper routes explains what each of them does with the request.

POST/v1/enhance_prompt​

Rewrites a question to be more specific.

Rewrites the last question of the user so that it names the data that it needs. The agent makes one call to the model and never runs tools.

needs a token

Request body

application/jsonEnhancePromptRequestrequired
EnhancePromptRequest
  • messagesany[]requiredminItems 1maxItems 1000

    The conversation. The agent rewrites the last message that has the role human and a text as its content.

  • widgetsany

    The widgets in the tiers primary, secondary and extra, as in a query. The agent uses their names as hints.

  • contextany

    Accepted and not used.

  • urlsstring[]

    Accepted and not used.

  • workspace_stateany

    Accepted and not used.

  • workspace_optionsmap<string, boolean | string>

    Accepted and not used.

  • timezonestring

    Accepted and not used.

  • toolsany[]

    Accepted and not used.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Responses

  • 200The rewritten question, as plain text.string
  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

POST/v1/generate/chat/title​

Names a chat.

Names the chat that the messages belong to. The agent makes one call to the model and never runs tools.

needs a token

Request body

application/jsonChatTitleRequestrequired
ChatTitleRequest
  • messagesany[]requiredminItems 1maxItems 1000

    The conversation. The agent reads the messages that have the role human and a text as their content.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Responses

  • 200The title of the chat, as a JSON string.ChatTitle
    ChatTitle

    The title of the chat.

    This schema has no named properties.

  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

POST/v1/generate/code​

Writes or changes SQL or Python code for a widget.

Writes the code that answers a widget, or changes the code that the widget has. The agent makes one call to the model and never runs tools.

needs a token

Request body

application/jsonGenerateCodeRequestrequired
GenerateCodeRequest
  • widget_uuidstringrequired

    Accepted and not used.

  • user_promptstringrequiredminLength 1maxLength 20000

    What the code should do.

  • current_codestring | null

    The code to change or improve.

  • language"sql" | "python"required

    The language of the code.

  • sql_schemamap<string, any> | null

    The tables and columns that the code may use.

  • data_samplemap<string, any>[] | null

    Rows of the data. The agent reads the first 5.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Responses

  • 200The code that the model wrote, or the reason why it wrote none.GenerateCode
    GenerateCode
    • successbooleanrequired

      Whether the model wrote the code.

    • generated_codestring

      The code that the model wrote.

    • error_messagestring

      Why the model wrote no code.

  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

POST/v1/generate/dashboard/title​

Names a dashboard.

Names the dashboard that the widgets belong to. The agent makes one call to the model and never runs tools.

needs a token

Request body

application/jsonDashboardTitleRequestrequired
DashboardTitleRequest
  • widgetsobject[]requiredminItems 1maxItems 1000

    The widgets of the dashboard.

    4 nested properties
    • uuidstring

      Accepted and not used.

    • namestring

      The widget's name, which the title is made from.

    • descriptionstring

      Accepted and not used.

    • metadataany

      Accepted and not used.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Responses

  • 200The title of the dashboard, as plain text.string
  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

POST/v1/generate/widget_info​

Describes and classifies a widget from a sample of its data.

Tells what a widget shows and which kind of widget it is. The agent makes one call to the model and never runs tools.

needs a token

Request body

application/jsonWidgetInfoRequestrequired
WidgetInfoRequest
  • widget_generation_requestobjectrequired

    The widget to describe.

    4 nested properties
    • widget_datastringrequired

      A sample of the widget's data, as text.

    • metadataobject

      What the widget's definition says about it. The prompt includes it, and the fallback uses it.

      7 nested properties
      • namestringmaxLength 1000

        The widget's name.

      • descriptionstringmaxLength 1000

        The widget's description.

      • typestringmaxLength 1000

        The widget's type, for example markdown or html.

      • categorystringmaxLength 1000

        The widget's category.

      • subCategorystringmaxLength 1000

        The widget's sub-category.

      • endpointstringmaxLength 1000

        The endpoint that serves the widget.

      • paramsany[]

        Accepted and not used.

    • namestring

      The widget's name, which the fallback uses.

    • descriptionstring

      The widget's description, which the fallback uses.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Responses

  • 200The title, the description, the category and the sub-category of the widget.WidgetInfo
    WidgetInfo
    • titlestringrequired

      The name to show for the widget.

    • descriptionstringrequired

      What the widget shows.

    • categorystringrequired

      The category of the widget, such as Equity or Macro.

    • subcategorystringrequired

      The sub-category of the widget, such as Price History.

  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

POST/v1/generate/widget_info/file​

Describes an uploaded file.

Tells what an uploaded file holds. The agent makes one call to the model and never runs tools.

needs a token

Request body

multipart/form-dataWidgetInfoFileRequestrequired
WidgetInfoFileRequest
  • filestring (binary)required

    The file to describe.

Responses

  • 200The title and the description of the file.WidgetInfoFile
    WidgetInfoFile
    • titlestringrequired

      The name to show for the file.

    • descriptionstringrequired

      What the file holds.

  • 400The body is not JSON, or it does not fit the schema of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

speech​

This route turns a recording into text. It needs a token.

POST/v1/transcribe​

Turns a recording into text.

Turns a recording into text, so that a person can ask the agent a question with their voice.

needs a token

Request body

multipart/form-dataTranscribeRequestrequired
TranscribeRequest
  • audiostring (binary)required

    The recording, a 16-bit PCM WAV file.

Responses

  • 200The text of the recording.Transcription
    Transcription
    • textstringrequired

      The text of the recording.

  • 400The form has no file, or the file is not a 16-bit PCM WAV file.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 401The request carries no agent token, or the token is not valid.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 404This deployment has no speech to text model.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 413The body is larger than the limit of the route.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 429The user has made too many requests.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

  • 502The speech model failed.Error
    Error
    • errorstringrequired

      What went wrong.

    • detailsany[]

      The fields that did not fit the schema, when the request was invalid.

Helper routes​

The helper routes make one call to the model and never run tools. Each user may make AGENT_HELPER_CALLS_PER_MINUTE of these calls a minute, which is 60 by default, and beyond that the route answers 429 with {"error": "Too many requests. Try again in a minute."} and Retry-After: 60. The tokens that a helper call uses are added to the user's usage, but the call does not count as a question. A body that is not JSON receives the status 400 and {"error": "Invalid JSON"}, and a body that does not fit the route's schema receives 400 and {"error": "Invalid request", "details": [...]}.

Every JSON helper accepts the optional field model. The agent uses it when this deployment offers the model and the user's roles allow it, and otherwise it uses DEFAULT_MODEL without reporting an error. When the model call fails, each helper answers with the fallback that its section gives, so that the interface never waits on a failure. The fields of each request come from its schema in the code.

/v1/generate/chat/title​

The agent reads the last 5 messages that have the role human, each cut to 500 characters.

The agent reads the last 5 messages that have the role human, each cut to 500 characters.

Request fields

  • messagesarray of anyrequired1 to 1,000 items

    The conversation. The agent reads the messages that have the role human and a text as their content.

  • modelstringat most 200 characters

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Answer

A JSON string that holds the title, for example "Revenue by region".

Fallback

"New Chat", also when there is no human message.

/v1/generate/dashboard/title​

The agent reads the first 20 widget names, each cut to 100 characters.

The agent reads the first 20 widget names, each cut to 100 characters.

Request fields

  • widgetsarray of objectrequired1 to 1,000 items

    The widgets of the dashboard.

    4 nested properties
    • uuidstring

      Accepted and not used.

    • namestring

      The widget's name, which the title is made from.

    • descriptionstring

      Accepted and not used.

    • metadataany

      Accepted and not used.

  • modelstringat most 200 characters

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Answer

Plain text, the title.

Fallback

My Dashboard, also when no widget has a name.

/v1/enhance_prompt​

The agent rewrites the last human message, cut to 4,000 characters, and uses the names of up to 30 widgets, each cut to 100 characters, as hints.

The agent rewrites the last human message, cut to 4,000 characters, and uses the names of up to 30 widgets, each cut to 100 characters, as hints.

Request fields

  • messagesarray of anyrequired1 to 1,000 items

    The conversation. The agent rewrites the last message that has the role human and a text as its content.

  • widgetsany

    The widgets in the tiers primary, secondary and extra, as in a query. The agent uses their names as hints.

  • contextany

    Accepted and not used.

  • urlsarray of string

    Accepted and not used.

  • workspace_stateany

    Accepted and not used.

  • workspace_optionsobject

    Accepted and not used.

  • timezonestring

    Accepted and not used.

  • toolsarray of any

    Accepted and not used.

  • modelstringat most 200 characters

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Answer

Plain text, the rewritten question.

Fallback

The original question, or an empty string when there is no human message.

/v1/generate/widget_info​

The agent reads the first 3,000 characters of widget_data.

The agent reads the first 3,000 characters of widget_data.

Request fields

  • widget_generation_requestobjectrequired

    The widget to describe.

    4 nested properties
    • widget_datastringrequired

      A sample of the widget's data, as text.

    • metadataobject

      What the widget's definition says about it. The prompt includes it, and the fallback uses it.

    • namestring

      The widget's name, which the fallback uses.

    • descriptionstring

      The widget's description, which the fallback uses.

  • modelstringat most 200 characters

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Answer

A JSON object with title, description, category and subcategory.

Fallback

An object made from the request's own name, description and metadata, with the category Other.

/v1/generate/widget_info/file​

The request is a multipart form with the field file, at most 25 MiB, and the agent reads its first 3,000 characters.

The request is a multipart form with the field file, at most 25 MiB, and the agent reads its first 3,000 characters. A form without the field is answered with 400 and a file that is too large with 413.

Answer

A JSON object with title and description.

Fallback

The file's name without its extension as the title, and the file's name as the description.

/v1/generate/code​

The language is sql or python.

The language is sql or python.

Request fields

  • widget_uuidstringrequired

    Accepted and not used.

  • user_promptstringrequired1 to 20,000 characters

    What the code should do.

  • current_codestring or null

    The code to change or improve.

  • language"sql" | "python"required

    The language of the code.

  • sql_schemaobject or null

    The tables and columns that the code may use.

  • data_samplearray of object or null

    Rows of the data. The agent reads the first 5.

  • modelstringat most 200 characters

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Answer

{"success": true, "generated_code": "..."} or {"success": false, "error_message": "..."}.

Fallback

{"success": false, "error_message": "Code generation failed"}.

Schemas​

The schemas below are the request and the response bodies of the routes above. The agent writes them from the Zod schemas that the handlers validate with, so the fields of a request are the fields that the code accepts.

AgentNotReady​

  • statusstringrequired

    The state of the agent, which is not ready when the Workspace API does not answer.

  • reasonstringrequired

    Why the agent is not ready.

AgentReady​

  • statusstringrequired

    The state of the agent, which is ready when it takes questions.

AgentStatus​

  • statusstringrequired

    The state of the agent, which is ok when it serves requests.

  • timestampstringrequired

    When the answer was made, as a time in ISO 8601.

  • sharedStatebooleanrequired

    Whether the agent keeps its state in Redis, which a deployment with more than one replica needs.

AgentsDescriptor​

The agents that this service offers, each under its id.

The agents that this service offers, each under its id.

This schema has no named properties.

ChatTitle​

The title of the chat.

The title of the chat.

This schema has no named properties.

ChatTitleRequest​

  • messagesany[]requiredminItems 1maxItems 1000

    The conversation. The agent reads the messages that have the role human and a text as their content.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

DashboardTitleRequest​

  • widgetsobject[]requiredminItems 1maxItems 1000

    The widgets of the dashboard.

    4 nested properties
    • uuidstring

      Accepted and not used.

    • namestring

      The widget's name, which the title is made from.

    • descriptionstring

      Accepted and not used.

    • metadataany

      Accepted and not used.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

EnhancePromptRequest​

  • messagesany[]requiredminItems 1maxItems 1000

    The conversation. The agent rewrites the last message that has the role human and a text as its content.

  • widgetsany

    The widgets in the tiers primary, secondary and extra, as in a query. The agent uses their names as hints.

  • contextany

    Accepted and not used.

  • urlsstring[]

    Accepted and not used.

  • workspace_stateany

    Accepted and not used.

  • workspace_optionsmap<string, boolean | string>

    Accepted and not used.

  • timezonestring

    Accepted and not used.

  • toolsany[]

    Accepted and not used.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Error​

  • errorstringrequired

    What went wrong.

  • detailsany[]

    The fields that did not fit the schema, when the request was invalid.

GenerateCode​

  • successbooleanrequired

    Whether the model wrote the code.

  • generated_codestring

    The code that the model wrote.

  • error_messagestring

    Why the model wrote no code.

GenerateCodeRequest​

  • widget_uuidstringrequired

    Accepted and not used.

  • user_promptstringrequiredminLength 1maxLength 20000

    What the code should do.

  • current_codestring | null

    The code to change or improve.

  • language"sql" | "python"required

    The language of the code.

  • sql_schemamap<string, any> | null

    The tables and columns that the code may use.

  • data_samplemap<string, any>[] | null

    Rows of the data. The agent reads the first 5.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

QueryRequest​

  • messagesmap<string, any>[]requiredminItems 1maxItems 20000

    The conversation, oldest first. A message has the role human, ai or tool.

    1 nested property
    • role"human" | "ai" | "tool"required

      Who wrote the message: the user, the agent, or the browser's result for a request of the agent.

  • modelstringmaxLength 200

    Accepted but not used. The agent reads the model from workspace_options.model.

  • widgetsobject

    The widgets that the agent may read, sorted into three tiers: primary, secondary and extra.

    3 nested properties
    • primarymap<string, any>[]maxItems 20000

      The widgets that the user selected or mentioned.

      13 nested properties
      • uuidstringmaxLength 500

        The widget's identifier on the dashboard. A widget of the catalog that is not on the dashboard has none, and the agent identifies it by its widget_id.

      • originstringmaxLength 500

        The name of the backend that serves the widget.

      • widget_idstringmaxLength 500

        The widget's id in its backend.

      • namestringmaxLength 2000

        What the model reads to choose a widget.

      • descriptionstringmaxLength 50000

        What the model reads to choose a widget.

      • widget_typestring | null

        The kind of widget, for example markdown, html or iframe.

      • paramsmap<string, any>[]maxItems 1000

        The widget's parameters. Each has a name, a type, a description, a default_value, a current_value, a list of options and multi_select.

      • columnsstring[] | null

        The column names of the rows that a widget on the dashboard has loaded.

      • categorystringmaxLength 500

        What the model reads to choose a widget.

      • sub_categorystringmaxLength 500

        What the model reads to choose a widget.

      • sourcestring | null

        Free-form details about the widget.

      • metadatamap<string, any>

        Free-form details about the widget. For a widget on the dashboard, it holds lastUpdated, the time of its last update in milliseconds since 1970.

      • mcp_toolobject

        A link from the widget to an MCP tool.

        3 nested properties
        • server_idstringrequiredmaxLength 500

          The id of the MCP server that has the tool.

        • tool_namestringrequiredmaxLength 500

          The name of the tool on that server.

        • argsmap<string, string | number | boolean>property names: maxLength 200

          The arguments that the tool receives, by name.

    • secondarymap<string, any>[]maxItems 20000

      The other widgets of the dashboard.

      13 nested properties
      • uuidstringmaxLength 500

        The widget's identifier on the dashboard. A widget of the catalog that is not on the dashboard has none, and the agent identifies it by its widget_id.

      • originstringmaxLength 500

        The name of the backend that serves the widget.

      • widget_idstringmaxLength 500

        The widget's id in its backend.

      • namestringmaxLength 2000

        What the model reads to choose a widget.

      • descriptionstringmaxLength 50000

        What the model reads to choose a widget.

      • widget_typestring | null

        The kind of widget, for example markdown, html or iframe.

      • paramsmap<string, any>[]maxItems 1000

        The widget's parameters. Each has a name, a type, a description, a default_value, a current_value, a list of options and multi_select.

      • columnsstring[] | null

        The column names of the rows that a widget on the dashboard has loaded.

      • categorystringmaxLength 500

        What the model reads to choose a widget.

      • sub_categorystringmaxLength 500

        What the model reads to choose a widget.

      • sourcestring | null

        Free-form details about the widget.

      • metadatamap<string, any>

        Free-form details about the widget. For a widget on the dashboard, it holds lastUpdated, the time of its last update in milliseconds since 1970.

      • mcp_toolobject

        A link from the widget to an MCP tool.

        3 nested properties
        • server_idstringrequiredmaxLength 500

          The id of the MCP server that has the tool.

        • tool_namestringrequiredmaxLength 500

          The name of the tool on that server.

        • argsmap<string, string | number | boolean>property names: maxLength 200

          The arguments that the tool receives, by name.

    • extramap<string, any>[]maxItems 20000

      The rest of the catalog.

      13 nested properties
      • uuidstringmaxLength 500

        The widget's identifier on the dashboard. A widget of the catalog that is not on the dashboard has none, and the agent identifies it by its widget_id.

      • originstringmaxLength 500

        The name of the backend that serves the widget.

      • widget_idstringmaxLength 500

        The widget's id in its backend.

      • namestringmaxLength 2000

        What the model reads to choose a widget.

      • descriptionstringmaxLength 50000

        What the model reads to choose a widget.

      • widget_typestring | null

        The kind of widget, for example markdown, html or iframe.

      • paramsmap<string, any>[]maxItems 1000

        The widget's parameters. Each has a name, a type, a description, a default_value, a current_value, a list of options and multi_select.

      • columnsstring[] | null

        The column names of the rows that a widget on the dashboard has loaded.

      • categorystringmaxLength 500

        What the model reads to choose a widget.

      • sub_categorystringmaxLength 500

        What the model reads to choose a widget.

      • sourcestring | null

        Free-form details about the widget.

      • metadatamap<string, any>

        Free-form details about the widget. For a widget on the dashboard, it holds lastUpdated, the time of its last update in milliseconds since 1970.

      • mcp_toolobject

        A link from the widget to an MCP tool.

        3 nested properties
        • server_idstringrequiredmaxLength 500

          The id of the MCP server that has the tool.

        • tool_namestringrequiredmaxLength 500

          The name of the tool on that server.

        • argsmap<string, string | number | boolean>property names: maxLength 200

          The arguments that the tool receives, by name.

  • contextany

    Items that the user attached, such as artifacts of earlier answers. A list has at most 500 items.

  • urlsstring[]maxItems 8

    Web addresses that appeared in the user's message. The agent fetches them for the model unless an administrator turned the web tools off.

  • timezonestringmaxLength 100

    The user's time zone, such as Europe/Paris.

  • workspace_stateany

    Where the user is: the current page, dashboard and tab, and the recent actions. The agent ignores a value that does not have this shape.

  • workspace_optionsmap<string, boolean | string>property names: maxLength 100

    The settings that the user picked from the features of the descriptor, as an object of names to booleans or strings. At most 100 keys.

  • skills_catalogobject[]maxItems 500

    The skills in the user's library.

    3 nested properties
    • slugstringrequiredmaxLength 200

      The slug of the skill.

    • descriptionstringrequiredmaxLength 4000

      What the skill is for.

    • updatedAtstringmaxLength 100

      When the skill was last changed.

  • plugin_artifactsobject[]maxItems 100

    The artifacts that the plugins of the organization offer the agent, each with the data it may fill in.

    6 nested properties
    • pluginstringrequiredmaxLength 100

      The id of the plugin that offers the artifact.

    • widgetstringrequiredmaxLength 100

      The id of the widget the artifact is.

    • namestringrequiredmaxLength 500

      The name the artifact is shown under.

    • descriptionstringrequiredmaxLength 4000

      What the artifact holds and when it is useful.

    • data_schemamap<string, any>required

      The JSON Schema of the data the artifact holds.

    • config_schemamap<string, any>

      The JSON Schema of the settings the user picks for the artifact, when it has any.

  • selected_skillsobject[]maxItems 20

    Skills that the user forced with a slash command, or that the model selected. The user's own skills carry contentMarkdown.

    4 nested properties
    • slugstringrequiredmaxLength 200

      The slug of the skill.

    • descriptionstringrequiredmaxLength 4000

      What the skill is for.

    • contentMarkdownstringmaxLength 500000

      The text of the skill. The user's own skills carry it.

    • source"forced_slash" | "model_selected"required

      Whether the user forced the skill with a slash command or the model selected it.

  • toolsobject[]maxItems 500

    The tools of the MCP servers that the user connected, which the agent may ask the browser to run.

    6 nested properties
    • namestringrequiredmaxLength 500

      The name that the agent uses for the tool, which joins the server's name and the tool's name.

    • tool_namestringmaxLength 500

      The name that the server knows.

    • server_idstringrequiredmaxLength 500

      The id of the MCP server.

    • urlstringrequiredmaxLength 4000

      The address of the MCP server.

    • descriptionstringmaxLength 20000

      What the tool does.

    • input_schemaobject

      The JSON Schema of the tool's arguments.

      2 nested properties
      • propertiesmap<string, map<string, any>>

        The schema of each argument, by name.

      • requiredstring[]maxItems 200

        The names of the arguments that a call must have.

  • documentsobject[]maxItems 50

    Files sent inline. The agent accepts them but treats the field as deprecated, because the web app sends a file as a widget in widgets.primary instead. Each needs content_b64 or url.

    5 nested properties
    • idstringrequiredmaxLength 200

      The id of the document.

    • namestringrequiredmaxLength 500

      The file name.

    • formatenumrequired

      The format of the file.

      One of"pdf""docx""txt""md""html"
    • content_b64stringmaxLength 35000000

      The content of the file, in base64. A document has this or url.

    • urlstringmaxLength 4000

      The link of the file. A document has this or content_b64.

TranscribeRequest​

  • audiostring (binary)required

    The recording, a 16-bit PCM WAV file.

Transcription​

  • textstringrequired

    The text of the recording.

WidgetInfo​

  • titlestringrequired

    The name to show for the widget.

  • descriptionstringrequired

    What the widget shows.

  • categorystringrequired

    The category of the widget, such as Equity or Macro.

  • subcategorystringrequired

    The sub-category of the widget, such as Price History.

WidgetInfoFile​

  • titlestringrequired

    The name to show for the file.

  • descriptionstringrequired

    What the file holds.

WidgetInfoFileRequest​

  • filestring (binary)required

    The file to describe.

WidgetInfoRequest​

  • widget_generation_requestobjectrequired

    The widget to describe.

    4 nested properties
    • widget_datastringrequired

      A sample of the widget's data, as text.

    • metadataobject

      What the widget's definition says about it. The prompt includes it, and the fallback uses it.

      7 nested properties
      • namestringmaxLength 1000

        The widget's name.

      • descriptionstringmaxLength 1000

        The widget's description.

      • typestringmaxLength 1000

        The widget's type, for example markdown or html.

      • categorystringmaxLength 1000

        The widget's category.

      • subCategorystringmaxLength 1000

        The widget's sub-category.

      • endpointstringmaxLength 1000

        The endpoint that serves the widget.

      • paramsany[]

        Accepted and not used.

    • namestring

      The widget's name, which the fallback uses.

    • descriptionstring

      The widget's description, which the fallback uses.

  • modelstringmaxLength 200

    A model to use instead of DEFAULT_MODEL, written <provider>:<model>. The agent uses it only when this deployment offers it and the user's roles allow it.

Speech to text​

POST /v1/transcribe needs the setting AGENT_TRANSCRIBE_MODEL. Without it the route answers 404 with {"error": "Speech to text is not set up for this agent."}, and the descriptor leaves out the feature speech-to-text. The request is a multipart form with the field audio, which must be a 16-bit PCM WAV file of at most 4 MiB. The answer is {"text": "..."}. A recording that is too long receives 413, a file that is not a 16-bit PCM WAV receives 400 and a failure of the speech model receives 502 with {"error": "Speech to text failed. Try again."}.

Metrics​

The agent serves Prometheus metrics from a second listener, so that they never share a port with the API that users reach. The listener answers GET /metrics on the port that AGENT_METRICS_PORT names, which is 9464 by default, and the value 0 turns it off. It does not authenticate requests. The deployment does not publish that port, so a scraper has to reach the pod or the container itself.

Every metric that the agent knows is written from the first scrape, whether anything has happened yet or not. A counter that has not counted reads 0, a histogram that has not been observed writes its buckets as 0, and a metric whose labels have their values has a series for each of them. A label whose values are listed takes only those values, and a value outside them is refused and counted in agent_metric_label_violations_total, so the tables below cannot drift from the code without the agent saying so. A label that has no values takes any value, and every metric keeps at most 500 series, so a stray label cannot grow the output without end. The metrics never carry a label that comes from a user, a chat or text that a model wrote.

The tables below are generated from the definitions in agent/src/lib/metrics.ts, which is where the agent registers the metrics, and they are grouped by the part of the agent that each one counts.

The requests of the API

What the API of the agent received and how long it took to answer.

MetricTypeLabelsWhat it counts
agent_http_requests_totalcounter
  • route
  • method
  • status
HTTP requests by route, method and status.
agent_http_request_duration_secondshistogram
  • route
  • method
Time until an HTTP request is answered (for a stream, until it starts).

The questions of the users

The questions that the agent answered, how they ended and the ones that it is answering now.

MetricTypeLabelsWhat it counts
agent_query_duration_secondshistogram
  • outcome: completed, continued, limit, denied, busy, invalid, error, aborted
Time a Copilot query takes, until its last event is sent, by outcome.
agent_queries_totalcounter
  • outcome: completed, continued, limit, denied, busy, invalid, error, aborted
Copilot queries by outcome. A query that ends by asking the browser for something is continued, and one whose client left is aborted.
agent_active_queriesgaugenoneQueries being answered right now.

The models

The calls that the agent made to a model, the tokens that they used and the ones that failed.

MetricTypeLabelsWhat it counts
agent_model_tokens_totalcounter
  • direction: input, output
Model tokens used, by direction.
agent_model_errors_totalcounter
  • provider
Model calls that failed, by provider.
agent_model_calls_totalcounter
  • provider
Calls made to a model (one for each step of a question), by provider.

The helpers

The short requests that the Workspace makes to the agent, such as a title for a chat.

MetricTypeLabelsWhat it counts
agent_helper_calls_refused_totalcounternoneHelper calls (titles, rewritten prompts, ...) refused because the user made too many in a minute.

The FINOS Workspace

The calls that the agent made to the FINOS Workspace API and the lookups of a signed-in user.

MetricTypeLabelsWhat it counts
agent_workspace_api_requests_totalcounter
  • endpoint
  • outcome: ok, rejected, limit, error
Calls to the FINOS Workspace API by endpoint and outcome.
agent_workspace_api_request_duration_secondshistogram
  • endpoint
Time a call to the FINOS Workspace API takes.
agent_auth_cache_totalcounter
  • result: hit, miss, rejected
Lookups of a signed-in user in the cache, by result.

The agent itself

What the agent ran into: errors, work in a child process, the shared store and reading the earlier part of a chat.

MetricTypeLabelsWhat it counts
agent_metric_label_violations_totalcounter
  • metric
  • label
Label values that a metric refused because the metric does not declare them, by metric and label.
agent_unhandled_errors_totalcounter
  • kind: rejection, exception
Errors that nothing handled, by kind.
agent_isolated_runs_totalcounter
  • kind: ok, failed, timeout, crash, output, busy, protocol
Work run in a child process, by how it ended.
agent_isolated_run_duration_secondshistogram
  • work
How long work run in a child process took, by kind of work.
agent_store_errors_totalcounter
  • op
Times the shared store could not answer and this process answered instead, by operation. Steadily above zero means quotas and turns are being counted per replica.
agent_conversation_recalls_totalcounter
  • mode: latest, words, numbers
Times the model read the earlier part of a chat, by how: the latest messages, a search by words, or numbered messages.

The tools of the MCP server

Only the process of the MCP server updates these, and it serves them on its own port.

MetricTypeLabelsWhat it counts
agent_mcp_tool_calls_totalcounter
  • tool
  • outcome: ok, error
MCP tool calls by tool and outcome. Only the process of the MCP server updates it.
agent_mcp_tool_duration_secondshistogram
  • tool
Time an MCP tool takes. Only the process of the MCP server updates it.

The process

What the process reports about itself: the memory it uses, how long it has run and the version that runs.

MetricTypeLabelsWhat it counts
process_resident_memory_bytesgaugenoneResident memory of the process.
process_uptime_secondsgaugenoneSeconds since the process started.
agent_build_infogauge
  • version
The version that is running. The value is always 1 and the label holds OTEL_SERVICE_VERSION, or dev.

The MCP server serves the same kinds of metrics on MCP_METRICS_PORT, which is 9465 by default, and a value of 0 or less turns them off. It runs in its own process with its own registry, so only it counts the two metrics of the MCP tools; the listener of the agent writes their names but never counts them. The agent also exports traces over OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is set, and it prints them to its log when OTEL_TRACES_CONSOLE is true. Without either setting it creates no spans. The service name is OTEL_SERVICE_NAME, which is agent by default.