agentbay_session_handoff
Transfer context to the next agent by documenting completed steps, blockers, key decisions, and files modified. Structured handoff ensures continuity and clarity across sessions.
Instructions
Write structured handoff context for the next agent. Includes completed steps, blockers, key decisions, and files modified.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| summary | Yes | Summary of what you accomplished | |
| taskId | No | ||
| nextSteps | No | ||
| completedSteps | No | ||
| blockers | No | ||
| filesModified | No | ||
| keyDecisions | No |
Implementation Reference
- src/index.ts:520-551 (registration)Registration of the 'agentbay_session_handoff' tool via server.tool(), including its Zod schema definition for inputs (projectId, summary, taskId, nextSteps, completedSteps, blockers, filesModified, keyDecisions).
// Tool 23: Session Handoff server.tool( 'agentbay_session_handoff', 'Write structured handoff context for the next agent. Includes completed steps, blockers, key decisions, and files modified.', { projectId: z.string().describe('Project ID'), summary: z.string().describe('Summary of what you accomplished'), taskId: z.string().optional(), nextSteps: z.array(z.string()).optional(), completedSteps: z.array(z.string()).optional(), blockers: z.array(z.object({ description: z.string(), severity: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional(), suggestedFix: z.string().optional(), })).optional(), filesModified: z.array(z.string()).optional(), keyDecisions: z.array(z.object({ decision: z.string(), rationale: z.string(), alternatives: z.array(z.string()).optional(), })).optional(), }, async ({ projectId, ...handoffData }) => { const data = await apiPost(`/api/v1/projects/${projectId}/activity/handoff`, { ...handoffData, context: {}, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Handoff recorded.\nHandoff ID: ${data.handoffId}\n\nNext agent can resume with agentbay_session_resume.` }] }; } ); - src/index.ts:542-550 (handler)Handler function for agentbay_session_handoff: posts handoff data to /api/v1/projects/{projectId}/activity/handoff and returns the handoff ID.
async ({ projectId, ...handoffData }) => { const data = await apiPost(`/api/v1/projects/${projectId}/activity/handoff`, { ...handoffData, context: {}, }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; return { content: [{ type: 'text' as const, text: `Handoff recorded.\nHandoff ID: ${data.handoffId}\n\nNext agent can resume with agentbay_session_resume.` }] }; } ); - src/index.ts:524-541 (schema)Input schema for agentbay_session_handoff using Zod, defining projectId (required string), summary (required string), and optional fields: taskId, nextSteps, completedSteps, blockers (with severity and suggestedFix), filesModified, and keyDecisions (with rationale and alternatives).
{ projectId: z.string().describe('Project ID'), summary: z.string().describe('Summary of what you accomplished'), taskId: z.string().optional(), nextSteps: z.array(z.string()).optional(), completedSteps: z.array(z.string()).optional(), blockers: z.array(z.object({ description: z.string(), severity: z.enum(['LOW', 'MEDIUM', 'HIGH', 'CRITICAL']).optional(), suggestedFix: z.string().optional(), })).optional(), filesModified: z.array(z.string()).optional(), keyDecisions: z.array(z.object({ decision: z.string(), rationale: z.string(), alternatives: z.array(z.string()).optional(), })).optional(), },