> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Suggestions Agent

> Generate chart type and data preparation suggestions from a dataset. Send a GraphConfig and a prompt, receive suggested visualizations.

The response is a Server-Sent Events (SSE) stream with progress, complete, and error events.


Generate chart type and data preparation suggestions from a dataset. Send a `GraphConfig` and a prompt, receive suggested visualizations via Server-Sent Events.

## Request body

Besides `config`, `userPrompt`, and optional `metadata`, you may send **`maxSuggestionCount`** (integer **1–4**). When set, it is communicated to the model as the target maximum number of suggestions. The stream is not validated or truncated to that count if the model returns more.

## Response

The response is a Server-Sent Events stream. See [SSE Format](/agents/rest/sse) for parsing details.

```text theme={null}
event: progress
data: {"message":"Generating suggestions..."}

event: complete
data: {"suggestions":[{"dataPrepPrompt":"...","chartType":"line","summary":"Monthly sales trend"}]}
```

**Final response data:**

```typescript theme={null}
interface SuggestionsResponse {
  suggestions: Suggestion[];
}

interface Suggestion {
  dataPrepPrompt: string;
  chartType: AiChartType;
  summary: string;
}
```

## HTTP Status Codes

| Status | Description                |
| ------ | -------------------------- |
| 200    | Success (stream begins)    |
| 400    | Invalid request body       |
| 401    | Invalid or missing API key |
| 429    | Rate limit exceeded        |
| 500    | Internal server error      |

Errors may also arrive as SSE events within a 200 response. See [Error Codes](/agents/rest/errors).


## OpenAPI

````yaml POST /api/v0/suggestions
openapi: 3.1.0
info:
  title: Graphy AI Agents API
  version: 0.1.0
  description: AI-powered chart generation and modification API
servers:
  - url: https://agents.graphy.dev
    description: Production
security:
  - bearerAuth: []
paths:
  /api/v0/suggestions:
    post:
      tags:
        - Agents
      summary: Suggestions Agent
      description: >
        Generate chart type and data preparation suggestions from a dataset.
        Send a GraphConfig and a prompt, receive suggested visualizations.


        The response is a Server-Sent Events (SSE) stream with progress,
        complete, and error events.
      operationId: generateSuggestions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SuggestionsRequest'
            example:
              config:
                type: column
                data:
                  columns:
                    - key: month
                      label: Month
                    - key: sales
                      label: Sales
                    - key: region
                      label: Region
                  rows:
                    - month: Jan
                      sales: 100
                      region: North
                    - month: Feb
                      sales: 120
                      region: South
                    - month: Mar
                      sales: 115
                      region: North
              userPrompt: Show me interesting trends
              metadata:
                callId: req-67890
                locale: EN_US
      responses:
        '200':
          description: SSE stream with progress and completion events
          content:
            text/event-stream:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ProgressEvent'
                  - $ref: '#/components/schemas/SuggestionsCompleteEvent'
                  - $ref: '#/components/schemas/ErrorEvent'
        '400':
          description: Bad Request - Invalid request body
        '401':
          description: Unauthorized - Invalid or missing API key
components:
  schemas:
    SuggestionsRequest:
      type: object
      properties:
        config:
          $ref: '#/components/schemas/GraphConfig'
        userPrompt:
          type: string
          maxLength: 10000
          description: Natural language description of what to visualize
        metadata:
          $ref: '#/components/schemas/Metadata'
        maxSuggestionCount:
          type: integer
          minimum: 1
          maximum: 4
          description: >-
            Optional upper bound (1–4) communicated to the model for how many
            suggestions to aim for. The response is not truncated; the model may
            still return more items.
      required:
        - config
        - userPrompt
    ProgressEvent:
      title: Progress event
      description: SSE event name is "progress"
      type: object
      properties:
        message:
          type: string
    SuggestionsCompleteEvent:
      title: Suggestions complete event
      description: SSE event name is "complete"
      type: object
      properties:
        suggestions:
          type: array
          items:
            $ref: '#/components/schemas/Suggestion'
    ErrorEvent:
      title: Error event
      description: SSE event name is "error"
      type: object
      properties:
        message:
          type: string
    GraphConfig:
      type: object
      description: >-
        The graph configuration object used to render charts. See [Graph Config
        Schema](/sdk/reference/graph-config) for the complete reference.
      properties:
        type:
          type: string
          enum:
            - line
            - areaStacked
            - bar
            - groupedBar
            - stackedBar
            - 100StackedBar
            - column
            - groupedColumn
            - stackedColumn
            - 100StackedColumn
            - combo
            - pie
            - donut
            - funnel
            - heatmap
            - scatter
            - bubble
            - waterfall
            - table
            - mekko
          description: The chart type
        data:
          type: object
          properties:
            columns:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                  label:
                    type: string
            rows:
              type: array
              items:
                type: object
                additionalProperties: true
      required:
        - type
        - data
    Metadata:
      type: object
      description: Optional tracking information for requests
      properties:
        callId:
          type: string
          description: >-
            Required when metadata is provided. Unique identifier for tracking
            and debugging.
        locale:
          type: string
          enum:
            - EN_GB
            - EN_US
            - AR
            - PT_PT
          description: Locale for responses
        effort:
          type: string
          enum:
            - low
            - medium
            - high
          description: >-
            Preferred invocation tier; forwarded on the invocation (including
            nested agents). When omitted, it can be inferred from
            `storytellingEffort` or defaults to `medium`.
        storytellingEffort:
          type: string
          enum:
            - none
            - low
            - medium
            - high
          description: >-
            Deprecated. Prefer `effort`. When set without `effort`, the server
            derives `effort` for propagation. For chart generation, an explicit
            value still controls narrative richness when both `effort` and
            `storytellingEffort` are present (`storytellingEffort` wins for the
            chart).
      required:
        - callId
    Suggestion:
      type: object
      properties:
        dataPrepPrompt:
          type: string
          description: Prompt describing how to prepare the data for this chart
        chartType:
          type: string
          enum:
            - line
            - areaStacked
            - bar
            - groupedBar
            - stackedBar
            - 100StackedBar
            - column
            - groupedColumn
            - stackedColumn
            - 100StackedColumn
            - combo
            - pie
            - donut
            - funnel
            - heatmap
            - scatter
            - bubble
            - waterfall
            - table
            - mekko
          description: Suggested chart type
        summary:
          type: string
          description: Short description of what the chart would show
      required:
        - dataPrepPrompt
        - chartType
        - summary
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your Graphy API key (starts with graphy_). Create one in the Graphy
        console at https://agents.graphy.dev/console/

````