Skip to content

Commit 847b5e6

Browse files
committed
Release v3.10.25
1 parent 05a7265 commit 847b5e6

35 files changed

+4770
-121
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>=3.10.24" \
19+
"praisonai>=3.10.25" \
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>=3.10.24" \
23+
"praisonai>=3.10.25" \
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>=3.10.24" \
19+
"praisonai>=3.10.25" \
2020
"praisonai[ui]" \
2121
"praisonai[crewai]"
2222

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
Example 1: Save Agent Output Using write_file Tool
3+
4+
The agent decides when and what to save based on the task.
5+
"""
6+
7+
from praisonaiagents import Agent
8+
from praisonaiagents.tools import write_file
9+
10+
# Create agent with write_file tool
11+
agent = Agent(
12+
name="ContentWriter",
13+
role="Technical Writer",
14+
goal="Create and save technical documentation",
15+
tools=[write_file]
16+
)
17+
18+
# Agent will use write_file tool to save the content
19+
result = agent.start("Write a short poem about coding and save it to poem.txt")
20+
21+
print("✅ Task completed!")
22+
print(f"Result: {result}")
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Example 2: Save Agent Output Using Task.output_file
3+
4+
Task output is automatically saved to the specified file.
5+
"""
6+
7+
from praisonaiagents import Agent, Task, Agents
8+
9+
# Create agent
10+
writer = Agent(
11+
name="ContentWriter",
12+
role="Writer",
13+
goal="Create engaging content"
14+
)
15+
16+
# Task with output_file - auto-saves result
17+
task = Task(
18+
description="Write a short blog post about the benefits of AI assistants",
19+
expected_output="A well-structured blog post in markdown format",
20+
agent=writer,
21+
output_file="blog_post.md",
22+
create_directory=True
23+
)
24+
25+
# Run
26+
agents = Agents(agents=[writer], tasks=[task])
27+
result = agents.start()
28+
29+
print("✅ Task completed!")
30+
print("Output saved to: blog_post.md")
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
Example 3: Save Agent Output Using Workflow output_file
3+
4+
Workflow step output is automatically saved with variable substitution.
5+
"""
6+
7+
from praisonaiagents import Workflow
8+
9+
# Define workflow with output_file
10+
workflow_config = {
11+
"metadata": {
12+
"name": "content-generator",
13+
"version": "1.0"
14+
},
15+
"variables": {
16+
"output_dir": "generated",
17+
"topic": "Python programming"
18+
},
19+
"agents": {
20+
"writer": {
21+
"role": "Content Writer",
22+
"goal": "Create engaging content",
23+
"llm": "gpt-4o-mini"
24+
}
25+
},
26+
"steps": [
27+
{
28+
"agent": "writer",
29+
"action": "Write a short tutorial about Python basics",
30+
"expected_output": "A beginner-friendly tutorial",
31+
"output_file": "{{output_dir}}/tutorial.md"
32+
}
33+
]
34+
}
35+
36+
# Run workflow
37+
workflow = Workflow(config=workflow_config)
38+
result = workflow.run()
39+
40+
print("✅ Workflow completed!")
41+
print("Output saved to: generated/tutorial.md")
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
Example 4: Save Agent Output Manually
3+
4+
Capture the response and save it with full control.
5+
"""
6+
7+
from praisonaiagents import Agent
8+
from pathlib import Path
9+
10+
# Create agent
11+
agent = Agent(
12+
name="StoryWriter",
13+
instructions="You are a creative writer who writes short stories."
14+
)
15+
16+
# Get response
17+
response = agent.start("Write a very short story about a robot learning to paint")
18+
19+
# Save manually with error handling
20+
output_path = Path("stories/robot_story.txt")
21+
output_path.parent.mkdir(parents=True, exist_ok=True)
22+
23+
try:
24+
output_path.write_text(response)
25+
print(f"✅ Saved to {output_path}")
26+
except IOError as e:
27+
print(f"❌ Failed to save: {e}")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Save Agent Output Examples
2+
3+
Examples demonstrating different methods to save agent output to files.
4+
5+
## Examples
6+
7+
| File | Method | Description |
8+
|------|--------|-------------|
9+
| `01_write_file_tool.py` | write_file Tool | Agent decides when/what to save |
10+
| `02_task_output_file.py` | Task.output_file | Auto-save task result |
11+
| `03_workflow_output_file.py` | Workflow output_file | Save workflow step output |
12+
| `04_manual_save.py` | Manual | Full control over saving |
13+
14+
## Setup
15+
16+
```bash
17+
pip install praisonaiagents
18+
export OPENAI_API_KEY="your-key"
19+
```
20+
21+
## Run Examples
22+
23+
```bash
24+
python 01_write_file_tool.py
25+
python 02_task_output_file.py
26+
python 03_workflow_output_file.py
27+
python 04_manual_save.py
28+
```
29+
30+
## Which Method to Use?
31+
32+
- **write_file Tool**: When agent needs to decide what to save
33+
- **Task.output_file**: For task-based workflows with auto-save
34+
- **Workflow output_file**: For YAML workflows with variable substitution
35+
- **Manual**: When you need full control over the saving process

