Skip to content

[DOCS] Document AgentBuilder for the TypeScript ADK #73

Closed

Description

@claude

Summary

The TypeScript ADK (@inference-gateway/adk) shipped a fluent AgentBuilder in typescript-adk#83 (closes typescript-adk#28). It wires an LLM client, tools, callbacks, system prompt, and sampling parameters into an OpenAICompatibleAgent consumable by A2AServerBuilder.withAgent(...), mirroring the Go ADK adk/server/agent_builder.go. typescript-adk.md already covers A2AServerBuilder and DefaultBackgroundTaskHandler but does not yet mention AgentBuilder, so newcomers wiring an LLM-powered handler have no documented path.

The new section should land in typescript-adk.md as a peer of the existing A2AServerBuilder section, with a runnable end-to-end example showing AgentBuilder -> DefaultBackgroundTaskHandler -> A2AServerBuilder.withAgent(). Defaults match the Go ADK verbatim (maxIterations: 50, maxConversationHistory: 20, the system prompt copied byte-for-byte from AgentConfig.SystemPrompt), so the docs should explicitly call that out and link to the Go reference for cross-language consistency.

Acceptance Criteria

  • typescript-adk.md has a new AgentBuilder section (peer of A2AServerBuilder) covering the fluent API and when to reach for it.
  • All builder methods are documented: withProvider, withModel, withTemperature, withTopP, withMaxTokens, withMaxIterations, withSystemPrompt, withMaxConversationHistory, withCallbacks, withToolBox, withLLMClient, build().
  • Required-fields rule is documented: build() throws AgentBuilderError unless (provider + model) are set OR withLLMClient(...) is used; maxIterations and maxConversationHistory must be positive.
  • Defaults are listed and explicitly called out as matching the Go ADK: maxIterations: 50, maxConversationHistory: 20, and the default system prompt (byte-for-byte copy of AgentConfig.SystemPrompt in the Go ADK).
  • A runnable end-to-end example shows AgentBuilder -> OpenAICompatibleAgent -> A2AServerBuilder.withAgent() for a working LLM-backed agent.
  • Callbacks and OpenAICompatibleAgent are briefly introduced (or linked) so the example reads top-to-bottom without forward references.
  • Cross-link to the Go ADK adk/server/agent_builder.go so readers can verify the defaults match across languages.
  • The page frontmatter description is updated to mention AgentBuilder for SEO and the docs site search index.

Activity

  1. added
    documentation
    on May 27, 2026
  2. added theissue type on May 27, 2026
  3. edenreich commented on May 27, 2026

    @edenreich
    Contributor

    @claude Can you document it? use /maintainer

  4. claude commented on May 27, 2026

    @claude
    ContributorAuthor

    Claude finished @edenreich's task in 19m 40s —— View job • claude/issue-73-20260527-1722 • Create PR ➔


    Documenting AgentBuilder for the TypeScript ADK

    • Read existing typescript-adk.md and locate A2AServerBuilder wiring section
    • Fetch AgentBuilder source from inference-gateway/typescript-adk (PR [DOCS] Document HTTP push notification delivery in the TypeScript ADK #83)
    • Cross-reference defaults with Go ADK adk/server/agent_builder.go (50 / 20 / system prompt verbatim - confirmed)
    • Inspect the ai-powered example to see the canonical wiring pattern
    • Draft AgentBuilder section as peer of Background task handler
    • Document all 12 builder methods (withProvider, withModel, withTemperature, withTopP, withMaxTokens, withMaxIterations, withSystemPrompt, withMaxConversationHistory, withCallbacks, withToolBox, withLLMClient, build)
    • Document the build() validation contract and AgentBuilderError
    • Document defaults (maxIterations: 50, maxConversationHistory: 20, byte-for-byte system prompt) with Go ADK parity callout
    • Document OpenAICompatibleAgent accessor surface
    • Document Callbacks lifecycle hooks (beforeAgent / afterAgent / beforeModel / afterModel / beforeTool / afterTool) and CallbackContext
    • Add Bridging to DefaultBackgroundTaskHandler subsection covering the OpenAICompatibleLLMClient -> LLMClient adapter (still required today)
    • Add end-to-end runnable example (AgentBuilder -> OpenAICompatibleAgent -> A2AServerBuilder.withAgent())
    • Update frontmatter description to mention AgentBuilder
    • Update What ships today table to list AgentBuilder
    • Update Parity with the Go ADK section with an AgentBuilder bullet that cross-links adk/server/agent_builder.go
    • Add a cross-link from the existing Wiring into A2AServerBuilder subsection to the new AgentBuilder section
    • npm run lint:md clean
    • npm run format:check clean
    • npm run build succeeds; rendered HTML contains the new section
    • Commit and push to claude/issue-73-20260527-1722

    Summary

    Added a top-level ## Agent builder (AgentBuilder) section to typescript-adk.md, placed after ## Background task handler (DefaultBackgroundTaskHandler) so the reading order goes from the lower-level handler up to the high-level fluent wiring. The section covers every method on the fluent surface (with default, return type, and behavioural notes), the build() validation rules (including the "provider + model" vs "withLLMClient" required-fields choice), defaults that match the Go ADK's AgentConfig byte-for-byte (with the system prompt called out explicitly and linked to adk/server/config/config.go), the OpenAICompatibleAgent accessor surface, the Callbacks lifecycle-hook table with CallbackContext, the OpenAICompatibleLLMClient -> LLMClient adapter required to bridge into DefaultBackgroundTaskHandler today (matching examples/ai-powered/server.ts), and an end-to-end example wiring AgentBuilder -> OpenAICompatibleAgent -> A2AServerBuilder.withAgent() with a real ToolBox, a beforeModel callback, and setEnableUsageMetadata(true).

    Frontmatter description, the What ships today capability table, the Parity with the Go ADK section, and a forward-reference from Wiring into A2AServerBuilder were also updated so the new path is discoverable from every entry point.

    | Branch: claude/issue-73-20260527-1722

  5. added a commit that references this issue on May 27, 2026
    f80311e
  6. moved this from Todo to In progress in 2026on May 27, 2026
  7. moved this from In progress to Done in 2026on May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentation

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions