.agents/skills/adk-style/references/visibility.md
Python does not have native access modifiers (like public, private, or package-private). ADK relies on naming conventions and module structure to define visibility boundaries.
.py module files under src/google/adk/ must be private by default (prefixed with _). This is enforced by a pre-commit hook (check-new-py-prefix).__init__.py._task_models.py)._private_method()). Intended only for use within the defining class or module.Since Python lacks true package-private access, we simulate it by:
__init__.py._-prefixed modules for internal implementation details._ modules, but code outside should not.__init__.py is not allowed. You must import from the specific module directly. This helps keep __init__.py minimal and keeps packages as self-contained as possible.__init__.py.__all__: The __init__.py file should define __all__ to explicitly list the symbols that are part of the public API.__init__.py and listed in __all__.# In src/google/adk/agents/llm/task/_task_agent.py (File is private by default)
class TaskAgent: # Public symbol
...
# In src/google/adk/agents/llm/task/__init__.py
from ._task_agent import TaskAgent
__all__ = [
'TaskAgent',
]
# In src/google/adk/agents/llm/task/_task_models.py (Internal file)
class TaskRequest(BaseModel): # Public within the module, but module is private
...
# In src/google/adk/agents/llm/task/__init__.py
# We DO NOT export TaskRequest here if it is only for internal use within the task package.