Skip to main content
POST
/
tool
/
optimize
/
{toolFunctionName}
Optimize Tool
curl --request POST \
  --url https://api.beamstudio.ai/tool/optimize/{toolFunctionName} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'current-workspace-id: <current-workspace-id>' \
  --data '
{
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "taskNodes": [
    {
      "positive": true,
      "id": "123e4567-e89b-12d3-a456-426614174000",
      "feedback": "The tool extracted most fields correctly but missed the date field",
      "expectedOutput": "[{\"id\":\"123e4567-e89b-12d3-a456-426614174000\",\"paramName\":\"email_id\",\"paramDescription\":\"The unique identifier of the sent email\",\"outputExample\":\"msg_abc123xyz\",\"dataType\":\"string\",\"isArray\":false},{\"id\":\"123e4567-e89b-12d3-a456-426614174001\",\"paramName\":\"recipient\",\"paramDescription\":\"The email address of the recipient\",\"outputExample\":\"[email protected]\",\"dataType\":\"string\",\"isArray\":false}]"
    }
  ],
  "autoUpdateTool": true
}
'
{
  "threadId": "thread_123e4567-e89b-12d3-a456-426614174000"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

current-workspace-id
string
required

Path Parameters

toolFunctionName
string
required

Body

application/json
agentId
string
required

The unique identifier of the agent whose tool is being optimized

Example:

"123e4567-e89b-12d3-a456-426614174000"

taskNodes
object[]

Array of task node execution data with feedback for optimization. Each node represents a tool execution with performance metrics and user feedback to help improve the tool.

autoUpdateTool
boolean
default:false

Whether to automatically update the tool configuration after optimization. When true, the optimized parameters will be applied immediately.

Example:

true

Response

201 - application/json

Tool optimization initiated successfully

threadId
string
required

The unique thread identifier for tracking the optimization process. Use this ID to check the status of the ongoing optimization.

Example:

"thread_123e4567-e89b-12d3-a456-426614174000"