8000 Update description of before/after_agent_callback to clarify the beha… · GeekyprogrammerEJ/adk-python@6595cda · GitHub
[go: up one dir, main page]

Skip to content

Commit 6595cda

Browse files
Jacksunweicopybara-github
authored andcommitted
Update description of before/after_agent_callback to clarify the behavior.
PiperOrigin-RevId: 754207459
1 parent 60d23c0 commit 6595cda

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

src/google/adk/agents/base_agent.py

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,9 @@
3838
tracer = trace.get_tracer('gcp.vertex.agent')
3939

4040
BeforeAgentCallback = Callable[[CallbackContext], Optional[types.Content]]
41-
"""Callback signature that is invoked before the agent run.
4241

43-
Args:
44-
callback_context: MUST be named 'callback_context' (enforced).
45-
46-
Returns:
47-
The content to return to the user. When set, the agent run will be skipped and
48-
the provided content will be returned to user.
49-
"""
5042

5143
AfterAgentCallback = Callable[[CallbackContext], Optional[types.Content]]
52-
"""Callback signature that is invoked after the agent run.
53-
54-
Args:
55-
callback_context: MUST be named 'callback_context' (enforced).
56-
57-
Returns:
58-
The content to return to the user. When set, the provided content will be
59-
appended to event history as agent response.
60-
"""
6144

6245

6346
class BaseAgent(BaseModel):
@@ -101,8 +84,9 @@ class BaseAgent(BaseModel):
10184
callback_context: MUST be named 'callback_context' (enforced).
10285
10386
Returns:
104-
The content to return to the user. When set, the agent run will be skipped
105-
and the provided content will be returned to user.
87+
Optional[types.Content]: The content to return to the user.
88+
When the content is present, the agent run will be skipped and the
89+
provided content will be returned to user.
10690
"""
10791
after_agent_callback: Optional[AfterAgentCallback] = None
10892
"""Callback signature that is invoked after the agent run.
@@ -111,8 +95,9 @@ class BaseAgent(BaseModel):
11195
callback_context: MUST be named 'callback_context' (enforced).
11296
11397
Returns:
114-
The content to return to the user. When set, the provided content will be
115-
appended to event history as agent response.
98+
Optional[types.Content]: The content to return to the user.
99+
When the content is present, the provided content will be used as agent
100+
response and appended to event history as agent response.
116101
"""
117102

118103
@final

0 commit comments

Comments
 (0)
0