Skip to content

Commit 371ec98

Browse files
committed
Release v4.5.1
1 parent 0885a9b commit 371ec98

File tree

16 files changed

+493
-32
lines changed

16 files changed

+493
-32
lines changed

docker/Dockerfile.chat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
1616
# Install Python packages (using latest versions)
1717
RUN pip install --no-cache-dir \
1818
praisonai_tools \
19-
"praisonai>=4.5.0" \
19+
"praisonai>=4.5.1" \
2020
"praisonai[chat]" \
2121
"embedchain[github,youtube]"
2222

docker/Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN mkdir -p /root/.praison
2020
# Install Python packages (using latest versions)
2121
RUN pip install --no-cache-dir \
2222
praisonai_tools \
23-
"praisonai>=4.5.0" \
23+
"praisonai>=4.5.1" \
2424
"praisonai[ui]" \
2525
"praisonai[chat]" \
2626
"praisonai[realtime]" \

docker/Dockerfile.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN mkdir -p /root/.praison
1616
# Install Python packages (using latest versions)
1717
RUN pip install --no-cache-dir \
1818
praisonai_tools \
19-
"praisonai>=4.5.0" \
19+
"praisonai>=4.5.1" \
2020
"praisonai[ui]" \
2121
"praisonai[crewai]"
2222

