Repository navigation
Labels
documentationImprovements or additions to documentation
Description
Summary
The TypeScript ADK shipped DefaultBackgroundTaskHandler in typescript-adk#74 (closes typescript-adk#19): an LLM-driven agentic loop with automatic conversation history management, tool calling, configurable iteration cap, and optional usage metadata. Docs need a corresponding section under the TypeScript ADK area.
What to cover
- Class overview:
new DefaultBackgroundTaskHandler({ llmClient, toolBox?, systemPrompt?, maxIterations?, maxConversationHistory? }). - The
LLMClientandToolBoxinterfaces it consumes (note these are structural; concrete impls land via typescript-adk#27 and typescript-adk#31). - The iteration loop: LLM call -> dispatch tool calls -> feed results back -> stop on no-tool-calls (COMPLETED),
input_required(INPUT_REQUIRED), or cap hit (FAILED). MAX_CHAT_COMPLETION_ITERATIONSenv var (default 50) andmaxConversationHistory(default 20).- Reserved
input_requiredtool (prompts are pulled frommessage/prompt/questionarg keys). setEnableUsageMetadata(true)and the shape of the metadata written totask.metadata.- Wiring example:
builder.withBackgroundTaskHandler(handler.asHandler()).
References
- PR: typescript-adk#74
- Originating issue: typescript-adk#19
- Go equivalent:
adk/server/task_handler.goin inference-gateway/adk
Acceptance Criteria
- New page (or section under the TypeScript ADK area) documenting
DefaultBackgroundTaskHandler. - Constructor options table (
llmClient,toolBox,systemPrompt,maxIterations,maxConversationHistory) with defaults. - Iteration loop diagram or numbered walkthrough covering the COMPLETED / INPUT_REQUIRED / FAILED terminal transitions.
- Documented env var:
MAX_CHAT_COMPLETION_ITERATIONS(default 50). - Reserved
input_requiredtool behavior documented, including themessage/prompt/questionarg-key fallback. -
setEnableUsageMetadata(true)documented with the resultingtask.metadatashape (usage,execution_stats). - End-to-end wiring example using
A2AServerBuilder.withBackgroundTaskHandler(handler.asHandler()).
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentation
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon May 27, 2026
@claude Can you document it? use /maintainer
claude commentedon May 27, 2026
Claude finished @edenreich's task in 8m 34s —— View job •
claude/issue-67-20260527-1104• Create PR ➔Task: Document
DefaultBackgroundTaskHandlerin typescript-adkDone. New section landed on
typescript-adk.mdcovering every acceptance-criteria bullet from the issue.Todos
inference-gateway/typescript-adkforDefaultBackgroundTaskHandlerLLMClient,ToolBox), env vars, defaults, metadata shapeDefaultBackgroundTaskHandlerandA2AServerBuilderrows)npm run lint:md(clean) andnpm run format:check(clean afternpm run format)npm run build(clean, mermaid diagram renders, all keywords present in built HTML)02cd35b)What landed
New top-level section
## Background task handler (\DefaultBackgroundTaskHandler`)betweenmessage/streamandParity with the Go ADK, plus matchingWhat ships todayandParity` updates. Sub-sections:llmClient,toolBox,systemPrompt,maxIterations,maxConversationHistory,logger,env) and their defaults.LLMClientandToolBoxinterfaces with the full TypeScript signatures (plusToolDefinition,ToolCall,CompletionResult,CompletionUsage,AssistantMessage,ToolExecutionContext).flowchart TDdiagram plus a numbered walkthrough covering the COMPLETED / INPUT_REQUIRED / FAILED / CANCELLED terminal transitions and the tool-error-as-tool-message recovery behavior.MAX_CHAT_COMPLETION_ITERATIONSenv var (default50) with parse semantics and Go-ADK parity note.input_requiredtool with the fullarguments→ prompt extraction table (message→prompt→questionfallback, non-JSON strings surfaced verbatim, default"Additional input required."), plus a sample tool definition.setEnableUsageMetadata(true)with the JSON shape of the resultingtask.metadata.usageandtask.metadata.execution_statsblocks and edge-case behavior (usage block omitted when no LLMusageever returned; existingmetadatakeys preserved on merge).new A2AServerBuilder().withAgentCard(card).withBackgroundTaskHandler(handler.asHandler()).build()with notes on whyasHandler()is needed.Local verification
npm run lint:md✓npm run format:check✓npm run build✓ (mermaid renders to SVG; 8 mentions ofDefaultBackgroundTaskHandlerin built HTML)| Branch:
claude/issue-67-20260527-1104docs: document DefaultBackgroundTaskHandler in typescript-adk
chore(release): 🔖 0.6.32 [skip ci]