You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by AndresPrez May 2, 2025
Is your feature request related to a problem? Please describe.
In our use case, we need to allow customers to configure and customize AI agents through a user interface without editing source code. Currently, the Agent Development Kit (ADK) does not support serialization of agents, which makes it difficult to persist user-created agents and reload them across sessions or environments. This leads to unnecessary complexity and technical overhead, especially in customer-facing scenarios where non-developers need to customize agent behavior.
Describe the solution you'd like
I'd like to see native support in the ADK for serializing and deserializing agents (e.g., saving their configuration/state to JSON or another format and rehydrating them later). Ideally, this would include:
A method like agent.serialize() that outputs a storable, structured representation of the agent and its components.
A corresponding Agent.deserialize(serialized_data) method to restore the agent.
Support for commonly configurable elements like goals, tools, memory, and workflow parameters.
Describe alternatives you've considered
We’ve explored storing parts of the agent configuration in a relational database—such as metadata, low-level parameters like temperature, and portions of the prompt or instructions. However, this approach becomes fragmented and difficult to scale, as it requires custom logic to reconstruct the agent from disparate fields. It also lacks a standardized way to persist the full agent definition or behavior in a way that integrates cleanly with the ADK runtime.
Additional context
Serialization is especially critical for production-grade use cases where agents are managed via UIs or APIs rather than code. This feature would greatly enhance usability and adoption in enterprise settings.
The text was updated successfully, but these errors were encountered:
We need agent.serialize() + Agent.deserialize(data) to save/load all config (name, description, tools, memory, model settings, sub‑agents) but skip runtime bits (callbacks, contexts).
What I’ve done so far
Scanned src/google/adk/agents/*.py, especially BaseAgent and LlmAgent, to list every field.
Noted Pydantic usage and existing registries (e.g. LLMRegistry) we can lean on.
High‑level plan
Add a serialization mixin in base_agent.py using model_dump(include/exclude).
Wire up small ToolRegistry/MemoryRegistry helpers for non‑primitive fields.
Handle sub_agents recursively, omitting parent_agent then re‑linking.
Tag payload with "schema_version": 1 and "agent_type".
Testing
Unit: round‑trip serialize→deserialize in test_base_agent.py.
Integration: use an existing fixture (e.g. agent_with_config) to verify behavior after reload.
Quick questions
Any other agent types you want in v1?
Registry vs inline logic, preference?
If you want me to explain my plan in more detail, please let me know that too...
Thanks!
Discussed in #518
Originally posted by AndresPrez May 2, 2025
Is your feature request related to a problem? Please describe.
In our use case, we need to allow customers to configure and customize AI agents through a user interface without editing source code. Currently, the Agent Development Kit (ADK) does not support serialization of agents, which makes it difficult to persist user-created agents and reload them across sessions or environments. This leads to unnecessary complexity and technical overhead, especially in customer-facing scenarios where non-developers need to customize agent behavior.
Describe the solution you'd like
I'd like to see native support in the ADK for serializing and deserializing agents (e.g., saving their configuration/state to JSON or another format and rehydrating them later). Ideally, this would include:
A method like agent.serialize() that outputs a storable, structured representation of the agent and its components.
A corresponding Agent.deserialize(serialized_data) method to restore the agent.
Support for commonly configurable elements like goals, tools, memory, and workflow parameters.
Describe alternatives you've considered
We’ve explored storing parts of the agent configuration in a relational database—such as metadata, low-level parameters like temperature, and portions of the prompt or instructions. However, this approach becomes fragmented and difficult to scale, as it requires custom logic to reconstruct the agent from disparate fields. It also lacks a standardized way to persist the full agent definition or behavior in a way that integrates cleanly with the ADK runtime.
Additional context
Serialization is especially critical for production-grade use cases where agents are managed via UIs or APIs rather than code. This feature would greatly enhance usability and adoption in enterprise settings.
The text was updated successfully, but these errors were encountered: