webagents 0.2.2__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.
Files changed (31) hide show
  1. webagents/__init__.py +9 -0
  2. webagents/agents/core/base_agent.py +865 -69
  3. webagents/agents/core/handoffs.py +14 -6
  4. webagents/agents/skills/base.py +33 -2
  5. webagents/agents/skills/core/llm/litellm/skill.py +906 -27
  6. webagents/agents/skills/core/memory/vector_memory/skill.py +8 -16
  7. webagents/agents/skills/ecosystem/openai/__init__.py +6 -0
  8. webagents/agents/skills/ecosystem/openai/skill.py +867 -0
  9. webagents/agents/skills/ecosystem/replicate/README.md +440 -0
  10. webagents/agents/skills/ecosystem/replicate/__init__.py +10 -0
  11. webagents/agents/skills/ecosystem/replicate/skill.py +517 -0
  12. webagents/agents/skills/examples/__init__.py +6 -0
  13. webagents/agents/skills/examples/music_player.py +329 -0
  14. webagents/agents/skills/robutler/handoff/__init__.py +6 -0
  15. webagents/agents/skills/robutler/handoff/skill.py +191 -0
  16. webagents/agents/skills/robutler/nli/skill.py +180 -24
  17. webagents/agents/skills/robutler/payments/exceptions.py +27 -7
  18. webagents/agents/skills/robutler/payments/skill.py +64 -14
  19. webagents/agents/skills/robutler/storage/files/skill.py +2 -2
  20. webagents/agents/tools/decorators.py +243 -47
  21. webagents/agents/widgets/__init__.py +6 -0
  22. webagents/agents/widgets/renderer.py +150 -0
  23. webagents/server/core/app.py +130 -15
  24. webagents/server/core/models.py +1 -1
  25. webagents/utils/logging.py +13 -1
  26. {webagents-0.2.2.dist-info → webagents-0.2.3.dist-info}/METADATA +8 -25
  27. {webagents-0.2.2.dist-info → webagents-0.2.3.dist-info}/RECORD +30 -20
  28. webagents/agents/skills/ecosystem/openai_agents/__init__.py +0 -0
  29. {webagents-0.2.2.dist-info → webagents-0.2.3.dist-info}/WHEEL +0 -0
  30. {webagents-0.2.2.dist-info → webagents-0.2.3.dist-info}/entry_points.txt +0 -0
  31. {webagents-0.2.2.dist-info → webagents-0.2.3.dist-info}/licenses/LICENSE +0 -0
@@ -114,14 +114,18 @@ class LocalAgentHandoff:
114
114
  if preserve_context:
115
115
  target_context = create_context(
116
116
  request_id=current_context.request_id,
117
- peer_user_id=current_context.peer_user_id,
118
- payment_user_id=current_context.payment_user_id,
119
- origin_user_id=current_context.origin_user_id,
120
- agent_owner_user_id=current_context.agent_owner_user_id,
121
117
  messages=current_context.messages.copy(),
122
- stream=current_context.stream
118
+ stream=current_context.stream,
119
+ agent=target
123
120
  )
124
121
 
122
+ # Copy auth context if present
123
+ if current_context.auth:
124
+ target_context.auth = current_context.auth
125
+
126
+ # Copy usage data
127
+ target_context.usage = current_context.usage.copy()
128
+
125
129
  # Add handoff context data
126
130
  target_context.set("handoff_context", context_data)
127
131
  target_context.update_agent_context(target, target_agent)
@@ -135,6 +139,10 @@ class LocalAgentHandoff:
135
139
  current_context.set("handoff_data", context_data)
136
140
  await source._execute_hooks("before_handoff", current_context)
137
141
 
142
+ # Ensure handoff_data is a dict
143
+ if handoff_data is None:
144
+ handoff_data = {}
145
+
138
146
  # Create handoff message for target agent
139
147
  handoff_message = {
140
148
  "role": "system",
@@ -143,7 +151,7 @@ class LocalAgentHandoff:
143
151
 
144
152
  # Add handoff context to messages
145
153
  messages_with_handoff = current_context.messages + [handoff_message]
146
- if handoff_data and handoff_data.get('user_message'):
154
+ if handoff_data.get('user_message'):
147
155
  messages_with_handoff.append({
148
156
  "role": "user",
149
157
  "content": handoff_data['user_message']
@@ -106,14 +106,45 @@ class Skill(ABC):
106
106
  def get_dependencies(self) -> List[str]:
107
107
  """Return list of skill dependencies"""
108
108
  return self.dependencies.copy()
109
+
110
+ def request_handoff(self, target_name: str) -> str:
111
+ """Return a handoff request marker for the given target
112
+
113
+ This is a helper for skills that want to trigger dynamic handoff.
114
+ Return this value from a tool, and the framework will execute the handoff.
115
+
116
+ Args:
117
+ target_name: Target name of the handoff to switch to
118
+
119
+ Returns:
120
+ Handoff request marker string
121
+
122
+ Example:
123
+ @tool
124
+ async def use_specialist(self):
125
+ return self.request_handoff("specialist_agent")
126
+ """
127
+ return f"__HANDOFF_REQUEST__:{target_name}"
109
128
 
110
129
 
111
130
  # Base dataclasses for handoffs and other components
112
131
  @dataclass
113
132
  class Handoff:
114
- """Configuration for handoff operations"""
133
+ """Configuration for handoff operations
134
+
135
+ Handoffs are chat completion handlers that can be local LLMs or remote agents.
136
+ The first registered handoff (lowest priority) becomes the default completion handler.
137
+
138
+ Attributes:
139
+ target: Unique identifier for this handoff
140
+ description: Human-readable description (from @handoff prompt parameter)
141
+ scope: Access control scope(s)
142
+ metadata: Additional data including:
143
+ - function: The actual handoff function
144
+ - priority: Execution priority (lower = higher priority)
145
+ - is_generator: Whether function is async generator (streaming)
146
+ """
115
147
  target: str
116
- handoff_type: str
117
148
  description: str = ""
118
149
  scope: Union[str, List[str]] = "all"
119
150
  metadata: Dict[str, Any] = None