38
38
tracer = trace .get_tracer ('gcp.vertex.agent' )
39
39
40
40
BeforeAgentCallback = Callable [[CallbackContext ], Optional [types .Content ]]
41
- """Callback signature that is invoked before the agent run.
42
41
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
- """
50
42
51
43
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
- """
61
44
62
45
63
46
class BaseAgent (BaseModel ):
@@ -101,8 +84,9 @@ class BaseAgent(BaseModel):
101
84
callback_context: MUST be named 'callback_context' (enforced).
102
85
103
86
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.
106
90
"""
107
91
after_agent_callback : Optional [AfterAgentCallback ] = None
108
92
"""Callback signature that is invoked after the agent run.
@@ -111,8 +95,9 @@ class BaseAgent(BaseModel):
111
95
callback_context: MUST be named 'callback_context' (enforced).
112
96
113
97
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.
116
101
"""
117
102
118
103
@final
0 commit comments