AI

Run a stateless AI agent with tools

πŸ€– AI Agent with Tool Use

Run an AI agent that autonomously uses built-in tools and external webhooks in a loop until a stop condition is met.

πŸ”§ Built-in Tools (specify names in agent.tools)

  • web_search – real-time web search
  • fetch_url – HTTP fetch any URL
  • run_code – execute code in a sandbox
  • rag_search – search project knowledge base
  • generate_image / edit_image – AI image generation
  • generate_video / image_to_video – AI video generation
  • db_insert/list/get/update/delete – database CRUD operations
  • storage_upload/download/list/delete – file storage operations

Custom webhook tools call your own HTTPS endpoints; each request is signed (Standard Webhooks headers) with the project's webhook signing secret.

πŸ“± Client Tools

  • Define tools executed on the client side (streaming mode only)
  • Tool calls are forwarded in the SSE stream; client sends results back

πŸ“‘ Streaming

  • Set stream: true to receive a Vercel AI SDK data stream (SSE)
  • Includes tool calls and results as they occur in real time
post/api/ai/{project_id}/agent

Request

  • Base URL
    https://core.blink.new
  • URL
    https://core.blink.new/api/ai/{project_id}/agent
  • Auth
    HTTP bearer

Path parameters

project_idstring required
Example:my-project-123

Unique identifier for the project

Request body

streamboolean required

Enable SSE streaming of agent steps and tool calls

promptstring

Single-turn prompt (headless mode). Mutually exclusive with messages.

sandbox_idstring

Optional sandbox ID for sandbox filesystem tools

Example request

{
  "prompt": "Search the web for the latest AI news and summarize the top 3 stories",
  "agent": {
    "model": "google/gemini-3-flash",
    "system": "You are a helpful assistant that can search the web and analyze data.",
    "tools": [
      "web_search",
      "fetch_url"
    ],
    "webhook_tools": [
      {
        "name": "create_ticket",
        "description": "Create a support ticket in the ticketing system",
        "input_schema": {
          "type": "object",
          "properties": {
            "filter": {
              "type": "string"
            }
          }
        },
        "webhook_url": "https://myapp.com/api/agent/tools/create_ticket"
      }
    ],
    "stop_when": [
      {
        "count": 20
      }
    ]
  }
}

Response

Agent execution successful

textstring

Final text output from the agent

finishReason'stop' | 'length' | 'tool-calls' | 'error' | 'content-filter'

Why the agent stopped

Example response

{
  "text": "Based on my research, AI is...",
  "usage": {
    "inputTokens": 150,
    "outputTokens": 300,
    "totalTokens": 450
  },
  "_billing": {
    "model": "anthropic/claude-sonnet-4-20250514",
    "creditsCharged": 2.5,
    "costUSD": 0.625
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.