webagents 0.1.13__py3-none-any.whl → 0.2.2__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 +1 -1
- webagents/__main__.py +55 -0
- webagents/agents/__init__.py +1 -1
- webagents/agents/core/__init__.py +1 -1
- webagents/agents/core/base_agent.py +15 -15
- webagents/agents/core/handoffs.py +1 -1
- webagents/agents/skills/__init__.py +11 -11
- webagents/agents/skills/base.py +1 -1
- webagents/agents/skills/core/llm/litellm/__init__.py +1 -1
- webagents/agents/skills/core/llm/litellm/skill.py +1 -1
- webagents/agents/skills/core/mcp/README.md +2 -2
- webagents/agents/skills/core/mcp/skill.py +2 -2
- webagents/agents/skills/core/memory/long_term_memory/memory_skill.py +14 -14
- webagents/agents/skills/core/memory/short_term_memory/__init__.py +1 -1
- webagents/agents/skills/core/memory/short_term_memory/skill.py +1 -1
- webagents/agents/skills/core/memory/vector_memory/skill.py +6 -6
- webagents/agents/skills/core/planning/__init__.py +1 -1
- 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/google/calendar/skill.py +1 -1
- 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/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/robutler/__init__.py +2 -2
- webagents/agents/skills/robutler/auth/__init__.py +3 -3
- webagents/agents/skills/robutler/auth/skill.py +16 -16
- webagents/agents/skills/robutler/crm/__init__.py +2 -2
- webagents/agents/skills/robutler/crm/skill.py +5 -5
- webagents/agents/skills/robutler/discovery/README.md +5 -5
- webagents/agents/skills/robutler/discovery/__init__.py +2 -2
- webagents/agents/skills/robutler/discovery/skill.py +21 -21
- webagents/agents/skills/robutler/message_history/__init__.py +2 -2
- webagents/agents/skills/robutler/message_history/skill.py +5 -5
- webagents/agents/skills/robutler/nli/__init__.py +1 -1
- webagents/agents/skills/robutler/nli/skill.py +9 -9
- webagents/agents/skills/robutler/payments/__init__.py +3 -3
- webagents/agents/skills/robutler/payments/exceptions.py +1 -1
- webagents/agents/skills/robutler/payments/skill.py +23 -23
- webagents/agents/skills/robutler/storage/__init__.py +2 -2
- webagents/agents/skills/robutler/storage/files/__init__.py +2 -2
- webagents/agents/skills/robutler/storage/files/skill.py +4 -4
- webagents/agents/skills/robutler/storage/json/__init__.py +1 -1
- webagents/agents/skills/robutler/storage/json/skill.py +3 -3
- webagents/agents/skills/robutler/storage/kv/skill.py +3 -3
- webagents/agents/skills/robutler/storage.py +6 -6
- webagents/agents/tools/decorators.py +12 -12
- webagents/server/__init__.py +3 -3
- webagents/server/context/context_vars.py +2 -2
- webagents/server/core/app.py +13 -13
- webagents/server/core/middleware.py +3 -3
- webagents/server/core/models.py +1 -1
- webagents/server/core/monitoring.py +2 -2
- webagents/server/middleware.py +1 -1
- webagents/server/models.py +2 -2
- webagents/server/monitoring.py +15 -15
- webagents/utils/logging.py +20 -20
- webagents-0.2.2.dist-info/METADATA +266 -0
- webagents-0.2.2.dist-info/RECORD +105 -0
- webagents-0.2.2.dist-info/licenses/LICENSE +20 -0
- webagents/api/__init__.py +0 -17
- webagents/api/client.py +0 -1207
- webagents/api/types.py +0 -253
- webagents-0.1.13.dist-info/METADATA +0 -32
- webagents-0.1.13.dist-info/RECORD +0 -96
- webagents-0.1.13.dist-info/licenses/LICENSE +0 -1
- {webagents-0.1.13.dist-info → webagents-0.2.2.dist-info}/WHEEL +0 -0
- {webagents-0.1.13.dist-info → webagents-0.2.2.dist-info}/entry_points.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
WebAgents Files Storage Skill
|
3
3
|
|
4
|
-
File management capabilities for the
|
4
|
+
File management capabilities for the WebAgents platform with scope-based access controls.
|
5
5
|
"""
|
6
6
|
|
7
7
|
from .skill import RobutlerFilesSkill
|
@@ -12,12 +12,12 @@ from datetime import datetime
|
|
12
12
|
|
13
13
|
from ....base import Skill
|
14
14
|
from webagents.agents.tools.decorators import tool
|
15
|
-
from
|
15
|
+
from robutler.api.client import RobutlerClient
|
16
16
|
from webagents.agents.skills.robutler.payments import pricing, PricingInfo
|
17
17
|
|
18
18
|
class RobutlerFilesSkill(Skill):
|
19
19
|
"""
|
20
|
-
|
20
|
+
WebAgents portal file management skill using harmonized API.
|
21
21
|
|
22
22
|
Features:
|
23
23
|
- Download and store files from URLs
|
@@ -33,7 +33,7 @@ class RobutlerFilesSkill(Skill):
|
|
33
33
|
self.portal_url = config.get('portal_url', 'http://localhost:3000') if config else 'http://localhost:3000'
|
34
34
|
# Base URL used by the chat frontend to serve public content
|
35
35
|
self.chat_base_url = (config.get('chat_base_url') if config else None) or os.getenv('ROBUTLER_CHAT_URL', 'http://localhost:3001')
|
36
|
-
self.api_key = config.get('api_key', os.getenv('
|
36
|
+
self.api_key = config.get('api_key', os.getenv('WEBAGENTS_API_KEY', 'rok_testapikey')) if config else os.getenv('WEBAGENTS_API_KEY', 'rok_testapikey')
|
37
37
|
|
38
38
|
# Initialize RobutlerClient
|
39
39
|
self.client = RobutlerClient(
|
@@ -291,7 +291,7 @@ class RobutlerFilesSkill(Skill):
|
|
291
291
|
try:
|
292
292
|
from webagents.server.context.context_vars import get_context
|
293
293
|
from webagents.utils.logging import get_logger
|
294
|
-
logger = get_logger('
|
294
|
+
logger = get_logger('webagents_files')
|
295
295
|
|
296
296
|
# Get context for agent information and auth
|
297
297
|
context = get_context()
|
@@ -11,12 +11,12 @@ from datetime import datetime
|
|
11
11
|
|
12
12
|
from ....base import Skill
|
13
13
|
from webagents.agents.tools.decorators import tool
|
14
|
-
from
|
14
|
+
from robutler.api.client import RobutlerClient
|
15
15
|
|
16
16
|
|
17
17
|
class RobutlerJSONSkill(Skill):
|
18
18
|
"""
|
19
|
-
|
19
|
+
WebAgents portal JSON storage skill for long-term memory using RobutlerClient.
|
20
20
|
|
21
21
|
Features:
|
22
22
|
- Store/retrieve JSON data for long-term memory
|
@@ -38,7 +38,7 @@ class RobutlerJSONSkill(Skill):
|
|
38
38
|
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
39
39
|
super().__init__(config)
|
40
40
|
self.portal_url = config.get('portal_url', 'http://localhost:3000') if config else 'http://localhost:3000'
|
41
|
-
self.api_key = config.get('api_key', os.getenv('
|
41
|
+
self.api_key = config.get('api_key', os.getenv('WEBAGENTS_API_KEY', 'rok_testapikey')) if config else os.getenv('WEBAGENTS_API_KEY', 'rok_testapikey')
|
42
42
|
|
43
43
|
# Initialize RobutlerClient
|
44
44
|
self.client = RobutlerClient(
|
@@ -8,17 +8,17 @@ from typing import Any, Dict, Optional
|
|
8
8
|
import os
|
9
9
|
|
10
10
|
from ....base import Skill
|
11
|
-
from
|
11
|
+
from robutler.api.client import RobutlerClient
|
12
12
|
from webagents.agents.tools.decorators import tool
|
13
13
|
|
14
14
|
|
15
15
|
class RobutlerKVSkill(Skill):
|
16
|
-
"""KV storage skill using the
|
16
|
+
"""KV storage skill using the WebAgents portal API"""
|
17
17
|
|
18
18
|
def __init__(self, config: Optional[Dict[str, Any]] = None):
|
19
19
|
super().__init__(config)
|
20
20
|
self.portal_url = config.get('portal_url') if config else os.getenv('ROBUTLER_API_URL', 'http://localhost:3000')
|
21
|
-
self.api_key = config.get('api_key') if config else os.getenv('
|
21
|
+
self.api_key = config.get('api_key') if config else os.getenv('WEBAGENTS_API_KEY')
|
22
22
|
self.client: Optional[RobutlerClient] = None
|
23
23
|
self.agent = None
|
24
24
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
WebAgentsStorageSkill - Portal Content Integration
|
3
3
|
|
4
|
-
Provides integration with the
|
4
|
+
Provides integration with the WebAgents portal's content storage system
|
5
5
|
for persistent file storage tied to user accounts.
|
6
6
|
"""
|
7
7
|
|
@@ -15,9 +15,9 @@ from ..base import Skill
|
|
15
15
|
from ...tools.decorators import tool
|
16
16
|
|
17
17
|
|
18
|
-
class
|
18
|
+
class WebAgentsStorageSkill(Skill):
|
19
19
|
"""
|
20
|
-
|
20
|
+
WebAgents portal storage integration skill.
|
21
21
|
|
22
22
|
Features:
|
23
23
|
- Store/retrieve files in user's private content area
|
@@ -346,7 +346,7 @@ class RobutlerStorageSkill(Skill):
|
|
346
346
|
"total_size_bytes": total_size,
|
347
347
|
"total_size_mb": round(total_size / (1024 * 1024), 2),
|
348
348
|
"portal_url": self.portal_url,
|
349
|
-
"storage_location": "
|
349
|
+
"storage_location": "webagents_portal_content"
|
350
350
|
}, indent=2)
|
351
351
|
else:
|
352
352
|
return json.dumps({
|
@@ -363,7 +363,7 @@ class RobutlerStorageSkill(Skill):
|
|
363
363
|
def get_skill_info(self) -> Dict[str, Any]:
|
364
364
|
"""Get comprehensive skill information"""
|
365
365
|
return {
|
366
|
-
"name": "
|
366
|
+
"name": "WebAgentsStorageSkill",
|
367
367
|
"description": "Portal content storage integration for persistent data",
|
368
368
|
"version": "1.0.0",
|
369
369
|
"capabilities": [
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
Tool, Hook, Handoff, and HTTP Decorators -
|
2
|
+
Tool, Hook, Handoff, and HTTP Decorators - WebAgents V2.0
|
3
3
|
|
4
4
|
Decorators for automatic registration of tools, hooks, handoffs, and HTTP handlers with BaseAgent.
|
5
5
|
Supports context injection and scope-based access control.
|
@@ -88,8 +88,8 @@ def tool(func: Optional[Callable] = None, *, name: Optional[str] = None, descrip
|
|
88
88
|
}
|
89
89
|
|
90
90
|
# Mark function with metadata for BaseAgent discovery
|
91
|
-
f.
|
92
|
-
f.
|
91
|
+
f._webagents_is_tool = True
|
92
|
+
f._webagents_tool_definition = tool_schema
|
93
93
|
f._tool_scope = scope
|
94
94
|
f._tool_scope_was_set = func is None # If func is None, decorator was called with params
|
95
95
|
f._tool_name = name or f.__name__
|
@@ -129,8 +129,8 @@ def tool(func: Optional[Callable] = None, *, name: Optional[str] = None, descrip
|
|
129
129
|
wrapper = f
|
130
130
|
|
131
131
|
# Copy metadata to wrapper
|
132
|
-
wrapper.
|
133
|
-
wrapper.
|
132
|
+
wrapper._webagents_is_tool = True
|
133
|
+
wrapper._webagents_tool_definition = tool_schema
|
134
134
|
wrapper._tool_scope = scope
|
135
135
|
wrapper._tool_scope_was_set = func is None # If func is None, decorator was called with params
|
136
136
|
wrapper._tool_name = name or f.__name__
|
@@ -163,7 +163,7 @@ def hook(event: str, priority: int = 50, scope: Union[str, List[str]] = "all"):
|
|
163
163
|
"""
|
164
164
|
def decorator(func: Callable) -> Callable:
|
165
165
|
# Mark function with metadata for BaseAgent discovery
|
166
|
-
func.
|
166
|
+
func._webagents_is_hook = True
|
167
167
|
func._hook_event_type = event
|
168
168
|
func._hook_priority = priority
|
169
169
|
func._hook_scope = scope
|
@@ -195,7 +195,7 @@ def prompt(priority: int = 50, scope: Union[str, List[str]] = "all"):
|
|
195
195
|
"""
|
196
196
|
def decorator(func: Callable) -> Callable:
|
197
197
|
# Mark function with metadata for BaseAgent discovery
|
198
|
-
func.
|
198
|
+
func._webagents_is_prompt = True
|
199
199
|
func._prompt_priority = priority
|
200
200
|
func._prompt_scope = scope
|
201
201
|
|
@@ -238,7 +238,7 @@ def prompt(priority: int = 50, scope: Union[str, List[str]] = "all"):
|
|
238
238
|
wrapper = func
|
239
239
|
|
240
240
|
# Copy metadata to wrapper
|
241
|
-
wrapper.
|
241
|
+
wrapper._webagents_is_prompt = True
|
242
242
|
wrapper._prompt_priority = priority
|
243
243
|
wrapper._prompt_scope = scope
|
244
244
|
|
@@ -266,7 +266,7 @@ def handoff(name: Optional[str] = None, handoff_type: str = "agent", description
|
|
266
266
|
"""
|
267
267
|
def decorator(func: Callable) -> Callable:
|
268
268
|
# Mark function with metadata for BaseAgent discovery
|
269
|
-
func.
|
269
|
+
func._webagents_is_handoff = True
|
270
270
|
func._handoff_type = handoff_type
|
271
271
|
func._handoff_scope = scope
|
272
272
|
func._handoff_name = name or func.__name__
|
@@ -310,7 +310,7 @@ def handoff(name: Optional[str] = None, handoff_type: str = "agent", description
|
|
310
310
|
wrapper = func
|
311
311
|
|
312
312
|
# Copy metadata to wrapper
|
313
|
-
wrapper.
|
313
|
+
wrapper._webagents_is_handoff = True
|
314
314
|
wrapper._handoff_type = handoff_type
|
315
315
|
wrapper._handoff_scope = scope
|
316
316
|
wrapper._handoff_name = name or func.__name__
|
@@ -370,7 +370,7 @@ def http(subpath: str, method: str = "get", scope: Union[str, List[str]] = "all"
|
|
370
370
|
normalized_subpath = subpath if subpath.startswith('/') else f'/{subpath}'
|
371
371
|
|
372
372
|
# Mark function with metadata for BaseAgent discovery
|
373
|
-
func.
|
373
|
+
func._webagents_is_http = True
|
374
374
|
func._http_subpath = normalized_subpath
|
375
375
|
func._http_method = method.lower()
|
376
376
|
func._http_scope = scope
|
@@ -415,7 +415,7 @@ def http(subpath: str, method: str = "get", scope: Union[str, List[str]] = "all"
|
|
415
415
|
wrapper = func
|
416
416
|
|
417
417
|
# Copy metadata to wrapper
|
418
|
-
wrapper.
|
418
|
+
wrapper._webagents_is_http = True
|
419
419
|
wrapper._http_subpath = normalized_subpath
|
420
420
|
wrapper._http_method = method.lower()
|
421
421
|
wrapper._http_scope = scope
|
webagents/server/__init__.py
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
"""
|
2
|
-
|
2
|
+
WebAgents V2.0 Server Package
|
3
3
|
|
4
4
|
FastAPI server implementation with OpenAI compatibility,
|
5
5
|
streaming support, and comprehensive agent management.
|
6
6
|
"""
|
7
7
|
|
8
8
|
# Import moved to avoid circular dependency
|
9
|
-
# from .core.app import
|
9
|
+
# from .core.app import WebAgentsServer, create_server
|
10
10
|
from .models import (
|
11
11
|
ChatCompletionRequest,
|
12
12
|
OpenAIResponse,
|
@@ -17,7 +17,7 @@ from .models import (
|
|
17
17
|
)
|
18
18
|
|
19
19
|
__all__ = [
|
20
|
-
# '
|
20
|
+
# 'WebAgentsServer',
|
21
21
|
# 'create_server',
|
22
22
|
'ChatCompletionRequest',
|
23
23
|
'OpenAIResponse',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
Context Variables and Unified Context -
|
2
|
+
Context Variables and Unified Context - WebAgents V2.0
|
3
3
|
|
4
4
|
Unified context management using Python's contextvars for thread-safe,
|
5
5
|
async-compatible context handling.
|
@@ -14,7 +14,7 @@ from datetime import datetime
|
|
14
14
|
|
15
15
|
|
16
16
|
# Single ContextVar for unified context
|
17
|
-
CONTEXT: ContextVar['Context'] = ContextVar('
|
17
|
+
CONTEXT: ContextVar['Context'] = ContextVar('webagents_context')
|
18
18
|
|
19
19
|
|
20
20
|
@dataclass
|
webagents/server/core/app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
FastAPI Server -
|
2
|
+
FastAPI Server - WebAgents V2.0
|
3
3
|
|
4
4
|
Production FastAPI server with OpenAI compatibility, dynamic agent routing,
|
5
5
|
and comprehensive monitoring.
|
@@ -28,7 +28,7 @@ from ...agents.core.base_agent import BaseAgent
|
|
28
28
|
from ...utils.logging import get_logger
|
29
29
|
|
30
30
|
|
31
|
-
class
|
31
|
+
class WebAgentsServer:
|
32
32
|
"""
|
33
33
|
FastAPI server for AI agents with OpenAI compatibility and production monitoring
|
34
34
|
|
@@ -47,7 +47,7 @@ class RobutlerServer:
|
|
47
47
|
agents: List[BaseAgent] = None,
|
48
48
|
dynamic_agents: Optional[Union[Callable[[str], BaseAgent], Callable[[str], Awaitable[Optional[BaseAgent]]]]] = None,
|
49
49
|
enable_cors: bool = True,
|
50
|
-
title: str = "
|
50
|
+
title: str = "WebAgents V2 Server",
|
51
51
|
description: str = "AI Agent Server with OpenAI Compatibility",
|
52
52
|
version: str = "2.0.0",
|
53
53
|
url_prefix: str = "",
|
@@ -64,7 +64,7 @@ class RobutlerServer:
|
|
64
64
|
metrics_port: int = 9090
|
65
65
|
):
|
66
66
|
"""
|
67
|
-
Initialize
|
67
|
+
Initialize WebAgents server
|
68
68
|
|
69
69
|
Args:
|
70
70
|
agents: List of static Agent instances (optional)
|
@@ -140,7 +140,7 @@ class RobutlerServer:
|
|
140
140
|
self._setup_middleware()
|
141
141
|
self._create_endpoints()
|
142
142
|
|
143
|
-
print(f"🚀
|
143
|
+
print(f"🚀 WebAgents V2 Server initialized")
|
144
144
|
print(f" URL prefix: {self.url_prefix or '(none)'}")
|
145
145
|
print(f" Static agents: {len(self.static_agents)}")
|
146
146
|
print(f" Dynamic agents: {'✅ Enabled' if self.dynamic_agents else '❌ Disabled'}")
|
@@ -207,7 +207,7 @@ class RobutlerServer:
|
|
207
207
|
endpoints["metrics"] = f"{self.url_prefix}/metrics"
|
208
208
|
|
209
209
|
return {
|
210
|
-
"name": "
|
210
|
+
"name": "WebAgents V2 Server",
|
211
211
|
"version": self.version,
|
212
212
|
"status": "running",
|
213
213
|
"uptime_seconds": uptime_seconds,
|
@@ -225,7 +225,7 @@ class RobutlerServer:
|
|
225
225
|
|
226
226
|
stats = {
|
227
227
|
"server": {
|
228
|
-
"name": "
|
228
|
+
"name": "WebAgents V2 Server",
|
229
229
|
"version": self.version,
|
230
230
|
"uptime_seconds": uptime_seconds,
|
231
231
|
"startup_time": self.startup_time.isoformat()
|
@@ -644,7 +644,7 @@ class RobutlerServer:
|
|
644
644
|
return AgentInfoResponse(
|
645
645
|
name=agent.name,
|
646
646
|
instructions=agent.instructions,
|
647
|
-
model="
|
647
|
+
model="webagents-v2", # Generic model identifier
|
648
648
|
endpoints={
|
649
649
|
"chat_completions": f"{self.url_prefix}/{agent_name}/chat/completions",
|
650
650
|
"health": f"{self.url_prefix}/{agent_name}/health"
|
@@ -809,16 +809,16 @@ class RobutlerServer:
|
|
809
809
|
|
810
810
|
# Factory function for easy server creation
|
811
811
|
def create_server(
|
812
|
-
title: str = "
|
812
|
+
title: str = "WebAgents V2 Server",
|
813
813
|
description: str = "AI Agent Server with OpenAI Compatibility",
|
814
814
|
version: str = "2.0.0",
|
815
815
|
agents: List[BaseAgent] = None,
|
816
816
|
dynamic_agents: Optional[Union[Callable[[str], BaseAgent], Callable[[str], Awaitable[Optional[BaseAgent]]]]] = None,
|
817
817
|
url_prefix: str = "",
|
818
818
|
**kwargs
|
819
|
-
) ->
|
819
|
+
) -> WebAgentsServer:
|
820
820
|
"""
|
821
|
-
Create a
|
821
|
+
Create a WebAgents server instance
|
822
822
|
|
823
823
|
Args:
|
824
824
|
title: Server title
|
@@ -830,9 +830,9 @@ def create_server(
|
|
830
830
|
**kwargs: Additional server configuration
|
831
831
|
|
832
832
|
Returns:
|
833
|
-
Configured
|
833
|
+
Configured WebAgentsServer instance
|
834
834
|
"""
|
835
|
-
return
|
835
|
+
return WebAgentsServer(
|
836
836
|
title=title,
|
837
837
|
description=description,
|
838
838
|
version=version,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"""
|
2
|
-
FastAPI Middleware -
|
2
|
+
FastAPI Middleware - WebAgents V2.0
|
3
3
|
|
4
|
-
Request logging and rate limiting middleware for the
|
4
|
+
Request logging and rate limiting middleware for the WebAgents server.
|
5
5
|
"""
|
6
6
|
|
7
7
|
import time
|
@@ -12,7 +12,7 @@ from fastapi import Request, Response
|
|
12
12
|
from starlette.middleware.base import BaseHTTPMiddleware
|
13
13
|
|
14
14
|
# Get logger for middleware
|
15
|
-
middleware_logger = logging.getLogger("
|
15
|
+
middleware_logger = logging.getLogger("webagents.server.middleware")
|
16
16
|
|
17
17
|
|
18
18
|
@dataclass
|
webagents/server/core/models.py
CHANGED
webagents/server/middleware.py
CHANGED
webagents/server/models.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
OpenAI-Compatible Request/Response Models for
|
2
|
+
OpenAI-Compatible Request/Response Models for WebAgents V2.0 Server
|
3
3
|
"""
|
4
4
|
|
5
5
|
from pydantic import BaseModel, Field
|
@@ -78,7 +78,7 @@ class AgentInfoResponse(BaseModel):
|
|
78
78
|
|
79
79
|
class ServerInfo(BaseModel):
|
80
80
|
"""Server information response"""
|
81
|
-
message: str = Field(default="
|
81
|
+
message: str = Field(default="WebAgents V2 Server", description="Server message")
|
82
82
|
version: str = Field(default="2.0.0", description="Server version")
|
83
83
|
agents: List[str] = Field(..., description="List of available agents")
|
84
84
|
endpoints: Dict[str, str] = Field(..., description="Available endpoints")
|
webagents/server/monitoring.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"""
|
2
|
-
Monitoring & Observability -
|
2
|
+
Monitoring & Observability - WebAgents V2.0
|
3
3
|
|
4
4
|
Comprehensive monitoring system with Prometheus metrics, structured logging,
|
5
5
|
and request tracing for production deployments.
|
@@ -110,7 +110,7 @@ class RequestMetrics:
|
|
110
110
|
|
111
111
|
|
112
112
|
class PrometheusMetrics:
|
113
|
-
"""Prometheus metrics collection for
|
113
|
+
"""Prometheus metrics collection for WebAgents server"""
|
114
114
|
|
115
115
|
def __init__(self, registry: CollectorRegistry = None):
|
116
116
|
self.registry = registry
|
@@ -121,21 +121,21 @@ class PrometheusMetrics:
|
|
121
121
|
|
122
122
|
# HTTP Request metrics
|
123
123
|
self.http_requests_total = Counter(
|
124
|
-
'
|
124
|
+
'webagents_http_requests_total',
|
125
125
|
'Total HTTP requests',
|
126
126
|
['method', 'path', 'status_code', 'agent_name'],
|
127
127
|
registry=registry
|
128
128
|
)
|
129
129
|
|
130
130
|
self.http_request_duration = Histogram(
|
131
|
-
'
|
131
|
+
'webagents_http_request_duration_seconds',
|
132
132
|
'HTTP request duration',
|
133
133
|
['method', 'path', 'agent_name'],
|
134
134
|
registry=registry
|
135
135
|
)
|
136
136
|
|
137
137
|
self.http_requests_in_progress = Gauge(
|
138
|
-
'
|
138
|
+
'webagents_http_requests_in_progress',
|
139
139
|
'HTTP requests currently in progress',
|
140
140
|
['method', 'path', 'agent_name'],
|
141
141
|
registry=registry
|
@@ -143,21 +143,21 @@ class PrometheusMetrics:
|
|
143
143
|
|
144
144
|
# Agent metrics
|
145
145
|
self.agent_requests_total = Counter(
|
146
|
-
'
|
146
|
+
'webagents_agent_requests_total',
|
147
147
|
'Total requests per agent',
|
148
148
|
['agent_name', 'stream'],
|
149
149
|
registry=registry
|
150
150
|
)
|
151
151
|
|
152
152
|
self.agent_request_duration = Histogram(
|
153
|
-
'
|
153
|
+
'webagents_agent_request_duration_seconds',
|
154
154
|
'Agent request processing duration',
|
155
155
|
['agent_name', 'stream'],
|
156
156
|
registry=registry
|
157
157
|
)
|
158
158
|
|
159
159
|
self.agent_errors_total = Counter(
|
160
|
-
'
|
160
|
+
'webagents_agent_errors_total',
|
161
161
|
'Total agent processing errors',
|
162
162
|
['agent_name', 'error_type'],
|
163
163
|
registry=registry
|
@@ -165,14 +165,14 @@ class PrometheusMetrics:
|
|
165
165
|
|
166
166
|
# Token usage metrics
|
167
167
|
self.tokens_used_total = Counter(
|
168
|
-
'
|
168
|
+
'webagents_tokens_used_total',
|
169
169
|
'Total tokens used',
|
170
170
|
['agent_name', 'model'],
|
171
171
|
registry=registry
|
172
172
|
)
|
173
173
|
|
174
174
|
self.credits_spent_total = Counter(
|
175
|
-
'
|
175
|
+
'webagents_credits_spent_total',
|
176
176
|
'Total credits spent',
|
177
177
|
['agent_name', 'user_id'],
|
178
178
|
registry=registry
|
@@ -180,19 +180,19 @@ class PrometheusMetrics:
|
|
180
180
|
|
181
181
|
# System metrics
|
182
182
|
self.active_agents = Gauge(
|
183
|
-
'
|
183
|
+
'webagents_active_agents',
|
184
184
|
'Number of active agents',
|
185
185
|
registry=registry
|
186
186
|
)
|
187
187
|
|
188
188
|
self.dynamic_agents_cache_size = Gauge(
|
189
|
-
'
|
189
|
+
'webagents_dynamic_agents_cache_size',
|
190
190
|
'Dynamic agents cache size',
|
191
191
|
registry=registry
|
192
192
|
)
|
193
193
|
|
194
194
|
self.rate_limit_exceeded_total = Counter(
|
195
|
-
'
|
195
|
+
'webagents_rate_limit_exceeded_total',
|
196
196
|
'Total rate limit violations',
|
197
197
|
['client_type', 'limit_type'],
|
198
198
|
registry=registry
|
@@ -200,7 +200,7 @@ class PrometheusMetrics:
|
|
200
200
|
|
201
201
|
# Server info
|
202
202
|
self.server_info = Info(
|
203
|
-
'
|
203
|
+
'webagents_server_info',
|
204
204
|
'Server information',
|
205
205
|
registry=registry
|
206
206
|
)
|
@@ -437,7 +437,7 @@ class MonitoringSystem:
|
|
437
437
|
self.prometheus = PrometheusMetrics(None) # Mock metrics
|
438
438
|
|
439
439
|
if self.enable_structured_logging:
|
440
|
-
self.logger = StructuredLogger("
|
440
|
+
self.logger = StructuredLogger("webagents.monitoring")
|
441
441
|
else:
|
442
442
|
self.logger = None
|
443
443
|
|