webagents 0.2.0__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- webagents/__init__.py +9 -0
- webagents/agents/core/base_agent.py +865 -69
- webagents/agents/core/handoffs.py +14 -6
- webagents/agents/skills/base.py +33 -2
- webagents/agents/skills/core/llm/litellm/skill.py +906 -27
- webagents/agents/skills/core/memory/vector_memory/skill.py +8 -16
- webagents/agents/skills/ecosystem/crewai/__init__.py +3 -1
- webagents/agents/skills/ecosystem/crewai/skill.py +158 -0
- webagents/agents/skills/ecosystem/database/__init__.py +3 -1
- webagents/agents/skills/ecosystem/database/skill.py +522 -0
- webagents/agents/skills/ecosystem/mongodb/__init__.py +3 -0
- webagents/agents/skills/ecosystem/mongodb/skill.py +428 -0
- webagents/agents/skills/ecosystem/n8n/README.md +287 -0
- webagents/agents/skills/ecosystem/n8n/__init__.py +3 -0
- webagents/agents/skills/ecosystem/n8n/skill.py +341 -0
- webagents/agents/skills/ecosystem/openai/__init__.py +6 -0
- webagents/agents/skills/ecosystem/openai/skill.py +867 -0
- webagents/agents/skills/ecosystem/replicate/README.md +440 -0
- webagents/agents/skills/ecosystem/replicate/__init__.py +10 -0
- webagents/agents/skills/ecosystem/replicate/skill.py +517 -0
- webagents/agents/skills/ecosystem/x_com/README.md +401 -0
- webagents/agents/skills/ecosystem/x_com/__init__.py +3 -0
- webagents/agents/skills/ecosystem/x_com/skill.py +1048 -0
- webagents/agents/skills/ecosystem/zapier/README.md +363 -0
- webagents/agents/skills/ecosystem/zapier/__init__.py +3 -0
- webagents/agents/skills/ecosystem/zapier/skill.py +337 -0
- webagents/agents/skills/examples/__init__.py +6 -0
- webagents/agents/skills/examples/music_player.py +329 -0
- webagents/agents/skills/robutler/handoff/__init__.py +6 -0
- webagents/agents/skills/robutler/handoff/skill.py +191 -0
- webagents/agents/skills/robutler/nli/skill.py +180 -24
- webagents/agents/skills/robutler/payments/exceptions.py +27 -7
- webagents/agents/skills/robutler/payments/skill.py +64 -14
- webagents/agents/skills/robutler/storage/files/skill.py +2 -2
- webagents/agents/tools/decorators.py +243 -47
- webagents/agents/widgets/__init__.py +6 -0
- webagents/agents/widgets/renderer.py +150 -0
- webagents/server/core/app.py +130 -15
- webagents/server/core/models.py +1 -1
- webagents/utils/logging.py +13 -1
- {webagents-0.2.0.dist-info → webagents-0.2.3.dist-info}/METADATA +16 -9
- {webagents-0.2.0.dist-info → webagents-0.2.3.dist-info}/RECORD +45 -24
- webagents/agents/skills/ecosystem/openai_agents/__init__.py +0 -0
- {webagents-0.2.0.dist-info → webagents-0.2.3.dist-info}/WHEEL +0 -0
- {webagents-0.2.0.dist-info → webagents-0.2.3.dist-info}/entry_points.txt +0 -0
- {webagents-0.2.0.dist-info → webagents-0.2.3.dist-info}/licenses/LICENSE +0 -0
@@ -410,19 +410,17 @@ class VectorMemorySkill(Skill):
|
|
410
410
|
|
411
411
|
def get_guidance_prompt(self) -> str:
|
412
412
|
return (
|
413
|
-
"You have
|
414
|
-
"-
|
415
|
-
"-
|
416
|
-
"-
|
417
|
-
"- If you are the agent owner or an admin and need to curate knowledge, use the tools\n"
|
418
|
-
" upload_instruction / remove_instruction (owner) or create/update/delete_common_instruction (admin).\n"
|
413
|
+
"You have vector memory (common & agent-specific).\n"
|
414
|
+
"- MAY call fetch_instructions_tool ONCE per conversation for domain guidance.\n"
|
415
|
+
"- Use relevant instructions; ignore generic ones.\n"
|
416
|
+
"- Owner/admin: use upload_instruction/remove_instruction or create/update/delete_common_instruction.\n"
|
419
417
|
)
|
420
418
|
|
421
419
|
def get_tool_prompt(self) -> str:
|
422
420
|
"""Detailed prompt block that can be injected into the system prompt."""
|
423
421
|
return (
|
424
|
-
"- fetch_instructions_tool(problem, top_k=1): retrieve
|
425
|
-
"Use
|
422
|
+
"- fetch_instructions_tool(problem, top_k=1): retrieve instruction documents\n"
|
423
|
+
"Use ONCE per conversation if needed.\n"
|
426
424
|
)
|
427
425
|
|
428
426
|
# @prompt blocks to auto-inject scoped guidance
|
@@ -432,16 +430,10 @@ class VectorMemorySkill(Skill):
|
|
432
430
|
|
433
431
|
@prompt(priority=25, scope="owner")
|
434
432
|
def vector_memory_owner_prompt(self, context: Any = None) -> str:
|
435
|
-
return (
|
436
|
-
"OWNER: You may curate agent-specific instructions using upload_instruction(title, content, agent_specific=True)\n"
|
437
|
-
"and remove_instruction(doc_id). Use these to improve the agent's guidance over time.\n"
|
438
|
-
)
|
433
|
+
return "OWNER: Curate using upload_instruction(title, content, agent_specific=True) / remove_instruction(doc_id).\n"
|
439
434
|
|
440
435
|
@prompt(priority=25, scope="admin")
|
441
436
|
def vector_memory_admin_prompt(self, context: Any = None) -> str:
|
442
|
-
return
|
443
|
-
"ADMIN: You can manage common instructions using list/create/update/delete_common_instruction tools.\n"
|
444
|
-
"Use these to maintain global guidance shared across agents.\n"
|
445
|
-
)
|
437
|
+
return "ADMIN: Manage using list/create/update/delete_common_instruction tools.\n"
|
446
438
|
|
447
439
|
|
@@ -0,0 +1,158 @@
|
|
1
|
+
"""
|
2
|
+
Simplified CrewAI Skill for WebAgents
|
3
|
+
|
4
|
+
This skill runs a pre-configured CrewAI crew with agents and tasks.
|
5
|
+
The crew configuration is provided during skill initialization.
|
6
|
+
|
7
|
+
Main use case: Execute a specific crew workflow on demand.
|
8
|
+
"""
|
9
|
+
|
10
|
+
import os
|
11
|
+
import json
|
12
|
+
from typing import Dict, Any, Optional, List, Union
|
13
|
+
from datetime import datetime
|
14
|
+
|
15
|
+
from webagents.agents.skills.base import Skill
|
16
|
+
from webagents.agents.tools.decorators import tool, prompt
|
17
|
+
|
18
|
+
try:
|
19
|
+
from crewai import Agent, Task, Crew, Process
|
20
|
+
CREWAI_AVAILABLE = True
|
21
|
+
except ImportError:
|
22
|
+
CREWAI_AVAILABLE = False
|
23
|
+
Agent, Task, Crew, Process = None, None, None, None # type: ignore
|
24
|
+
|
25
|
+
|
26
|
+
class CrewAISkill(Skill):
|
27
|
+
"""Simplified CrewAI skill for running pre-configured crews"""
|
28
|
+
|
29
|
+
def __init__(self, crew_or_config: Optional[Union[Dict[str, Any], Any]] = None):
|
30
|
+
super().__init__({}, scope="all")
|
31
|
+
if not CREWAI_AVAILABLE:
|
32
|
+
raise ImportError("CrewAI is not installed. Install with: pip install crewai")
|
33
|
+
|
34
|
+
# Handle both Crew object and configuration dictionary
|
35
|
+
if crew_or_config is None:
|
36
|
+
self.crew_config = {}
|
37
|
+
self.crew = None
|
38
|
+
elif hasattr(crew_or_config, 'agents') and hasattr(crew_or_config, 'tasks'):
|
39
|
+
# It's a Crew object
|
40
|
+
self.crew_config = {}
|
41
|
+
self.crew = crew_or_config
|
42
|
+
else:
|
43
|
+
# It's a configuration dictionary
|
44
|
+
self.crew_config = crew_or_config or {}
|
45
|
+
self.crew = None
|
46
|
+
self._setup_crew()
|
47
|
+
|
48
|
+
def get_dependencies(self) -> List[str]:
|
49
|
+
"""Skill dependencies"""
|
50
|
+
return [] # No dependencies needed for simple crew execution
|
51
|
+
|
52
|
+
def _setup_crew(self):
|
53
|
+
"""Set up the CrewAI crew from configuration"""
|
54
|
+
if not self.crew_config:
|
55
|
+
return
|
56
|
+
|
57
|
+
try:
|
58
|
+
# Get agents configuration
|
59
|
+
agents_config = self.crew_config.get('agents', [])
|
60
|
+
tasks_config = self.crew_config.get('tasks', [])
|
61
|
+
process_type = self.crew_config.get('process', 'sequential')
|
62
|
+
|
63
|
+
if not agents_config or not tasks_config:
|
64
|
+
return
|
65
|
+
|
66
|
+
# Create agents
|
67
|
+
agents = []
|
68
|
+
for agent_config in agents_config:
|
69
|
+
agent = Agent(
|
70
|
+
role=agent_config.get('role', 'Agent'),
|
71
|
+
goal=agent_config.get('goal', 'Complete assigned tasks'),
|
72
|
+
backstory=agent_config.get('backstory', 'An AI agent ready to help'),
|
73
|
+
verbose=agent_config.get('verbose', True),
|
74
|
+
allow_delegation=agent_config.get('allow_delegation', False)
|
75
|
+
)
|
76
|
+
agents.append(agent)
|
77
|
+
|
78
|
+
# Create tasks
|
79
|
+
tasks = []
|
80
|
+
for i, task_config in enumerate(tasks_config):
|
81
|
+
# Assign agent to task (default to first agent if not specified)
|
82
|
+
agent_index = task_config.get('agent_index', 0)
|
83
|
+
if agent_index >= len(agents):
|
84
|
+
agent_index = 0 # Fallback to first agent
|
85
|
+
|
86
|
+
task = Task(
|
87
|
+
description=task_config.get('description', f'Task {i+1}'),
|
88
|
+
agent=agents[agent_index],
|
89
|
+
expected_output=task_config.get('expected_output', 'Task completion')
|
90
|
+
)
|
91
|
+
tasks.append(task)
|
92
|
+
|
93
|
+
# Create crew
|
94
|
+
process = Process.sequential
|
95
|
+
if process_type.lower() == 'hierarchical':
|
96
|
+
process = Process.hierarchical
|
97
|
+
|
98
|
+
self.crew = Crew(
|
99
|
+
agents=agents,
|
100
|
+
tasks=tasks,
|
101
|
+
process=process,
|
102
|
+
verbose=self.crew_config.get('verbose', True)
|
103
|
+
)
|
104
|
+
|
105
|
+
# CrewAI crew initialized successfully
|
106
|
+
|
107
|
+
except Exception as e:
|
108
|
+
self.crew = None
|
109
|
+
|
110
|
+
@prompt(priority=40, scope=["owner", "all"])
|
111
|
+
def crewai_prompt(self) -> str:
|
112
|
+
"""Prompt describing CrewAI capabilities"""
|
113
|
+
if not self.crew:
|
114
|
+
return """
|
115
|
+
CrewAI skill is available but no crew is configured.
|
116
|
+
|
117
|
+
To use CrewAI, initialize the skill with either:
|
118
|
+
1. A CrewAI Crew object: CrewAISkill(crew)
|
119
|
+
2. A crew configuration dictionary with agents, tasks, and process settings
|
120
|
+
"""
|
121
|
+
|
122
|
+
agents_count = len(self.crew.agents) if self.crew else 0
|
123
|
+
tasks_count = len(self.crew.tasks) if self.crew else 0
|
124
|
+
|
125
|
+
return f"""
|
126
|
+
CrewAI multi-agent orchestration is ready. Available tool:
|
127
|
+
|
128
|
+
• crewai_run(inputs) - Execute the configured crew with the given inputs
|
129
|
+
|
130
|
+
Configured crew:
|
131
|
+
- {agents_count} agents with specialized roles
|
132
|
+
- {tasks_count} tasks in the workflow
|
133
|
+
- Ready to process your requests through collaborative AI agents
|
134
|
+
|
135
|
+
Provide inputs as a dictionary to run the crew workflow.
|
136
|
+
"""
|
137
|
+
|
138
|
+
# Public tool
|
139
|
+
@tool(description="Execute the configured CrewAI crew with the given inputs")
|
140
|
+
async def crewai_run(self, inputs: Dict[str, Any]) -> str:
|
141
|
+
"""Execute the configured CrewAI crew with the provided inputs"""
|
142
|
+
if not self.crew:
|
143
|
+
return "❌ No CrewAI crew configured. Please initialize the skill with a crew configuration."
|
144
|
+
|
145
|
+
if not inputs:
|
146
|
+
return "❌ Inputs are required to run the crew"
|
147
|
+
|
148
|
+
try:
|
149
|
+
# Execute the crew with inputs
|
150
|
+
result = self.crew.kickoff(inputs=inputs)
|
151
|
+
|
152
|
+
agents_count = len(self.crew.agents)
|
153
|
+
tasks_count = len(self.crew.tasks)
|
154
|
+
|
155
|
+
return f"✅ CrewAI execution completed successfully!\n👥 Agents: {agents_count}\n📝 Tasks: {tasks_count}\n\n📊 Result:\n{result}"
|
156
|
+
|
157
|
+
except Exception as e:
|
158
|
+
return f"❌ CrewAI execution failed: {str(e)}"
|