Skip to content

Conversation

@jpantsjoha
Copy link

Summary

Add comprehensive documentation identifying common agent instruction anti-patterns and providing proven solutions. This guide addresses community-reported issues with HITL (Human-in-the-Loop) patterns and autonomous polling instructions.

Problem Addressed

Based on analysis of GitHub issues #3607, #3645, and #3184, developers are struggling with:

  • Agent instructions that create polling loops, increasing inference costs by ~93%
  • Poor user experience from manual "continue" clicking in HITL scenarios
  • Confusion about when to use different HITL patterns
  • Lack of guidance on proper agent instruction architecture

Key Features

  • Identifies autonomous polling anti-patterns that violate LLM stateless principles
  • Documents Backend Blocking Poll pattern as the proven solution used in ADK framework
  • Provides decision matrix for choosing appropriate HITL approaches
  • Includes validated code examples cross-referenced with ADK codebase samples
  • Covers instruction overloading and separation of concerns best practices

Validation

All patterns and solutions have been validated against:

  • /contributing/samples/human_in_loop/ - Complete HITL example implementation
  • /contributing/samples/human_tool_confirmation/ - Tool confirmation patterns
  • /src/google/adk/tools/long_running_tool.py - Framework-level anti-polling protection
  • /src/google/adk/flows/llm_flows/functions.py - Async execution patterns

Impact

This documentation fills a critical gap identified in community discussions, providing:

  • Cost reduction by preventing inefficient polling patterns
  • Better UX through proper async HITL implementation
  • Clear guidance for developers on instruction best practices
  • Framework alignment with ADK's event-driven architecture

Testing

  • ✅ Markdown syntax validated
  • ✅ Navigation structure updated in mkdocs.yml
  • ✅ Examples cross-referenced with working ADK samples
  • ✅ Links to GitHub issues verified

The guide provides immediately actionable guidance for ADK developers building production agent systems.

Add comprehensive documentation of common agent instruction anti-patterns and their solutions. This guide addresses community-reported issues with HITL (Human-in-the-Loop) patterns and autonomous polling instructions.

Key features:
- Identifies polling anti-patterns that increase costs and degrade UX
- Documents Backend Blocking Poll pattern as proven solution
- Provides decision matrix for choosing correct HITL approach
- Includes working code examples validated against ADK codebase
- Cross-references active GitHub issues (#3607, #3645, #3184)

Based on analysis of examples/ directory and contributing samples,
providing practical guidance for developers building ADK agents.

Resolves community need for HITL pattern documentation identified
in GitHub discussions and issue reports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant