← Docs API Reference
Get an API key →
API ReferenceDirect Tool Execution

Direct Tool Execution

Surface · Direct tools

#Direct Synchronous Tool Execution

Run a known synchronous hosted composition or planning tool with exact JSON arguments. Use this endpoint when your application already knows the tool to call and does not need an LLM round to choose or rewrite the arguments.

POST /v1/creative-agent/tools/execute Auth required

Execute one synchronous composition/planning tool and return its structured payload. Long-lived media generation tools such as generate_image and generate_video are intentionally rejected; use Creative Workflows for exact media steps or Chat Completions when the LLM should interpret a request.

#Body

NameTypeInDescription
tool*stringbodySynchronous hosted tool name. tool_name is accepted as an alias.
arguments*objectbodyExact JSON arguments for the selected tool. Must be an object.
token_typestringbodyspark, sogni, or auto. The camelCase alias tokenType is accepted.
app_sourcestringbody/headerOptional caller label (max 128 chars). X-App-Source header accepted.

#Supported tools

ToolUse
enhance_promptExpand or adapt rough prompts into model-ready image, video, music, or edit prompts.
compose_scriptDraft scripts, storyboards, trailers, social shorts, campaign beats, or video prompts.
compose_lyricsWrite vocal song lyrics and suggested musical parameters.
compose_instrumentalWrite instrumental structure and suggested musical parameters.
compose_workflowCompile a creative brief into a durable workflow input plan and cost estimate.
compose_workflow_templateDraft or edit a parameterized workflow template plus an example plan.
$ curl https://api.sogni.ai/v1/creative-agent/tools/execute \
  -H "Authorization: Bearer $SOGNI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tool": "enhance_prompt",
    "arguments": {
      "prompt": "A cinematic portrait of a glass robot",
      "destination_tool": "generate_image"
    },
    "token_type": "spark",
    "app_source": "my-app"
  }'

#Response

{
  "status": "success",
  "data": {
    "toolCallId": "direct_1773353812000",
    "tool": "enhance_prompt",
    "result": {
      "ok": true,
      "success": true,
      "tool": "enhance_prompt",
      "prompt": "Cinematic portrait of a translucent glass robot...",
      "message": "Cinematic portrait of a translucent glass robot..."
    },
    "message": "Cinematic portrait of a translucent glass robot..."
  }
}
Shortcut, not a planner loop. This endpoint executes exactly one supported synchronous tool. It is the efficient path for prompt expansion, script/lyrics composition, and workflow planning when your app already has the selected tool and arguments.