Tag Vocabulary

Tags control task routing, prioritization, and filtering in @nolag/agents.

Capability Tags

Capability tags describe what a worker agent can do. When an orchestrator dispatches a task with required capabilities, only workers whose registered capabilities include all of the required tags will receive the task.

// Worker registers capabilities
room.handoff.register({
  capabilities: ["research", "finance", "summarization"],
});

// Orchestrator dispatches with required capabilities
await room.handoff.dispatch({
  type: "analyze-earnings",
  payload: { ticker: "ACME" },
  capabilities: ["research", "finance"],  // Worker must have BOTH tags
});

Common capability tags

TagDescription
researchWeb research, data gathering, source verification
draftingContent creation, report writing, email composition
reviewQuality review, fact-checking, compliance checks
summarizationText summarization, key point extraction
financeFinancial analysis, calculations, reporting
codeCode generation, review, debugging
translationLanguage translation, localization
customer-supportUser queries, issue resolution, FAQ

These are conventions, not enforced values. Use any string that makes sense for your domain.

Priority Tags

Priority tags control the order in which workers process tasks. Workers process higher-priority tasks first when multiple tasks are queued. Workers can also filter which priority levels they accept.

// Dispatch with priority
await room.handoff.dispatch({
  type: "generate-report",
  payload: { ... },
  capabilities: ["drafting"],
  priority: "urgent",  // Workers process urgent tasks first
});

// Workers can filter by priority
room.handoff.register({
  capabilities: ["drafting"],
  priorityFilter: ["urgent", "normal"],  // Ignore "low" priority
});

Standard priority levels

PriorityDescription
urgentProcessed immediately, preempts normal work
normalDefault priority for most tasks
lowBackground work, processed when no higher-priority tasks are queued

Status Tags

Status tags are automatically managed by the Handoff pattern to track task lifecycle. You don't set these directly - they're emitted as events via the Observe pattern.

// Tasks have automatic status tracking
room.observe.on("task:dispatched", (e) => {
  // status: "pending"
});

room.observe.on("task:claimed", (e) => {
  // status: "in_progress"
});

room.observe.on("task:completed", (e) => {
  // status: "completed"
});

room.observe.on("task:failed", (e) => {
  // status: "failed"
});

Task status lifecycle

StatusDescription
pendingTask dispatched, waiting for a worker to claim
in_progressWorker has claimed the task and is processing
completedWorker finished successfully
failedWorker reported an error
timed_outNo worker claimed the task before the timeout

Custom Tags

Beyond capabilities and priorities, you can attach arbitrary key-value tags to both tasks and agents. Custom tags are useful for routing by department, region, confidentiality level, or any other dimension specific to your application.

// Custom tags on tasks
await room.handoff.dispatch({
  type: "review",
  payload: { document },
  capabilities: ["review"],
  tags: {
    department: "legal",
    region: "eu-west",
    confidentiality: "internal",
  },
});

// Custom tags on agents
room.handoff.register({
  capabilities: ["review"],
  tags: {
    department: "legal",
    clearance: "confidential",
  },
});

Custom tag patterns

PatternExampleUse case
Department routingdepartment: "legal"Route tasks to department-specific agents
Region affinityregion: "eu-west"Keep data processing within a geographic region
Tenant isolationtenantId: "acme-corp"Multi-tenant agent systems
Model selectionmodel: "gpt-4"Route to agents running specific LLM models
Confidentialityconfidentiality: "internal"Restrict sensitive tasks to cleared agents