Skip to main content
PUT
/
agent-graphs
/
{agentId}
Update agent and its draft graph
curl --request PUT \
  --url https://api.beamstudio.ai/agent-graphs/{agentId} \
  --header 'Content-Type: application/json' \
  --header 'current-workspace-id: <current-workspace-id>' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "nodes": [
    {
      "id": "d2cbeb35-9110-426c-967a-c0dba38289a9",
      "objective": "Fetch the current Bitcoin price and return it to the user in a friendly format",
      "evaluationCriteria": [
        "The response contains a valid price number",
        "The price is greater than 0"
      ],
      "isEntryNode": true,
      "isExitNode": false,
      "xCoordinate": 116,
      "yCoordinate": 150,
      "isEvaluationEnabled": false,
      "isAttachmentDataPulledIn": true,
      "onError": "STOP",
      "autoRetryWhenAccuracyLessThan": 80,
      "autoRetryLimitWhenAccuracyIsLow": 1,
      "autoRetryCountWhenFailure": 1,
      "autoRetryWaitTimeWhenFailureInMs": 1000,
      "enableAutoRetryWhenAccuracyIsLow": false,
      "enableAutoRetryWhenFailure": false,
      "childEdges": [
        {
          "sourceAgentGraphNodeId": "d2cbeb35-9110-426c-967a-c0dba38289a9",
          "targetAgentGraphNodeId": "22b6aa40-7d7c-449f-b151-0229834b48ba",
          "condition": "price > 50000",
          "name": "Success Path",
          "isAttachmentDataPulledIn": true
        }
      ],
      "parentEdges": [
        {
          "sourceAgentGraphNodeId": "d2cbeb35-9110-426c-967a-c0dba38289a9",
          "targetAgentGraphNodeId": "22b6aa40-7d7c-449f-b151-0229834b48ba",
          "condition": "price > 50000",
          "name": "Success Path",
          "isAttachmentDataPulledIn": true
        }
      ],
      "toolConfiguration": {
        "toolFunctionName": "GPTAction_Custom_BitcoinPriceFetcher_xjUR",
        "toolName": "Bitcoin Price Fetcher",
        "description": "Fetches the current Bitcoin price from CoinGecko API and returns the USD value",
        "requiresConsent": false,
        "isMemoryTool": false,
        "memoryLookupInstruction": "",
        "isBackgroundTool": false,
        "isBatchExecutionEnabled": false,
        "isCodeExecutionEnabled": false,
        "inputParams": [
          {
            "fillType": "ai_fill",
            "position": 0,
            "required": true,
            "dataType": "string",
            "reloadProps": false,
            "remoteOptions": false,
            "paramName": "api_url",
            "paramDescription": "The URL of the API endpoint to call",
            "question": "What API endpoint URL should be used?",
            "linkedOutputParamNodeId": "d2cbeb35-9110-426c-967a-c0dba38289a9",
            "linkedOutputParamName": "bitcoin_price_usd",
            "staticValue": "https://api.example.com/data",
            "outputExample": "https://api.coingecko.com/api/v3/simple/price",
            "options": [
              {
                "label": "United States",
                "value": "US"
              }
            ],
            "paramTip": "Make sure to include the full URL with protocol (https://)"
          }
        ],
        "outputParams": [
          {
            "isArray": false,
            "paramName": "bitcoin_price_usd",
            "position": 0,
            "paramDescription": "The current price of Bitcoin in USD, extracted from the API response",
            "dataType": "number",
            "parentId": null,
            "paramPath": "data.bitcoin.usd",
            "outputExample": "94523.50",
            "typeOptions": {
              "format": "currency",
              "precision": 2
            }
          }
        ],
        "iconSrc": null,
        "accuracyScore": null,
        "preferredModel": "gpt-4o",
        "prompt": "You are a helpful assistant. Given the input parameters, fetch the current Bitcoin price and return it in a user-friendly format."
      }
    }
  ],
  "agentName": "Updated Bitcoin Price Agent",
  "agentDescription": "An improved agent that fetches cryptocurrency prices with better error handling",
  "settings": {
    "prompts": [
      "What is the current Bitcoin price?",
      "Can you fetch the latest cryptocurrency rates?"
    ],
    "agentPersonality": "You are a friendly financial assistant who explains complex topics in simple terms",
    "agentRestrictions": "Do not provide investment advice. Only provide factual price information."
  }
}
'
{
  "draftGraphId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "agentId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "agentName": "My AI Agent"
}

Authorizations

x-api-key
string
header
required

Headers

current-workspace-id
string
required

Path Parameters

agentId
string
required

The ID of the agent to update

Query Parameters

saveAndPublish
boolean

If true, publishes the draft graph as active and creates a new draft. If false (default), only updates the draft.

Body

application/json
nodes
object[]
required

The complete updated list of nodes for the agent graph. This replaces all existing nodes - provide the full node structure including any unchanged nodes

agentName
string

New name for the agent. Leave undefined to keep the current name

Example:

"Updated Bitcoin Price Agent"

agentDescription
string

New description for the agent. Leave undefined to keep the current description

Example:

"An improved agent that fetches cryptocurrency prices with better error handling"

settings
object

Updated configuration settings. Leave undefined to keep current settings

Response

Agent and graph updated successfully (draft only)

draftGraphId
string<uuid>
required

UUID of the draft graph

Example:

"b2c3d4e5-f6a7-8901-bcde-f12345678901"

agentId
string<uuid>
required

UUID of the agent

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

agentName
string
required

Name of the agent

Example:

"My AI Agent"