Legacy Agent Parameters
Move from the 7 deprecated Agent() params to the config-object API
The Agent() constructor still accepts seven older parameters; each has a Config replacement that groups related settings.
from praisonaiagents import Agent, ExecutionConfig
# Old (still works, emits DeprecationWarning)
agent = Agent(name="coder", allow_code_execution=True, code_execution_mode="safe")
# New (preferred)
agent = Agent(
name="coder",
execution=ExecutionConfig(code_execution=True, code_mode="safe"),
)Quick Start
- Find the old params
Scan your code for any of the seven deprecated names:
bash grep -E 'allow_delegation|allow_code_execution|code_execution_mode|auto_save|rate_limiter|verification_hooks|cli_backend|tool_timeout|tool_retry_policy' - Look up the replacement
Match each name to its config object in the migration table below.
- Swap the kwarg for the config object
The behaviour is identical — the config form just groups related settings.
Migration Table
Each deprecated param maps to one config-object replacement.
| Deprecated param | Old default | Replacement (public API) |
|---|---|---|
allow_delegation | False | handoffs=[...] |
allow_code_execution | False | execution=ExecutionConfig(code_execution=True) |
code_execution_mode | "safe" | execution=ExecutionConfig(code_mode="safe") (or "unsafe") |
auto_save | None | memory=MemoryConfig(auto_save="name") |
rate_limiter | None | execution=ExecutionConfig(rate_limiter=obj) |
verification_hooks | None | autonomy=AutonomyConfig(verification_hooks=[...]) |
cli_backend | None | runtime=... (see Runtime) |
llm | — | model=... (canonical); llm= is a deprecated alias, passing both raises TypeError |
retrieval_config | None | No 1:1 replacement — stays on Agent(retrieval_config=...) and resolves through knowledge= (see below) |
retrieval_config stays on Agent
retrieval_config is accepted directly on Agent(...) — it is not being migrated to a sub-config. It takes a dict or a RetrievalConfig instance and tunes retrieval on top of whatever knowledge= derived.
from praisonaiagents import Agent, RetrievalConfig
# dict — merges over the knowledge= config
agent = Agent(name="A", instructions="…", knowledge=["doc.pdf"], retrieval_config={"top_k": 5})
# instance — replaces the derived config wholesale
agent = Agent(name="A", instructions="…", retrieval_config=RetrievalConfig(top_k=5))llm → model
model= is the canonical name on every agent class (Agent, AgentTeam, AgentFlow, VisionAgent, AudioAgent, OCRAgent, VideoAgent, EmbeddingAgent, ImageAgent, ContextAgent, CodeAgent, RealtimeAgent). llm= is a deprecated alias for it. Passing both raises TypeError.
Old
from praisonaiagents import Agent
agent = Agent(name="Assistant", llm="gpt-4o")New
from praisonaiagents import Agent
agent = Agent(name="Assistant", model="gpt-4o")Refused
from praisonaiagents import Agent
# TypeError: Agent() received both llm= and model=. They are the same
# parameter, so passing both is ambiguous. Pass only one; model= is
# the canonical name (llm= is a deprecated alias).
agent = Agent(name="Assistant", llm="gpt-4o", model="gpt-3.5-turbo")allow_delegation → handoffs
Old
from praisonaiagents import Agent
other = Agent(name="specialist")
agent = Agent(name="router", allow_delegation=True)New
from praisonaiagents import Agent
other = Agent(name="specialist")
agent = Agent(name="router", handoffs=[other])allow_code_execution + code_execution_mode → execution
Old
from praisonaiagents import Agent
agent = Agent(
name="coder",
allow_code_execution=True,
code_execution_mode="safe",
)New
from praisonaiagents import Agent, ExecutionConfig
agent = Agent(
name="coder",
execution=ExecutionConfig(code_execution=True, code_mode="safe"),
)auto_save → memory
Old
from praisonaiagents import Agent
agent = Agent(name="assistant", auto_save="session")New
from praisonaiagents import Agent, MemoryConfig
agent = Agent(name="assistant", memory=MemoryConfig(auto_save="session"))rate_limiter → execution
Old
from praisonaiagents import Agent
agent = Agent(name="worker", rate_limiter=my_limiter)New
from praisonaiagents import Agent, ExecutionConfig
agent = Agent(name="worker", execution=ExecutionConfig(rate_limiter=my_limiter))verification_hooks → autonomy
Old
from praisonaiagents import Agent
agent = Agent(name="auditor", verification_hooks=[check_output])New
from praisonaiagents import Agent, AutonomyConfig
agent = Agent(name="auditor", autonomy=AutonomyConfig(verification_hooks=[check_output]))cli_backend → runtime
Old
from praisonaiagents import Agent
agent = Agent(name="cli-agent", cli_backend="claude-code")New
from praisonaiagents import Agent
agent = Agent(name="cli-agent", runtime="claude-code")What Else Changed
Two related rules make constructor mistakes fail fast instead of silently.
Keyword-only after toolsets=. handoffs= and every Config param must be passed by name. A stray positional past toolsets no longer binds to handoffs= by accident.
from praisonaiagents import Agent
# TypeError — stray positional past toolsets cannot misbind to handoffs=
Agent("n", "r", "g", "b", "i", None, None, None, None, None, None, None, True)Unknown kwargs now raise TypeError. Typos fail loudly.
from praisonaiagents import Agent
# TypeError: Agent.__init__() got unexpected keyword argument(s): totally_unknown
Agent(name="x", totally_unknown=1)The visible signature shrank from 48 to 41 params. No public param was removed — only their documentation surface.
Rejected Agent(...) kwargs → what to use instead
Agent(...) rejects these kwargs — pass them on the sub-config instead.
Land here after seeing this error:
TypeError: Agent.__init__() got unexpected keyword argument(s): session_idThe dict shorthand memory={"session_id": "…"} is accepted as shorthand for MemoryConfig — use it in the Quick Start of any new example.
Rejected on Agent(...) | Error | Correct spelling |
|---|---|---|
Agent(session_id="my-session") | TypeError: ... session_id | Agent(memory={"session_id": "my-session"}) or Agent(memory=MemoryConfig(session_id="my-session")) |
Agent(user_id="alice") | TypeError: ... user_id | Agent(memory=MemoryConfig(user_id="alice")) |
Agent(db="postgresql://…") | TypeError: ... db | Agent(memory=MemoryConfig(session_id="…", db="postgresql://…")) — or MemoryConfig(db=db.PostgresDB(...)) for the optional praisonai wrapper |
Agent(prompt_caching=True) | TypeError: ... prompt_caching | Agent(caching=CachingConfig(prompt_caching=True)) |
Agent(tool_timeout=30) | TypeError: ... tool_timeout (with migration hint) | Agent(tool_config=ToolConfig(timeout=30)) |
Agent(tool_retry_policy=RetryPolicy(...)) | TypeError: ... tool_retry_policy (with migration hint) | Agent(tool_config=ToolConfig(retry_policy=RetryPolicy(...))) |
tool_timeout → tool_config
Rejected
from praisonaiagents import Agent
# TypeError: Agent.__init__() got an unexpected keyword argument 'tool_timeout'
# tool_timeout: tool timeout moved into tool_config=; use
# tool_config=ToolConfig(timeout=...).
agent = Agent(name="Assistant", tool_timeout=30)Correct
from praisonaiagents import Agent, ToolConfig
agent = Agent(name="Assistant", tool_config=ToolConfig(timeout=30))tool_retry_policy → tool_config
Rejected
from praisonaiagents import Agent
from praisonaiagents.tools import RetryPolicy
# TypeError: Agent.__init__() got an unexpected keyword argument 'tool_retry_policy'
# tool_retry_policy: tool retry moved into tool_config=; use
# tool_config=ToolConfig(retry_policy=RetryPolicy(...)).
agent = Agent(name="Assistant", tool_retry_policy=RetryPolicy())Correct
from praisonaiagents import Agent, ToolConfig
from praisonaiagents.tools import RetryPolicy
agent = Agent(
name="Assistant",
tool_config=ToolConfig(retry_policy=RetryPolicy()),
)session_id → memory
Rejected
from praisonaiagents import Agent
# TypeError: Agent.__init__() got unexpected keyword argument(s): session_id
agent = Agent(name="Assistant", session_id="my-session")Correct
from praisonaiagents import Agent
agent = Agent(name="Assistant", memory={"session_id": "my-session"})user_id → memory
Rejected
from praisonaiagents import Agent
# TypeError: Agent.__init__() got unexpected keyword argument(s): user_id
agent = Agent(name="Assistant", user_id="alice")Correct
from praisonaiagents import Agent, MemoryConfig
agent = Agent(name="Assistant", memory=MemoryConfig(user_id="alice"))db → memory
Rejected
from praisonaiagents import Agent
# TypeError: Agent.__init__() got unexpected keyword argument(s): db
agent = Agent(name="Assistant", db="postgresql://user:pass@localhost/mydb")Correct (URL)
from praisonaiagents import Agent, MemoryConfig
agent = Agent(
name="Assistant",
memory=MemoryConfig(
session_id="user-123-main",
db="postgresql://user:pass@localhost/mydb",
),
)Correct (wrapper)
from praisonaiagents import Agent, MemoryConfig, db
agent = Agent(
name="Assistant",
memory=MemoryConfig(
session_id="user-123-main",
db=db.PostgresDB(host="localhost", user="user", password="pass", database="mydb"),
),
)prompt_caching → caching
Rejected
from praisonaiagents import Agent
# TypeError: Agent.__init__() got unexpected keyword argument(s): prompt_caching
agent = Agent(name="Assistant", prompt_caching=True)Correct
from praisonaiagents import Agent, CachingConfig
agent = Agent(name="Assistant", caching=CachingConfig(prompt_caching=True))Should I Migrate?
Use this flow to decide when to switch.
Common Patterns
The three migrations you will hit most often.
Coder agent — allow_code_execution + code_execution_mode → ExecutionConfig:
from praisonaiagents import Agent, ExecutionConfig
agent = Agent(
name="coder",
execution=ExecutionConfig(code_execution=True, code_mode="safe"),
)Long-running agent — auto_save + rate_limiter → MemoryConfig + ExecutionConfig:
from praisonaiagents import Agent, MemoryConfig, ExecutionConfig
agent = Agent(
name="worker",
memory=MemoryConfig(auto_save="session"),
execution=ExecutionConfig(rate_limiter=my_limiter),
)Autonomous agent — verification_hooks → AutonomyConfig:
from praisonaiagents import Agent, AutonomyConfig
agent = Agent(
name="auditor",
autonomy=AutonomyConfig(verification_hooks=[check_output]),
)Best Practices
Prefer the Config form in new code
The deprecated names will be removed in a future release. Write new agents with the config objects from the start.
Fix DeprecationWarnings as they surface
Migrate the warnings that appear in your test suite as you touch each agent, not all at once.
Always pass Config params by name
Never pass Agent(..., value) positionally past toolsets=. Keyword form prevents accidental misbinding.
Do not use fallback_models= on Agent()
fallback_models= is not a constructor keyword — it is an internal forwarding path for clone_for_channel(). Use llm=LLMConfig(fallback_models=[...]) for strings, dicts, and base_url setups, or assign agent.fallback_models = [...] after construction when llm= is a model object. See Model Fallback → Custom LLMs & provider/model strings.
Related
Replaces allow_delegation=True.
Replaces allow_code_execution, code_execution_mode, and rate_limiter.
Replaces verification_hooks=[...].
Replaces auto_save="name".
Replaces cli_backend=.
Replaces rate_limiter= on Agent().
Full session lifecycle for memory={"session_id": ...}.
CachingConfig(prompt_caching=True) replaces prompt_caching=.