MCPcopy Create free account
hub / github.com/google/adk-python / serialize_app_info

Function serialize_app_info

src/google/adk/cli/utils/graph_serialization.py:253–294  ·  view source on GitHub ↗

Serialize app information for the build_graph endpoint.

(app: Any, readme: str | None = None)

Source from the content-addressed store, hash-verified

251
252
253def serialize_app_info(app: Any, readme: str | None = None) -> dict[str, Any]:
254 """Serialize app information for the build_graph endpoint."""
255 root = app.root_agent
256 try:
257 root_agent_data = serialize_agent(root)
258 except Exception as e:
259 logger.error("Error serializing root agent/node: %s", e, exc_info=True)
260 raise
261
262 app_info = {
263 "name": app.name,
264 "root_agent": root_agent_data,
265 }
266
267 # Add optional fields if present
268 if app.plugins:
269 app_info["plugins"] = [
270 {"name": getattr(plugin, "name", type(plugin).__name__)}
271 for plugin in app.plugins
272 ]
273
274 if app.context_cache_config:
275 try:
276 app_info["context_cache_config"] = app.context_cache_config.model_dump(
277 mode="python", exclude_none=True
278 )
279 except Exception:
280 pass
281
282 if app.resumability_config:
283 try:
284 app_info["resumability_config"] = app.resumability_config.model_dump(
285 mode="python", exclude_none=True
286 )
287 except Exception:
288 pass
289
290 # Include README content if provided
291 if readme:
292 app_info["readme"] = readme
293
294 return app_info

Callers 2

get_app_infoMethod · 0.85
get_app_info_imageMethod · 0.85

Calls 5

serialize_agentFunction · 0.85
getattrFunction · 0.85
typeFunction · 0.85
errorMethod · 0.45
model_dumpMethod · 0.45

Tested by

no test coverage detected