Skip to content

DeepSeek search and fetch

Search the web and retrieve Markdown through the existing AgentMQ DeepSeek connection.

Updated View as Markdown

Use an existing deepseek connection in your AgentMQ application. AgentMQ holds the encrypted DeepSeek credentials; the examples need only your AgentMQ authentication token. No connection creation or provider key submission is required.

Existing connection

Setting Configured value
Application ID app_YOUR_APPLICATION_ID
Connection ID deepseek
Connection model Bring your own key (BYOK), enabled
Search capability deepseek.search
Search operation ID svc_YOUR_SEARCH_OPERATION_ID
Fetch capability deepseek.fetch
Fetch operation ID svc_YOUR_FETCH_OPERATION_ID

Replace the placeholder application and operation IDs below with values from your application’s Connections page in the AgentMQ console. Choose the enabled deepseek.search and deepseek.fetch operations on your existing connection. These identifiers do not grant access. Use an amqp_ personal access token belonging to an authorized OWNER or EDITOR, or an authorized Clerk session. See the authentication matrix.

Prepare your shell

Set AGENTMQ_TOKEN locally using your existing AgentMQ personal access token, and replace all three placeholder IDs in the setup block. Keep your token out of source control, shared output, and browser code. Run the following blocks in the same shell:

: "${AGENTMQ_TOKEN:?Set an authorized AgentMQ personal access token locally}"
API_BASE='https://api.agent.mq/v1'
APP_ID='app_YOUR_APPLICATION_ID'
SEARCH_OPERATION_ID='svc_YOUR_SEARCH_OPERATION_ID'
FETCH_OPERATION_ID='svc_YOUR_FETCH_OPERATION_ID'

Confirm the saved connection with this read-only request. It makes no DeepSeek request and returns no credentials:

curl --silent --show-error --fail-with-body --max-time 45 \
  "$API_BASE/applications/$APP_ID/connections?provider=deepseek&omitCatalog=true&page=1&size=10" \
  -H "Authorization: Bearer $AGENTMQ_TOKEN"

Look in connections.results[] for id: "deepseek", enabled: true, the configured dailyLimit, and your enabled search and fetch operation IDs. This authenticated metadata is authoritative for your connection.

Search the web

This request asks for one search result without full page content:

curl --silent --show-error --fail-with-body --max-time 45 \
  -X POST "$API_BASE/applications/$APP_ID/service-invocations/$SEARCH_OPERATION_ID" \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"requestKey":"deepseek-example-search-v1","input":{"query":"DeepSeek API documentation","count":1,"needContent":false}}' \
  --output deepseek-search-receipt.json

The response is an invocation receipt. On state: "SUCCESS", search results are in output.result.results; each result includes its title, URL, snippet, and other provider metadata. Read the saved JSON directly, or use optional jq:

jq '{id, state, results: .output.result.results, providerBilling: .output.providerBilling}' \
  deepseek-search-receipt.json

Fetch a page as Markdown

The fetch operation retrieves the public DeepSeek search guide:

curl --silent --show-error --fail-with-body --max-time 45 \
  -X POST "$API_BASE/applications/$APP_ID/service-invocations/$FETCH_OPERATION_ID" \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"requestKey":"deepseek-example-fetch-v1","input":{"targetUrl":"https://api-docs.deepseek.com/zh-cn/guides/search"}}' \
  --output deepseek-fetch-receipt.json

On success, output.result.title contains the title and output.result.content contains Markdown. Optional extraction:

jq -r 'select(.state == "SUCCESS") | .output.result.content' \
  deepseek-fetch-receipt.json > deepseek-page.md

These examples use the management API: the JSON body contains both requestKey and input. The separate Agent invocation API uses an application-scoped amq_ Agent key, a plain input body, and an Idempotency-Key header. Those credentials and request formats are not interchangeable.

Input reference

AgentMQ accepts the camelCase field names below, even where the underlying DeepSeek API uses snake_case.

Operation Field Accepted value
Search query Required string, 1–128 Unicode characters
Search count Integer from 1 to 50; default 10
Search needContent Boolean; default false
Search originalQuestion Optional string, 1–128 Unicode characters
Search localization Optional valid IP string; defaults to empty. Omit it for these examples.
Fetch targetUrl Required public HTTPS page URL

Fetch rejects private hosts, URL credentials, and sensitive query parameters. Do not send arbitrary request headers or proxy options. See the official DeepSeek search and fetch guide for provider behavior.

Recover a receipt safely

Use one stable requestKey for one intended call. The keys in these examples are deliberately fixed. Preserve the same key and input after a transport failure; use a new key only when you intend a genuinely new call, including a changed query or URL. Do not generate a new key to work around a timeout or UNKNOWN outcome.

First inspect recent invocation metadata if the original response was lost:

curl --silent --show-error --fail-with-body --max-time 45 \
  "$API_BASE/applications/$APP_ID/service-invocations?page=1&size=10" \
  -H "Authorization: Bearer $AGENTMQ_TOKEN"

Use the matching receipt’s id from history or the original response to read it. Set RECEIPT_ID to that value before this block:

: "${RECEIPT_ID:?Set the receipt id from the response or history}"
curl --silent --show-error --fail-with-body --max-time 45 \
  "$API_BASE/applications/$APP_ID/service-invocations/$RECEIPT_ID" \
  -H "Authorization: Bearer $AGENTMQ_TOKEN"

A successful request can still return a receipt whose state needs attention; inspect the JSON state as well as the HTTP status. For UNKNOWN, inspect the existing receipt and follow errors and retries before deciding on another call. The connector makes no automatic provider retries, and these examples use no automatic retry or polling loop.

Save returned content promptly. Full provider results are encrypted and available through the receipt API for one hour; invocation history retains metadata. See receipts and result retention.

Limits and provider charges

Search and fetch share the configured connection’s daily allowance. Application-level request and concurrency limits and shared-credential controls can also apply. Read your current connection allowance from authenticated metadata and review application limits in the console; this guide does not publish any application’s private settings.

Daily accounting resets at 00:00 UTC, which is 08:00 Asia/Taipei. Successful identical inputs can reuse the connection’s five-minute cache without a fresh supplier attempt; fresh attempts consume the centrally enforced allowance.

DeepSeek’s published tariff is CNY 0.005 per successful request, or CNY 5 per 1,000. For an illustrative allowance of 1,000 successful fresh calls each day, the upstream tariff would be about CNY 5/day or CNY 150 over 30 days. This is a pricing example, not a configured account limit. Consult DeepSeek pricing for current terms.

This is a BYOK connection: provider charges belong to your DeepSeek account. A receipt with billing.settledUsdMicros: 0 does not mean the supplier request was free. output.providerBilling.upstreamCurrency and upstreamCostMicros record the upstream tariff; 5000 micros in CNY represents CNY 0.005.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close