MCPcopy Index your code
hub / github.com/google/adk-python / App

Class App

src/google/adk/apps/app.py:53–109  ·  view source on GitHub ↗

Represents an LLM-backed agentic application. An `App` is the top-level container for an agentic system powered by LLMs. It manages either a root agent (`root_agent`) or a root node (`root_node`), which serves as the entry point for execution. Exactly one of `root_agent` or `root_node` mus

Source from the content-addressed store, hash-verified

51
52
53class App(BaseModel):
54 """Represents an LLM-backed agentic application.
55
56 An `App` is the top-level container for an agentic system powered by LLMs.
57 It manages either a root agent (`root_agent`) or a root node (`root_node`),
58 which serves as the entry point for execution.
59
60 Exactly one of `root_agent` or `root_node` must be provided.
61
62 The `plugins` are application-wide components that provide shared capabilities
63 and services to the entire system.
64 """
65
66 model_config = ConfigDict(
67 arbitrary_types_allowed=True,
68 extra="forbid",
69 )
70
71 name: str
72 """The name of the application."""
73
74 # Change to Union[BaseAgent, BaseNode, None] after dependency is fixed.
75 root_agent: Union[BaseAgent, Any, None] = None
76 """The root agent or node in the application.
77
78 Accepts either a BaseAgent or a BaseNode instance.
79 """
80
81 plugins: list[BasePlugin] = Field(default_factory=list)
82 """The plugins in the application."""
83
84 events_compaction_config: Optional[EventsCompactionConfig] = None
85 """The config of event compaction for the application."""
86
87 context_cache_config: Optional[ContextCacheConfig] = None
88 """Context cache configuration that applies to all LLM agents in the app."""
89
90 resumability_config: Optional[ResumabilityConfig] = None
91 """
92 The config of the resumability for the application.
93 If configured, will be applied to all agents in the app.
94 """
95
96 @model_validator(mode="after")
97 def _validate(self) -> App:
98 validate_app_name(self.name)
99 if self.root_agent is None:
100 raise ValueError("root_agent must be provided.")
101
102 from ..workflow._base_node import BaseNode
103
104 if not isinstance(self.root_agent, (BaseAgent, BaseNode)):
105 raise TypeError(
106 "root_agent must be a BaseAgent or BaseNode instance, got"
107 f" {type(self.root_agent).__name__}"
108 )
109 return self

Callers 15

agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
agent.pyFile · 0.90
create_agent_variantFunction · 0.90
agent.pyFile · 0.90

Calls

no outgoing calls