Skip to content

Commit e854a50

Browse files
committed
Release v4.5.21
1 parent 99fde9b commit e854a50

File tree

19 files changed

+196
-30
lines changed

19 files changed

+196
-30
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.20" \
19+
"praisonai>=4.5.21" \
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.20" \
23+
"praisonai>=4.5.21" \
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.20" \
19+
"praisonai>=4.5.21" \
2020
"praisonai[ui]" \
2121
"praisonai[crewai]"
2222

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Calculator with Tests - Editor Output Example.
2+
3+
Builds a calculator module, writes unit tests, runs them, generates a
4+
coverage-style report, and reads it back.
5+
"""
6+
from praisonaiagents import Agent
7+
from praisonaiagents.tools import (
8+
write_file, read_file, execute_command
9+
)
10+
11+
agent = Agent(
12+
instructions="You are a helpful coding assistant.",
13+
output="editor",
14+
tools=[write_file, read_file, execute_command],
15+
approval=True,
16+
)
17+
agent.start(
18+
"Build a mini calculator - create /tmp/calculator.py with add, subtract, "
19+
"multiply, divide functions, write unit tests in /tmp/test_calculator.py "
20+
"using unittest, run the tests to make sure they pass, then generate a "
21+
"coverage-style report in /tmp/calc_report.md listing which functions were "
22+
"tested and read it back"
23+
)

examples/basic/fibonacci.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""Fibonacci Generator - Editor Output Example.
2+
3+
Creates a Fibonacci script, runs it, writes a summary, and reads back
4+
both files to verify everything looks good.
5+
"""
6+
from praisonaiagents import Agent
7+
from praisonaiagents.tools import (
8+
write_file, read_file, execute_command, list_directory
9+
)
10+
11+
agent = Agent(
12+
instructions="You are a helpful coding assistant.",
13+
output="editor",
14+
tools=[write_file, read_file, execute_command, list_directory],
15+
approval=True,
16+
)
17+
agent.start(
18+
"Create a Python file at /tmp/fibonacci.py that generates the first 20 "
19+
"Fibonacci numbers, run it to verify the output is correct, then write "
20+
"a summary to /tmp/fib_summary.md explaining the algorithm you used and "
21+
"the output, finally read back both files to confirm everything looks good"
22+
)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Multi-Step Research - Editor Output Example.
2+
3+
Researches Python frameworks, creates comparison code, runs it, writes a
4+
markdown report, reads it back, lists files, and gets system info.
5+
"""
6+
from praisonaiagents import Agent
7+
from praisonaiagents.tools import (
8+
write_file, read_file, execute_command, list_directory, get_system_info
9+
)
10+
11+
try:
12+
from praisonaiagents.tools import web_search
13+
tools = [web_search, write_file, read_file, execute_command,
14+
list_directory, get_system_info]
15+
except ImportError:
16+
tools = [write_file, read_file, execute_command,
17+
list_directory, get_system_info]
18+
19+
agent = Agent(
20+
instructions="You are a helpful research assistant.",
21+
output="editor",
22+
tools=tools,
23+
approval=True,
24+
)
25+
agent.start(
26+
"Research the top 3 Python web frameworks (Django, FastAPI, Flask), then: "
27+
"1) Search the web for each framework's latest version and key features, "
28+
"2) Create a file called /tmp/framework_comparison.py that contains a "
29+
"Python dictionary with the comparison data, "
30+
"3) Execute the code to verify the dictionary is valid, "
31+
"4) Write a markdown report to /tmp/framework_report.md summarizing your "
32+
"findings in a table format, "
33+
"5) Read back the report file to verify it was written correctly, "
34+
"6) List the files in /tmp to confirm both files exist, "
35+
"7) Get system info to note what OS this report was generated on"
36+
)

examples/basic/system_audit.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""System Audit - Editor Output Example.
2+
3+
Runs system commands, gathers info, writes a report, and reads it back.
4+
"""
5+
from praisonaiagents import Agent
6+
from praisonaiagents.tools import (
7+
write_file, read_file, execute_command
8+
)
9+
10+
agent = Agent(
11+
instructions="You are a helpful system administration assistant.",
12+
output="editor",
13+
tools=[write_file, read_file, execute_command],
14+
approval=True,
15+
)
16+
agent.start(
17+
"Investigate my system - get the current date, check disk usage, find out "
18+
"what Python version is installed, list running processes sorted by memory, "
19+
"then write all findings to /tmp/system_audit.md as a neat report and read "
20+
"it back to verify"
21+
)

