-
Notifications
You must be signed in to change notification settings - Fork 610
ADK Middleware Integration #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add core ADKAgent class for bridging Google ADK with AG-UI Protocol - Implement event translation between ADK and AG-UI protocols - Add agent registry for managing multiple ADK agents - Include session lifecycle management with configurable timeouts - Create FastAPI integration with SSE streaming support - Add comprehensive test suite with all tests passing - Include example FastAPI server implementation - Support both in-memory and custom service implementations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add app_name as required first parameter to ADKAgent constructor - Implement comprehensive logging system with component-specific loggers - Add 14 comprehensive automated tests with 100% pass rate - Refactor to SessionLifecycleManager singleton for centralized session management - Implement thread-safe event translation with per-session EventTranslator instances - Add proper error handling in HTTP endpoints with specific error types - Implement proper streaming based on ADK finish_reason detection - Add session encapsulation and automatic cleanup with configurable timeouts - Replace deprecated TextMessageChunkEvent with TextMessageContentEvent - Fix critical concurrency issues and session management bugs - Add complete development environment setup with virtual environment support - Update dependency management to use proper package installation - Rename agent_id to app_name throughout session management for consistency 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Update shebangs from #\!/usr/bin/env python3 to #\!/usr/bin/env python in all scripts and tests - Change python3 -m venv commands to python -m venv in documentation and setup scripts - Standardize on 'python' command throughout the project for better compatibility Files updated: - All test files (24 files): Updated shebangs - Shell scripts: quickstart.sh, setup_dev.sh - Documentation: README.md - Examples and utilities: All Python files updated 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove requirement for app_name or app_name_extractor to be specified - Add default behavior that uses agent name from registry as app_name - Update _default_app_extractor to fetch agent name dynamically - Update _get_or_create_runner to accept app_name parameter for dynamic resolution - Add comprehensive test coverage for default app_name behavior - Update examples to demonstrate simplified agent creation without explicit app_name - All 15 tests continue to pass - Update CHANGELOG.md with new functionality BREAKING CHANGES: - ADKAgent no longer requires app_name or app_name_extractor (now optional) - Default behavior automatically uses agent name as app_name 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Move all test_*.py files to tests/ subdirectory - Move run_tests.py to tests/ directory - Update run_tests.py to work from tests directory with proper PYTHONPATH - Fix all import statements in tests to work without hardcoded src. prefix - Update test runner to set PYTHONPATH to include src directory - Fix patch() calls to reference modules without src. prefix - All 15 tests continue to pass after reorganization - Update CHANGELOG.md to reflect test organization improvements 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Mark tool/function calling support as coming soon - Remove manual python-sdk installation step (now via PyPI) - Add required app_name parameter to all ADKAgent examples - Remove unimplemented features from event translation table - Remove State Management and Tool Integration from Advanced Features 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add pytest.ini configuration with proper Python path and async support - Move pytest dependencies to main install_requires for easier setup - Convert test_basic.py to proper pytest format with test functions - Add pytest markers and fixtures to test_text_events.py (maintain backwards compatibility) - Fix test_adk_agent.py for current ADKAgent API and add test isolation - Improve session manager reset to handle closed event loops in pytest - Rename test_server.py to server_setup.py to avoid pytest discovery - Remove deprecated run_tests.py custom test runner Results: All 54 tests now pass with standard pytest commands - pytest: ✅ 54 passed, 0 failed - pytest --cov=src: ✅ 67% code coverage - Async tests work with @pytest.mark.asyncio - Maintains backwards compatibility with existing test functions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…E.md - Remove ADK_Middleware/ directory that was not intended for publication - Remove CLAUDE.md file from repository root - These files are already in .gitignore but were committed by mistake 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Mark event translation as partial (⚠️ ) with "full support coming soon" - Mark state synchronization as not implemented (❌) with "coming soon" - Remove "Comprehensive service integration" line (not planned) - Keep tool/function calling as not implemented (❌) with "coming soon" Provides users with accurate expectations of current capabilities vs planned features. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Create requirements-dev.txt for development dependencies (testing, linting) - Move pytest tools from main requirements to dev extras in setup.py - Update README installation instructions to show dev dependency options - Fix README examples to use correct Agent constructor (not LlmAgent) - Fix ADKAgent constructor examples to use current API parameters - Remove outdated session management parameters from examples - Update service configuration examples to match current implementation All README examples now work with the current codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
### New Features - Add automatic session memory option - expired sessions preserved in ADK memory service - Optional memory_service parameter enables zero-config session history preservation - Comprehensive session memory integration with cleanup, user limits, and manual deletion ### Enhancements - Refactored session management to better leverage ADK's native capabilities - Enhanced SessionManager with streamlined architecture ### Testing - Add 7 comprehensive unit tests for session memory functionality - Total test suite now includes 61 tests (up from 54) - All tests passing with improved coverage ### Dependencies - Update dependency versions in setup.py to match requirements.txt - Bump version to 0.2.0 reflecting significant new functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Replace custom component logger system with standard logging.getLogger() - Remove proprietary logging_config.py module and related complexity - Update all modules (adk_agent, endpoint, event_translator) to follow Python best practices - Remove unnecessary logging test file and interactive configure tool - Update documentation with standard Python logging examples - Maintain all existing functionality while simplifying maintenance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…o app Python needs modules to be organized in their own folders (packages) to import them correctly. By putting your files in a adk_middleware folder, Python can now recognize it as a proper package and allow you to import from it using: from adk_middleware import ADKAgent, AgentRegistry, add_adk_fastapi_endpoint
fix adk_middleware python module and added adk-middleware demo in doj…
- Update README.md: Fix SessionManager import path and class name - Update pytest coverage path to match new module structure - Fix session_manager.py: Use correct attribute name (last_update_time) - Add CLAUDE.md to .gitignore for local documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fix session attribute references from lastUpdateTime to last_update_time - Update tests in test_session_memory.py and test_session_deletion.py - Ensure consistency with session_manager.py implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Fix session attribute references from lastUpdateTime to last_update_time - Update tests in test_session_memory.py and test_session_deletion.py - Ensure consistency with session_manager.py implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove .timestamp() calls on session.last_update_time (already a float) - Update tests to use float timestamps instead of datetime objects - Resolves runtime errors: 'float' object has no attribute 'timestamp' 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This major release implements full tool support enabling AG-UI Protocol tools to execute within Google ADK agents through an advanced asynchronous architecture. ### New Features: - Complete tool execution system with ExecutionState, ClientProxyTool, and ClientProxyToolset - Background execution support via asyncio tasks with proper timeout management - Comprehensive timeout configuration (execution and tool-level) - Concurrent execution limits with automatic cleanup - 138+ comprehensive tests with 100% pass rate (77% code coverage) - Production-ready error handling and resource management ### New Files: - src/adk_middleware/execution_state.py - Manages background ADK execution state - src/adk_middleware/client_proxy_tool.py - Bridges AG-UI tools to ADK tools - src/adk_middleware/client_proxy_toolset.py - Dynamic toolset creation - examples/comprehensive_tool_demo.py - Complete working example - tests/test_*.py - Comprehensive test coverage for all tool features ### Enhanced: - ADK agents now run in background asyncio tasks while client handles tools - Queue-based communication prevents deadlocks - Tool call IDs properly use ADK function call IDs for consistency - Enhanced logging throughout tool execution flow ### Updated Documentation: - README.md with practical tool examples (human-in-the-loop, document generation) - CHANGELOG.md documenting v0.3.0 release - Realistic business scenarios based on dojo patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Feature/tool support
added tool based generative ui demo for ADK in dojo application fixed agent_id in ADKAgent wrapper now we can have multiple adk agents using add_adk_fastapi_endpoint disable the waiting for the tool response in ClientProxyTool if is_long_running is True (for long running task response will be given by the user this is how HITL works in ADK)
Added aiohttp dependency.
Can this be implemented with an ADK plugin(https://github.com/google/adk-python/blob/main/src/google/adk/plugins/base_plugin.py)? |
Hello Teams, I have reviewed and referenced @contextablemark’s implementation (https://github.com/contextablemark/ag-ui). As our company is scheduled to launch the AG-UI frontend and ADK backend features to production at the end of this month, I found that the current implementation has some limitations in flexibility and certain code issues. Therefore, I redesigned parts of the implementation. At the moment, I have not started formal testing, so there may still be some issues in the code. However, I expect to have a usable version within this week, and starting next week, we will need to begin internal E2E testing. This month, I will still be making significant changes to support our company’s internal implementation. You can treat me as a third-party contributor, and I will continue to maintain my version of the project. If there are any issues with the logic or protocol implementation, I would appreciate your feedback. Lastly, I sincerely thank @contextablemark for providing a complete logical implementation, which saved me a lot of time. Once again, thank you. If you have any questions, please feel free to reach out. Thank you all. Project link: https://github.com/DennySORA/adk-agui-py-middleware |
Aspects of it could be, possibly (we're already using agent-level callbacks in some places - see, for example, https://github.com/Contextable/ag-ui/blob/4b3207ce90db7adeb0c91f4b8ba87654a11fb753/typescript-sdk/integrations/adk-middleware/examples/shared_state/agent.py#L164), but it's not immediately clear whether plugins can be used to initiate an agent run in the first place; as comments in the code indicate, "Plugins are best used for adding custom behaviors like logging, monitoring, caching, or modifying requests and responses at key stages." |
@contextablemark, please let us know when you'd like the team to start reviewing your PR. |
Thanks, @DennySORA, for the kind words and I'm glad you found this implementation helpful (though I'm hopeful that you pulled the code from the adk-middleware branch at https://github.com/Contextable/ag-ui rather than https://github.com/contextablemark/ag-ui since the latter is outdated and I've now archived it to avoid confusion). I'll follow your efforts with interest and see whether there's anything I can incorporate, though the code reuse methods will make any direct incorporation of enhancements challenging. Right off the top, I took a look at the Runner caching implemented inside the SSEService and spotted a couple of potential issues, which I've noted in your repo. |
I’m really sorry. I previously asked my supervisor whether it could be open-sourced, and after receiving approval, I was suddenly told today that the company needs to review it. For now, the program will be made private. If the company’s review finds no issues, we will open-source it again. |
|
…event_translator.py Fix parenthetical usage in the message. Co-authored-by: Mark <[email protected]>
…nts.py Fix unnecessary indentation. Co-authored-by: Mark <[email protected]>
…ponse - fix PR comments
… empty instructions
…back fix: support of before_agent_callback in case of a direct content response
…ider fix: support instructions provider for agents
In the interim, the outstanding PRs were resolved. |
Tests were failing after PR #49 changed ADK Event logging from info to debug level. Updated test_event_translator_comprehensive.py to expect the correct log levels: - test_translate_function_calls_detection now checks for debug message in all debug calls - test_event_logging_coverage now looks for "ADK Event:" in debug logs instead of info logs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
fix: update tests to match new logging levels from PR #49
The warnings were appearing during normal operation when sessions were being created or when state updates were attempted before session initialization. These are not actual error conditions but expected behaviors in the async flow. Changed logging level from warning to debug with more descriptive messages to reduce log noise and confusion. Co-Authored-By: Claude <[email protected]>
fix: change misleading 'Session not found' warnings to debug messages
Addresses #54