src/praisonai-agents/AGENTS.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,56 @@ agent = Agent(
344344
)
345345
```
346346

347+
### 5.3 Parameter Consolidation
348+
349+
Agent parameters are consolidated into Config objects following the pattern:
350+
`False=disabled, True=defaults, Config=custom`
351+
352+
**Consolidated Parameters (use these):**
353+
354+
| Config Object | Replaces (Deprecated) |
355+
|--------------|----------------------|
356+
| `execution=ExecutionConfig(code_execution=True, code_mode="safe", rate_limiter=obj)` | `allow_code_execution`, `code_execution_mode`, `rate_limiter` |
357+
| `memory=MemoryConfig(auto_save="session_name")` | `auto_save` |
358+
| `autonomy=AutonomyConfig(verification_hooks=[...])` | `verification_hooks` |
359+
| `handoffs=[other_agent]` | `allow_delegation` |
360+
| `output=OutputConfig(...)` | `verbose`, `markdown`, `stream`, `metrics` |
361+
| `reflection=ReflectionConfig(...)` | `self_reflect`, `max_reflect`, `min_reflect` |
362+
| `templates=TemplateConfig(...)` | `system_template`, `prompt_template`, `response_template` |
363+
| `caching=CachingConfig(...)` | `cache`, `prompt_caching` |
364+
| `web=WebConfig(...)` | `web_search`, `web_fetch` |
365+
366+
**Deprecated standalone params still work** (backward compatible) but emit `DeprecationWarning`.
367+
368+
```python
369+
# ❌ Old way (deprecated)
370+
agent = Agent(
371+
name="coder",
372+
allow_code_execution=True,
373+
code_execution_mode="safe",
374+
auto_save="my_session",
375+
rate_limiter=my_limiter,
376+
allow_delegation=True,
377+
verification_hooks=[my_hook],
378+
)
379+
380+
# ✅ New way (consolidated)
381+
from praisonaiagents import Agent, ExecutionConfig, MemoryConfig
382+
from praisonaiagents.agent.autonomy import AutonomyConfig
383+
384+
agent = Agent(
385+
name="coder",
386+
handoffs=[reviewer_agent],
387+
execution=ExecutionConfig(
388+
code_execution=True,
389+
code_mode="safe",
390+
rate_limiter=my_limiter,
391+
),
392+
memory=MemoryConfig(auto_save="my_session"),
393+
autonomy=AutonomyConfig(verification_hooks=[my_hook]),
394+
)
395+
```
396+
347397
---
348398

349399
## 6. Extension Points

src/praisonai-agents/praisonaiagents/agent/agent.py

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,13 @@ def __init__(
411411
api_key: Optional[str] = None, # Kept separate (connection/auth)
412412
# Tools
413413
tools: Optional[List[Any]] = None,
414-
allow_delegation: bool = False,
415-
allow_code_execution: Optional[bool] = False,
416-
code_execution_mode: Literal["safe", "unsafe"] = "safe",
414+
allow_delegation: bool = False, # Deprecated: use handoffs= instead
415+
allow_code_execution: Optional[bool] = False, # Deprecated: use execution=ExecutionConfig(code_execution=True)
416+
code_execution_mode: Literal["safe", "unsafe"] = "safe", # Deprecated: use execution=ExecutionConfig(code_mode="safe")
417417
handoffs: Optional[List[Union['Agent', 'Handoff']]] = None,
418-
# Session management
419-
auto_save: Optional[str] = None,
420-
rate_limiter: Optional[Any] = None,
418+
# Session management (deprecated standalone params - use config objects)
419+
auto_save: Optional[str] = None, # Deprecated: use memory=MemoryConfig(auto_save="name")
420+
rate_limiter: Optional[Any] = None, # Deprecated: use execution=ExecutionConfig(rate_limiter=obj)
421421
# ============================================================
422422
# CONSOLIDATED FEATURE PARAMS (agent-centric API)
423423
# Each follows: False=disabled, True=defaults, Config=custom
@@ -430,7 +430,7 @@ def __init__(
430430
web: Optional[Union[bool, Any]] = None, # Union[bool, WebConfig]
431431
context: Optional[Union[bool, Any]] = None, # Union[bool, ManagerConfig, ContextManager] - None=smart default
432432
autonomy: Optional[Union[bool, Dict[str, Any], Any]] = None, # Union[bool, dict, AutonomyConfig]
433-
verification_hooks: Optional[List[Any]] = None, # List of VerificationHook instances
433+
verification_hooks: Optional[List[Any]] = None, # Deprecated: use autonomy=AutonomyConfig(verification_hooks=[...])
434434
output: Optional[Union[str, Any]] = None, # Union[str preset, OutputConfig]
435435
execution: Optional[Union[str, Any]] = None, # Union[str preset, ExecutionConfig]
436436
templates: Optional[Any] = None, # TemplateConfig
@@ -453,12 +453,12 @@ def __init__(
453453
base_url: Custom LLM endpoint URL (e.g., for Ollama). Kept separate for auth.
454454
api_key: API key for LLM provider. Kept separate for auth.
455455
tools: List of tools, functions, callables, or MCP instances.
456-
allow_delegation: Allow task delegation to other agents. Defaults to False.
457-
allow_code_execution: Enable code execution during tasks. Defaults to False.
458-
code_execution_mode: "safe" (restricted) or "unsafe" (full access). Defaults to "safe".
456+
allow_delegation: **Deprecated** — use ``handoffs=`` instead.
457+
allow_code_execution: **Deprecated** — use ``execution=ExecutionConfig(code_execution=True)``.
458+
code_execution_mode: **Deprecated** — use ``execution=ExecutionConfig(code_mode="safe")``.
459459
handoffs: List of Agent or Handoff objects for agent-to-agent collaboration.
460-
auto_save: Session name for automatic session saving.
461-
rate_limiter: Rate limiter instance for API call throttling.
460+
auto_save: **Deprecated** — use ``memory=MemoryConfig(auto_save="name")``.
461+
rate_limiter: **Deprecated** — use ``execution=ExecutionConfig(rate_limiter=obj)``.
462462
memory: Memory system configuration. Accepts:
463463
- bool: True enables defaults, False disables
464464
- MemoryConfig: Custom configuration
@@ -487,7 +487,8 @@ def __init__(
487487
- bool: True enables with defaults
488488
- Dict: Configuration dict
489489
- AutonomyConfig: Custom configuration
490-
verification_hooks: List of VerificationHook instances for output verification.
490+
verification_hooks: **Deprecated** — use ``autonomy=AutonomyConfig(verification_hooks=[...])``.
491+
Still works for backward compatibility.
491492
output: Output configuration. Accepts:
492493
- str: Preset name ("silent", "actions", "verbose", "json", "stream")
493494
- OutputConfig: Custom configuration
@@ -521,6 +522,11 @@ def __init__(
521522
- system_template, prompt_template, response_template → templates=
522523
- cache, prompt_caching → caching=
523524
- web_search, web_fetch → web=
525+
- allow_delegation → handoffs=
526+
- allow_code_execution, code_execution_mode → execution=
527+
- auto_save → memory=MemoryConfig(auto_save=)
528+
- rate_limiter → execution=ExecutionConfig(rate_limiter=)
529+
- verification_hooks → autonomy=AutonomyConfig(verification_hooks=)
524530
"""
525531
# Add check at start if memory is requested
526532
if memory is not None:
@@ -585,6 +591,48 @@ def __init__(
585591
# AutonomyConfig is in agent/autonomy.py - use dict for config defaults
586592
autonomy = apply_config_defaults("autonomy", autonomy, None)
587593

594+
# ============================================================
595+
# DEPRECATION WARNINGS for params consolidated into configs
596+
# Old params still work but emit warnings pointing to new API
597+
# ============================================================
598+
import warnings as _warnings
599+
600+
if allow_delegation:
601+
_warnings.warn(
602+
"Parameter 'allow_delegation' is deprecated. Use 'handoffs=[other_agent]' instead.",
603+
DeprecationWarning, stacklevel=2,
604+
)
605+
if allow_code_execution:
606+
_warnings.warn(
607+
"Parameter 'allow_code_execution' is deprecated. "
608+
"Use 'execution=ExecutionConfig(code_execution=True)' instead.",
609+
DeprecationWarning, stacklevel=2,
610+
)
611+
if code_execution_mode != "safe":
612+
_warnings.warn(
613+
"Parameter 'code_execution_mode' is deprecated. "
614+
"Use 'execution=ExecutionConfig(code_mode=\"unsafe\")' instead.",
615+
DeprecationWarning, stacklevel=2,
616+
)
617+
if auto_save is not None:
618+
_warnings.warn(
619+
"Parameter 'auto_save' is deprecated. "
620+
"Use 'memory=MemoryConfig(auto_save=\"name\")' instead.",
621+
DeprecationWarning, stacklevel=2,
622+
)
623+
if rate_limiter is not None:
624+
_warnings.warn(
625+
"Parameter 'rate_limiter' is deprecated. "
626+
"Use 'execution=ExecutionConfig(rate_limiter=obj)' instead.",
627+
DeprecationWarning, stacklevel=2,
628+
)
629+
if verification_hooks is not None:
630+
_warnings.warn(
631+
"Parameter 'verification_hooks' is deprecated. "
632+
"Use 'autonomy=AutonomyConfig(verification_hooks=[...])' instead.",
633+
DeprecationWarning, stacklevel=2,
634+
)
635+
588636
# ============================================================
589637
# CONSOLIDATED PARAMS EXTRACTION (agent-centric API)
590638
# Uses unified resolver: Instance > Config > Array > String > Bool > Default
@@ -731,6 +779,13 @@ def __init__(
731779
max_rpm = _exec_config.max_rpm
732780
max_execution_time = _exec_config.max_execution_time
733781
max_retry_limit = _exec_config.max_retry_limit
782+
# Extract consolidated fields (config takes precedence over deprecated standalone params)
783+
if _exec_config.rate_limiter is not None:
784+
rate_limiter = _exec_config.rate_limiter
785+
if _exec_config.code_execution:
786+
allow_code_execution = True
787+
if _exec_config.code_mode != "safe":
788+
code_execution_mode = _exec_config.code_mode
734789
else:
735790
max_iter, max_rpm, max_execution_time, max_retry_limit = 20, None, None, 2
736791

@@ -880,6 +935,9 @@ def __init__(
880935
db = _memory_config.db
881936
auto_memory = _memory_config.auto_memory
882937
claude_memory = _memory_config.claude_memory
938+
# Extract auto_save from MemoryConfig (takes precedence over standalone param)
939+
if _memory_config.auto_save is not None:
940+
auto_save = _memory_config.auto_save
883941
# Convert to internal format
884942
backend = _memory_config.backend
885943
if hasattr(backend, 'value'):
@@ -1846,6 +1904,9 @@ def _init_autonomy(self, autonomy: Any, verification_hooks: Optional[List[Any]]
18461904
"auto_escalate": autonomy.auto_escalate,
18471905
}
18481906
config = autonomy
1907+
# Extract verification_hooks from AutonomyConfig if provided
1908+
if autonomy.verification_hooks and not verification_hooks:
1909+
self._verification_hooks = autonomy.verification_hooks
18491910
else:
18501911
self.autonomy_enabled = False
18511912
self.autonomy_config = {}

src/praisonai-agents/praisonaiagents/agent/autonomy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class AutonomyConfig:
5555
observe: Whether to emit observability events
5656
completion_promise: Optional string that signals completion when wrapped in <promise>TEXT</promise>
5757
clear_context: Whether to clear chat history between iterations
58+
verification_hooks: List of VerificationHook instances for output verification
5859
"""
5960
enabled: bool = True
6061
max_iterations: int = 20
@@ -63,6 +64,7 @@ class AutonomyConfig:
6364
observe: bool = False
6465
completion_promise: Optional[str] = None
6566
clear_context: bool = False
67+
verification_hooks: Optional[List[Any]] = None
6668

6769
@classmethod
6870
def from_dict(cls, data: Dict[str, Any]) -> "AutonomyConfig":
@@ -75,6 +77,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "AutonomyConfig":
7577
observe=data.get("observe", False),
7678
completion_promise=data.get("completion_promise"),
7779
clear_context=data.get("clear_context", False),
80+
verification_hooks=data.get("verification_hooks"),
7881
)
7982

8083

src/praisonai-agents/praisonaiagents/agents/autoagents.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,25 +462,31 @@ def _create_agents_and_tasks(self, config: AutoAgentsConfig) -> Tuple[List[Agent
462462
# Use consolidated knowledge if provided, else fall back to legacy knowledge_sources
463463
effective_knowledge = self._knowledge if self._knowledge is not None else self.knowledge_sources
464464

465+
# Build execution config merging legacy code_execution params
466+
_effective_execution = self._execution
467+
if _effective_execution is None and (self.allow_code_execution or self.code_execution_mode != "safe"):
468+
from ..config.feature_configs import ExecutionConfig
469+
_effective_execution = ExecutionConfig(
470+
code_execution=bool(self.allow_code_execution),
471+
code_mode=self.code_execution_mode,
472+
)
473+
465474
agent = Agent(
466475
name=agent_config.name,
467476
role=agent_config.role,
468477
goal=agent_config.goal,
469478
backstory=agent_config.backstory,
470479
tools=agent_tools, # Use assigned tools
471-
allow_code_execution=self.allow_code_execution,
472480
memory=self.memory,
473481
llm=self.llm, # Consolidated LLM param
474-
code_execution_mode=self.code_execution_mode,
475-
allow_delegation=self.allow_delegation,
476482
base_url=self.base_url,
477483
api_key=self.api_key,
478484
# Consolidated params (new SDK contract)
479485
output=self._output, # Overrides verbose/markdown
480486
reflection=self._reflection, # Overrides self_reflect/max_reflect/min_reflect/reflect_llm
481487
caching=self._caching, # Overrides cache
482488
knowledge=effective_knowledge, # Overrides knowledge_sources/embedder_config
483-
execution=self._execution, # Overrides max_iter
489+
execution=_effective_execution, # Overrides max_iter + code execution
484490
guardrails=self._guardrails,
485491
web=self._web,
486492
hooks=self._hooks,

src/praisonai-agents/praisonaiagents/config/feature_configs.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ class MemoryConfig:
172172
history: bool = False
173173
history_limit: int = 10
174174

175+
# Auto-save session name (consolidated from standalone auto_save param)
176+
# When set, automatically saves session to memory with this name
177+
auto_save: Optional[str] = None
178+
175179
def to_dict(self) -> Dict[str, Any]:
176180
"""Convert to dictionary."""
177181
learn_dict = None
@@ -193,6 +197,7 @@ def to_dict(self) -> Dict[str, Any]:
193197
"learn": learn_dict,
194198
"history": self.history,
195199
"history_limit": self.history_limit,
200+
"auto_save": self.auto_save,
196201
}
197202

198203

@@ -609,7 +614,8 @@ class ExecutionConfig:
609614
"""
610615
Configuration for agent execution limits.
611616
612-
Consolidates: max_iter, max_rpm, max_execution_time, max_retry_limit
617+
Consolidates: max_iter, max_rpm, max_execution_time, max_retry_limit,
618+
allow_code_execution, code_execution_mode, rate_limiter
613619
614620
Usage:
615621
# Simple preset
@@ -622,6 +628,13 @@ class ExecutionConfig:
622628
max_execution_time=300,
623629
max_retry_limit=5,
624630
))
631+
632+
# With code execution and rate limiter
633+
Agent(execution=ExecutionConfig(
634+
code_execution=True,
635+
code_mode="safe",
636+
rate_limiter=my_limiter,
637+
))
625638
"""
626639
# Iteration limits
627640
max_iter: int = 20
@@ -635,13 +648,22 @@ class ExecutionConfig:
635648
# Retry settings
636649
max_retry_limit: int = 2
637650

651+
# Code execution (consolidated from allow_code_execution + code_execution_mode)
652+
code_execution: bool = False
653+
code_mode: str = "safe" # "safe" or "unsafe"
654+
655+
# Rate limiter instance (consolidated from standalone rate_limiter param)
656+
rate_limiter: Optional[Any] = None
657+
638658
def to_dict(self) -> Dict[str, Any]:
639659
"""Convert to dictionary."""
640660
return {
641661
"max_iter": self.max_iter,
642662
"max_rpm": self.max_rpm,
643663
"max_execution_time": self.max_execution_time,
644664
"max_retry_limit": self.max_retry_limit,
665+
"code_execution": self.code_execution,
666+
"code_mode": self.code_mode,
645667
}
646668

647669

src/praisonai-agents/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "praisonaiagents"
7-
version = "1.5.0"
7+
version = "1.5.1"
88
description = "Praison AI agents for completing complex tasks with Self Reflection Agents"
99
readme = "README.md"
1010
requires-python = ">=3.10"

0 commit comments

Comments
 (0)