src/praisonai-agents/praisonaiagents/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ def _get_lazy_cache():
213213
'PromptExpanderAgent': ('praisonaiagents.agent.prompt_expander_agent', 'PromptExpanderAgent'),
214214
'ExpandStrategy': ('praisonaiagents.agent.prompt_expander_agent', 'ExpandStrategy'),
215215
'ExpandResult': ('praisonaiagents.agent.prompt_expander_agent', 'ExpandResult'),
216+
'VisionAgent': ('praisonaiagents.agent.vision_agent', 'VisionAgent'),
217+
'VisionConfig': ('praisonaiagents.agent.vision_agent', 'VisionConfig'),
218+
'EmbeddingAgent': ('praisonaiagents.agent.embedding_agent', 'EmbeddingAgent'),
219+
'EmbeddingConfig': ('praisonaiagents.agent.embedding_agent', 'EmbeddingConfig'),
220+
'RealtimeAgent': ('praisonaiagents.agent.realtime_agent', 'RealtimeAgent'),
221+
'RealtimeConfig': ('praisonaiagents.agent.realtime_agent', 'RealtimeConfig'),
222+
'CodeAgent': ('praisonaiagents.agent.code_agent', 'CodeAgent'),
223+
'CodeConfig': ('praisonaiagents.agent.code_agent', 'CodeConfig'),
216224

217225
# Agents
218226
'Agents': ('praisonaiagents.agents.agents', 'Agents'),

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,38 @@ def __getattr__(name):
5555
from .router_agent import RouterAgent
5656
_lazy_cache[name] = RouterAgent
5757
return RouterAgent
58+
elif name == 'VisionAgent':
59+
from .vision_agent import VisionAgent
60+
_lazy_cache[name] = VisionAgent
61+
return VisionAgent
62+
elif name == 'VisionConfig':
63+
from .vision_agent import VisionConfig
64+
_lazy_cache[name] = VisionConfig
65+
return VisionConfig
66+
elif name == 'EmbeddingAgent':
67+
from .embedding_agent import EmbeddingAgent
68+
_lazy_cache[name] = EmbeddingAgent
69+
return EmbeddingAgent
70+
elif name == 'EmbeddingConfig':
71+
from .embedding_agent import EmbeddingConfig
72+
_lazy_cache[name] = EmbeddingConfig
73+
return EmbeddingConfig
74+
elif name == 'RealtimeAgent':
75+
from .realtime_agent import RealtimeAgent
76+
_lazy_cache[name] = RealtimeAgent
77+
return RealtimeAgent
78+
elif name == 'RealtimeConfig':
79+
from .realtime_agent import RealtimeConfig
80+
_lazy_cache[name] = RealtimeConfig
81+
return RealtimeConfig
82+
elif name == 'CodeAgent':
83+
from .code_agent import CodeAgent
84+
_lazy_cache[name] = CodeAgent
85+
return CodeAgent
86+
elif name == 'CodeConfig':
87+
from .code_agent import CodeConfig
88+
_lazy_cache[name] = CodeConfig
89+
return CodeConfig
5890

5991
# Handoff - lightweight
6092
_handoff_names = {
@@ -120,6 +152,14 @@ def __getattr__(name):
120152
'AudioConfig',
121153
'OCRAgent',
122154
'OCRConfig',
155+
'VisionAgent',
156+
'VisionConfig',
157+
'EmbeddingAgent',
158+
'EmbeddingConfig',
159+
'RealtimeAgent',
160+
'RealtimeConfig',
161+
'CodeAgent',
162+
'CodeConfig',
123163
'ContextAgent',
124164
'create_context_agent',
125165
'Handoff',

0 commit comments

Comments
 (0)