examples/basic/weather_search.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Weather Search - Editor Output Example.
2+
3+
Searches for weather, creates JSON data, writes a parser script, executes
4+
it, and lists created files.
5+
"""
6+
from praisonaiagents import Agent
7+
from praisonaiagents.tools import (
8+
write_file, execute_command, list_directory
9+
)
10+
11+
try:
12+
from praisonaiagents.tools import web_search
13+
tools = [web_search, write_file, execute_command, list_directory]
14+
except ImportError:
15+
tools = [write_file, execute_command, list_directory]
16+
17+
agent = Agent(
18+
instructions="You are a helpful research assistant.",
19+
output="editor",
20+
tools=tools,
21+
approval=True,
22+
)
23+
agent.start(
24+
"Search the web for the current weather in Tokyo, create a JSON file at "
25+
"/tmp/weather_data.json with the findings, then write a Python script at "
26+
"/tmp/parse_weather.py that reads the JSON and prints a formatted weather "
27+
"report, execute the script, and list all files you created in /tmp"
28+
)

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ def __init__(
714714
json_output = getattr(_output_config, 'json_output', False)
715715
status_trace = getattr(_output_config, 'status_trace', False) # New: clean inline status
716716
simple_output = getattr(_output_config, 'simple_output', False) # status preset: no timestamps
717+
editor_output = getattr(_output_config, 'editor_output', False) # Editor: Step N display
717718
output_file = getattr(_output_config, 'output_file', None) # Auto-save to file
718719
output_template = getattr(_output_config, 'template', None) # Response template
719720
else:
@@ -723,10 +724,20 @@ def __init__(
723724
json_output = False
724725
status_trace = False
725726
simple_output = False
727+
editor_output = False
726728

727-
# Enable trace output mode if configured (takes priority)
729+
# Enable editor output mode if configured (beginner-friendly, takes priority)
730+
# Shows: Step 1: 📄 Creating file: path → ✓ Done
731+
if editor_output:
732+
try:
733+
from ..output.editor import enable_editor_output, is_editor_output_enabled
734+
if not is_editor_output_enabled():
735+
enable_editor_output(use_color=True)
736+
except ImportError:
737+
pass # Editor module not available
738+
# Enable trace output mode if configured
728739
# This provides timestamped inline status with duration
729-
if status_trace:
740+
elif status_trace:
730741
try:
731742
from ..output.trace import enable_trace_output, is_trace_output_enabled
732743
if not is_trace_output_enabled():
@@ -4712,6 +4723,9 @@ def _execute_tool_impl(self, function_name, arguments):
47124723
error_msg = f"Tool execution denied: {decision.reason}"
47134724
logging.warning(error_msg)
47144725
return {"error": error_msg, "approval_denied": True}
4726+
# Bridge: mark tool as approved in global registry context so
4727+
# @require_approval decorator wrappers skip their own check.
4728+
get_approval_registry().mark_approved(function_name)
47154729
if decision.modified_args:
47164730
arguments = decision.modified_args
47174731
logging.info(f"Using modified arguments: {arguments}")
@@ -7667,6 +7681,10 @@ async def execute_tool_async(self, function_name: str, arguments: Dict[str, Any]
76677681
error_msg = f"Tool execution denied: {decision.reason}"
76687682
logging.warning(error_msg)
76697683
return {"error": error_msg, "approval_denied": True}
7684+
# Bridge: mark tool as approved in global registry context so
7685+
# @require_approval decorator wrappers skip their own check.
7686+
from ..approval import get_approval_registry as _get_reg
7687+
_get_reg().mark_approved(function_name)
76707688
if decision.modified_args:
76717689
arguments = decision.modified_args
76727690
logging.info(f"Using modified arguments: {arguments}")

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,10 @@ class OutputConfig:
574574
# Shows: [timestamp] Calling LLM..., Executing tool..., Response: ...
575575
status_trace: bool = False
576576

577+
# Editor output mode - beginner-friendly numbered steps
578+
# Shows: Step 1: 📄 Creating file: path → ✓ Done
579+
editor_output: bool = False
580+
577581
# Output file - save agent response to file automatically
578582
# When set, saves the response to the specified file path
579583
output_file: Optional[str] = None
@@ -596,6 +600,7 @@ def to_dict(self) -> Dict[str, Any]:
596600
"simple_output": self.simple_output,
597601
"show_parameters": self.show_parameters,
598602
"status_trace": self.status_trace,
603+
"editor_output": self.editor_output,
599604
"output_file": self.output_file,
600605
"template": self.template,
601606
}

0 commit comments

Comments
 (0)