Skip to main content

TAP workflows

TAP Workflows

TAP tagging now has a TAP-facing tool route, POST /tap/tools/tagging-suggestions, for synchronous suggestions-only calls. The older custom workflow routes remain available for compatibility and tracked-run debugging. The legacy batch tagging and batch caption-update workflows are no longer exported through the generic workflow route registry.

TAP topic detection is an internal completed-conversation workflow. External TAP integration should call the tool route, POST /tap/tools/topic-detection, which runs the workflow synchronously and returns the standard { data } envelope. The generic workflow route remains an internal implementation/testing path. Scheduled polling of TAP conversations is not wired yet.

Route Quick Reference

  • Tagging suggestionsPOST /tap/tools/tagging-suggestions for product-facing sync calls; POST /tap/workflows/tagging-suggestions, plus create-run, start, and runs/{runId} tracked run routes for compatibility/debugging.
  • TAP query compatibility routePOST /tap/workflows/query.
  • TAP query async compatibility routesstart-async, create-run, start, and runs/{runId} are deliberately retired and return 410; use the bounded synchronous route.
  • Content safetyPOST /tap/tools/content-safety for the product tool; the registered generic workflow route is available for internal execution.
  • Topic detectionPOST /tap/tools/topic-detection for the product-facing on-demand classification run; POST /tap/workflows/topic-detection remains an internal workflow route.

loadTapArtifacts() currently registers three agents, three active product tools, and three workflows: TAP content safety, TAP topic detection, and the platform-owned recoveredAnalysisWorkflow compatibility workflow. Tagging and query are supplemental custom routes rather than generic workflow-registry entries.

Tagging Suggestions

The tagging suggestions tool accepts post context and media from TAP and returns suggested tags plus optional captions. It does not call TAP APIs and does not update TAP posts.

The implementation uses:

  • packages/domain-tap/src/routes/tap-tagging-suggestions.routes.ts
  • packages/domain-tap/src/services/tap-tagging-suggestions.service.ts
  • packages/domain-tap/src/agents/tap-caption-tagging-agent.ts

TAP platform auth/write credentials are not required for the tagging suggestions path.

Topic Detection

The topic detection workflow classifies completed or quiet TAP conversations into topic keys from the active taxonomy. It uses local gates and candidate ranking before calling tap-topic-detection-agent.

The workflow supports two analysis modes:

  • fast — sends a compact prompt with conversation context and top candidate topic options.
  • full — sends conversation context, the full taxonomy, and ranked candidates.

Both modes return and persist the same audit data: final topics, message-level findings, evidence message IDs, provider request ID, provider latency, token usage, workflow step timings, raw agent response, and validation errors.

Valid topic-detection requests keep HTTP 200 semantics. Provider rate limits and local provider timeouts are surfaced in the workflow body with status: "failed", classifierStatus: "failed", optional provider diagnostics, and optional retry metadata instead of relying on transport-level failures. Responses also include an inputSummary with message count, context truncation status, included message count, context size, and the configured context limit.

Tagging suggestions also keep HTTP 200 for valid partial results. Failed or skipped media processing is surfaced per result with reason, retryable, and mediaDiagnostics, plus an aggregate summary.

For product-facing dry-run testing, call:

POST /tap/tools/topic-detection

The tool route returns { "data": { ...workflow result... } }.

For internal workflow debugging, call:

POST /tap/workflows/topic-detection

with a flat workflow body containing conversationId, messages, dryRun, and optional analysisMode. The internal sync endpoint returns a wrapper with runId, status, and result.

The implementation uses:

  • packages/domain-tap/src/workflows/tap/topic-detection/topic-detection.workflow.ts
  • packages/domain-tap/src/services/tap-topic-detection.service.ts
  • packages/domain-tap/src/services/tap-topic-detection-persistence.ts
  • packages/domain-tap/src/agents/tap-topic-detection-agent.ts