Skip to content

Function: handoff()

ts
function handoff(target, options?): HandoffResponse;

Defined in: packages/core/src/core/response.ts:479

Initiate a federated agent handoff from a tool handler.

The ServerAttachment detects this response and activates the SwarmGateway tunnel to the specified upstream server.

Parameters

ParameterTypeDescription
targetstringTarget server URI (e.g. 'mcp://finance-agent.internal:8080')
options?Omit<HandoffPayload, "target">Carry-over state, system instruction, and tracing hints

Returns

HandoffResponse

Example

typescript
import { f } from '@vurb/core';

export const triage = f.tool('system.triage')
    .withEnum('domain', ['finance', 'devops'])
    .withString('context', 'What the user needs.')
    .handle(async (input) => f.handoff(`mcp://${input.domain}-agent`, {
        carryOverState: { intent: input.context },
        reason: `Triage → ${input.domain}`,
    }));