Reference: PraisonAI PR #4985 — introduces
agent_to_dict / agent_from_dict / team_to_dict and defines AGENT_CONFIG_VERSION = 1.Quick Start
1
Round-trip a tool-less agent
2
Round-trip with tools
How It Works
A tool exports by name because a callable cannot survive JSON, so import re-binds those names through atool_registry.
What gets exported vs. reset
The exporter derives its field set from the liveAgent.__init__ signature, so an attribute that moved into a grouped config never leaks into a config that cannot be imported.
The tools_resolvable flag
Tools export by name because a callable cannot survive JSON, and the flag reports whether every name could be captured.
tools_resolvable is False when a tool has no usable name/__name__ — that config cannot round-trip cleanly, and refusing is safer than silently dropping the tool.
Refusals (fail-loud)
Import refuses loudly rather than rebuilding a subtly-wrong agent.Common Patterns
Diff two team configs
Persist a team to a file, reload it
Hand a Python-built team to the visual builder
When to use team_to_dict vs. agent_to_dict
team_to_dict dumps every member’s config in one call, so reach for it whenever more than one agent is involved.
tasks_included: False value is the caller’s signal that the team had tasks whose graph did not come across.
Known limits (v1)
Best Practices
Always pass tool_registry= when the config declares tools
Always pass tool_registry= when the config declares tools
Import refuses a tools-declaring config without a
tool_registry. That fail-loud path is a feature — it stops you rebuilding a tool-less agent that looks like it chose not to act. Pass tool_registry={name: callable} with every declared tool.Check tools_resolvable before persisting
Check tools_resolvable before persisting
A config with
tools_resolvable=False cannot round-trip its tools. Check the flag right after agent_to_dict and fix the tool’s name before saving the blob.Don't hand-edit the version field
Don't hand-edit the version field
Round-trip only works when
version matches AGENT_CONFIG_VERSION. Leave it alone — it bumps only when the schema changes, and a mismatch refuses on import by design.Use team_to_dict for members, keep task orchestration in code (v1)
Use team_to_dict for members, keep task orchestration in code (v1)
team_to_dict exports every member, but the task graph is not serialised in v1. Keep task wiring in Python until task-graph serialisation lands; tasks_included: False tells you when tasks were dropped.Related
Agent Cloning
Produce a second agent from a first, with isolated state
YAML Configuration Reference
The reverse direction — config file to agent

