xpander-sdk 1.60.8__py3-none-any.whl → 2.0.155__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.
- xpander_sdk/__init__.py +76 -7793
- xpander_sdk/consts/__init__.py +0 -0
- xpander_sdk/consts/api_routes.py +63 -0
- xpander_sdk/core/__init__.py +0 -0
- xpander_sdk/core/module_base.py +164 -0
- xpander_sdk/core/state.py +10 -0
- xpander_sdk/core/xpander_api_client.py +119 -0
- xpander_sdk/exceptions/__init__.py +0 -0
- xpander_sdk/exceptions/module_exception.py +45 -0
- xpander_sdk/models/__init__.py +0 -0
- xpander_sdk/models/activity.py +65 -0
- xpander_sdk/models/configuration.py +92 -0
- xpander_sdk/models/events.py +70 -0
- xpander_sdk/models/frameworks.py +64 -0
- xpander_sdk/models/shared.py +102 -0
- xpander_sdk/models/user.py +21 -0
- xpander_sdk/modules/__init__.py +0 -0
- xpander_sdk/modules/agents/__init__.py +0 -0
- xpander_sdk/modules/agents/agents_module.py +164 -0
- xpander_sdk/modules/agents/models/__init__.py +0 -0
- xpander_sdk/modules/agents/models/agent.py +477 -0
- xpander_sdk/modules/agents/models/agent_list.py +107 -0
- xpander_sdk/modules/agents/models/knowledge_bases.py +33 -0
- xpander_sdk/modules/agents/sub_modules/__init__.py +0 -0
- xpander_sdk/modules/agents/sub_modules/agent.py +953 -0
- xpander_sdk/modules/agents/utils/__init__.py +0 -0
- xpander_sdk/modules/agents/utils/generic.py +2 -0
- xpander_sdk/modules/backend/__init__.py +0 -0
- xpander_sdk/modules/backend/backend_module.py +425 -0
- xpander_sdk/modules/backend/frameworks/__init__.py +0 -0
- xpander_sdk/modules/backend/frameworks/agno.py +627 -0
- xpander_sdk/modules/backend/frameworks/dispatch.py +36 -0
- xpander_sdk/modules/backend/utils/__init__.py +0 -0
- xpander_sdk/modules/backend/utils/mcp_oauth.py +95 -0
- xpander_sdk/modules/events/__init__.py +0 -0
- xpander_sdk/modules/events/decorators/__init__.py +0 -0
- xpander_sdk/modules/events/decorators/on_boot.py +94 -0
- xpander_sdk/modules/events/decorators/on_shutdown.py +94 -0
- xpander_sdk/modules/events/decorators/on_task.py +203 -0
- xpander_sdk/modules/events/events_module.py +629 -0
- xpander_sdk/modules/events/models/__init__.py +0 -0
- xpander_sdk/modules/events/models/deployments.py +25 -0
- xpander_sdk/modules/events/models/events.py +57 -0
- xpander_sdk/modules/events/utils/__init__.py +0 -0
- xpander_sdk/modules/events/utils/generic.py +56 -0
- xpander_sdk/modules/events/utils/git_init.py +32 -0
- xpander_sdk/modules/knowledge_bases/__init__.py +0 -0
- xpander_sdk/modules/knowledge_bases/knowledge_bases_module.py +217 -0
- xpander_sdk/modules/knowledge_bases/models/__init__.py +0 -0
- xpander_sdk/modules/knowledge_bases/models/knowledge_bases.py +11 -0
- xpander_sdk/modules/knowledge_bases/sub_modules/__init__.py +0 -0
- xpander_sdk/modules/knowledge_bases/sub_modules/knowledge_base.py +107 -0
- xpander_sdk/modules/knowledge_bases/sub_modules/knowledge_base_document_item.py +40 -0
- xpander_sdk/modules/knowledge_bases/utils/__init__.py +0 -0
- xpander_sdk/modules/tasks/__init__.py +0 -0
- xpander_sdk/modules/tasks/models/__init__.py +0 -0
- xpander_sdk/modules/tasks/models/task.py +153 -0
- xpander_sdk/modules/tasks/models/tasks_list.py +107 -0
- xpander_sdk/modules/tasks/sub_modules/__init__.py +0 -0
- xpander_sdk/modules/tasks/sub_modules/task.py +887 -0
- xpander_sdk/modules/tasks/tasks_module.py +492 -0
- xpander_sdk/modules/tasks/utils/__init__.py +0 -0
- xpander_sdk/modules/tasks/utils/files.py +114 -0
- xpander_sdk/modules/tools_repository/__init__.py +0 -0
- xpander_sdk/modules/tools_repository/decorators/__init__.py +0 -0
- xpander_sdk/modules/tools_repository/decorators/register_tool.py +108 -0
- xpander_sdk/modules/tools_repository/models/__init__.py +0 -0
- xpander_sdk/modules/tools_repository/models/mcp.py +68 -0
- xpander_sdk/modules/tools_repository/models/tool_invocation_result.py +14 -0
- xpander_sdk/modules/tools_repository/sub_modules/__init__.py +0 -0
- xpander_sdk/modules/tools_repository/sub_modules/tool.py +578 -0
- xpander_sdk/modules/tools_repository/tools_repository_module.py +259 -0
- xpander_sdk/modules/tools_repository/utils/__init__.py +0 -0
- xpander_sdk/modules/tools_repository/utils/generic.py +57 -0
- xpander_sdk/modules/tools_repository/utils/local_tools.py +52 -0
- xpander_sdk/modules/tools_repository/utils/schemas.py +308 -0
- xpander_sdk/utils/__init__.py +0 -0
- xpander_sdk/utils/env.py +44 -0
- xpander_sdk/utils/event_loop.py +67 -0
- xpander_sdk/utils/tools.py +32 -0
- xpander_sdk-2.0.155.dist-info/METADATA +538 -0
- xpander_sdk-2.0.155.dist-info/RECORD +85 -0
- {xpander_sdk-1.60.8.dist-info → xpander_sdk-2.0.155.dist-info}/WHEEL +1 -1
- {xpander_sdk-1.60.8.dist-info → xpander_sdk-2.0.155.dist-info/licenses}/LICENSE +0 -1
- xpander_sdk/_jsii/__init__.py +0 -39
- xpander_sdk/_jsii/xpander-sdk@1.60.8.jsii.tgz +0 -0
- xpander_sdk/py.typed +0 -1
- xpander_sdk-1.60.8.dist-info/METADATA +0 -368
- xpander_sdk-1.60.8.dist-info/RECORD +0 -9
- {xpander_sdk-1.60.8.dist-info → xpander_sdk-2.0.155.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent models and configuration classes for the xpander.ai SDK.
|
|
3
|
+
|
|
4
|
+
This module contains all data models and enums related to agent creation,
|
|
5
|
+
configuration, and management within the xpander.ai Backend-as-a-Service platform.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from enum import Enum
|
|
10
|
+
from typing import Dict, List, Literal, Optional, Type
|
|
11
|
+
from pydantic import BaseModel, computed_field
|
|
12
|
+
|
|
13
|
+
from xpander_sdk.models.shared import XPanderSharedModel
|
|
14
|
+
from xpander_sdk.modules.tools_repository.models.mcp import MCPServerDetails
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AgentDeploymentType(str, Enum):
|
|
18
|
+
"""
|
|
19
|
+
Enumeration of supported deployment types for agents.
|
|
20
|
+
|
|
21
|
+
Values:
|
|
22
|
+
Serverless: Serverless agent.
|
|
23
|
+
Container: Containerized agent.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
Serverless = "serverless"
|
|
27
|
+
Container = "container"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AgentStatus(str, Enum):
|
|
31
|
+
"""
|
|
32
|
+
Enumeration of possible agent statuses.
|
|
33
|
+
|
|
34
|
+
Values:
|
|
35
|
+
DRAFT: Agent is in a draft state and not yet active.
|
|
36
|
+
ACTIVE: Agent is active and operational, ready to handle tasks.
|
|
37
|
+
INACTIVE: Agent is inactive and not operational.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
DRAFT = "DRAFT"
|
|
41
|
+
ACTIVE = "ACTIVE"
|
|
42
|
+
INACTIVE = "INACTIVE"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class AgentInstructions(BaseModel):
|
|
46
|
+
"""
|
|
47
|
+
Model for agent instructions and configuration.
|
|
48
|
+
|
|
49
|
+
This model defines the instructions and goals that guide an agent's behavior,
|
|
50
|
+
including role definitions, goals, and general guidance.
|
|
51
|
+
|
|
52
|
+
Attributes:
|
|
53
|
+
role (List[str]): List of role-specific instructions for the agent.
|
|
54
|
+
goal (List[str]): List of goals the agent should achieve.
|
|
55
|
+
general (str): General instructions or description for the agent.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
role: List[str] = []
|
|
59
|
+
goal: List[str] = []
|
|
60
|
+
general: str = ""
|
|
61
|
+
|
|
62
|
+
@computed_field
|
|
63
|
+
@property
|
|
64
|
+
def description(self) -> str:
|
|
65
|
+
"""
|
|
66
|
+
Get the general description of the agent.
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
str: The general instructions/description.
|
|
70
|
+
"""
|
|
71
|
+
return self.general
|
|
72
|
+
|
|
73
|
+
@computed_field
|
|
74
|
+
@property
|
|
75
|
+
def instructions(self) -> str:
|
|
76
|
+
"""
|
|
77
|
+
Get the role-specific instructions for the agent.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
List[str]: List of role instructions.
|
|
81
|
+
"""
|
|
82
|
+
return f"""
|
|
83
|
+
<instructions>
|
|
84
|
+
{self.role}
|
|
85
|
+
</instructions>
|
|
86
|
+
<goals>
|
|
87
|
+
{self.goal_str}
|
|
88
|
+
</goals>
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
@computed_field
|
|
92
|
+
@property
|
|
93
|
+
def full(self) -> str:
|
|
94
|
+
"""
|
|
95
|
+
Get the role-specific instructions for the agent.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
List[str]: List of role instructions.
|
|
99
|
+
"""
|
|
100
|
+
return f"""
|
|
101
|
+
<description>
|
|
102
|
+
{self.description}
|
|
103
|
+
</description>
|
|
104
|
+
<instructions>
|
|
105
|
+
{self.role}
|
|
106
|
+
</instructions>
|
|
107
|
+
<goals>
|
|
108
|
+
{self.goal_str}
|
|
109
|
+
</goals>
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
@computed_field
|
|
113
|
+
@property
|
|
114
|
+
def goal_str(self) -> str:
|
|
115
|
+
"""
|
|
116
|
+
Get goals as a newline-separated string.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
str: Goals joined with newlines, or empty string if no goals.
|
|
120
|
+
"""
|
|
121
|
+
return "\n".join(self.goal) if self.goal and isinstance(self.goal, list) else ""
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class SourceNodeType(str, Enum):
|
|
125
|
+
"""
|
|
126
|
+
Enumeration of source node types for agent graphs.
|
|
127
|
+
|
|
128
|
+
Values:
|
|
129
|
+
WORKBENCH: Workbench-based source node.
|
|
130
|
+
SDK: SDK-based source node.
|
|
131
|
+
TASK: Task-based source node.
|
|
132
|
+
ASSISTANT: Assistant-based source node.
|
|
133
|
+
WEBHOOK: Webhook-triggered source node.
|
|
134
|
+
MCP: Model Context Protocol source node.
|
|
135
|
+
A2A: Agent-to-Agent communication source node.
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
WORKBENCH = "workbench"
|
|
139
|
+
SDK = "sdk"
|
|
140
|
+
TASK = "task"
|
|
141
|
+
ASSISTANT = "assistant"
|
|
142
|
+
WEBHOOK = "webhook"
|
|
143
|
+
MCP = "mcp"
|
|
144
|
+
A2A = "a2a"
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class AgentSourceNode(BaseModel):
|
|
148
|
+
"""
|
|
149
|
+
Model for agent source nodes in the execution graph.
|
|
150
|
+
|
|
151
|
+
Attributes:
|
|
152
|
+
id (Optional[str]): Unique identifier for the source node.
|
|
153
|
+
type (SourceNodeType): Type of the source node.
|
|
154
|
+
targets (Optional[List[str]]): List of target node IDs.
|
|
155
|
+
metadata (Optional[Dict]): Additional metadata for the source node.
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
id: Optional[str] = None
|
|
159
|
+
type: SourceNodeType
|
|
160
|
+
targets: Optional[list[str]] = None
|
|
161
|
+
metadata: Optional[Dict] = {}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class AgentAccessScope(str, Enum):
|
|
165
|
+
"""
|
|
166
|
+
Enumeration of agent access scopes.
|
|
167
|
+
|
|
168
|
+
Values:
|
|
169
|
+
Personal: Agent is accessible only to the creator.
|
|
170
|
+
Organizational: Agent is accessible to the entire organization.
|
|
171
|
+
"""
|
|
172
|
+
|
|
173
|
+
Personal = "personal"
|
|
174
|
+
Organizational = "organizational"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class AgentGraphItemType(str, Enum):
|
|
178
|
+
"""
|
|
179
|
+
Enumeration of agent graph item types.
|
|
180
|
+
|
|
181
|
+
Values:
|
|
182
|
+
SOURCE_NODE: Entry point for agent execution.
|
|
183
|
+
AGENT: Standard agent node.
|
|
184
|
+
TOOL: Tool or function node.
|
|
185
|
+
HUMAN_IN_THE_LOOP: Human approval/interaction node.
|
|
186
|
+
SLEEP: Allow the agent to sleep between iterations.
|
|
187
|
+
CUSTOM_AGENT: Custom agent implementation.
|
|
188
|
+
STORAGE: Data storage node.
|
|
189
|
+
CODING_AGENT: Specialized coding agent.
|
|
190
|
+
MCP: Model Context Protocol node.
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
SOURCE_NODE = "source_node"
|
|
194
|
+
AGENT = "agent"
|
|
195
|
+
TOOL = "tool"
|
|
196
|
+
HUMAN_IN_THE_LOOP = "human_in_the_loop"
|
|
197
|
+
SLEEP = "xpsleep-agent-delay"
|
|
198
|
+
CUSTOM_AGENT = "custom_agent"
|
|
199
|
+
STORAGE = "storage"
|
|
200
|
+
CODING_AGENT = "coding_agent"
|
|
201
|
+
MCP = "mcp"
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class AgentGraphItemSubType(str, Enum):
|
|
205
|
+
"""
|
|
206
|
+
Enumeration of agent graph item subtypes.
|
|
207
|
+
|
|
208
|
+
Values:
|
|
209
|
+
SDK: SDK-based implementation.
|
|
210
|
+
TASK: Task-based implementation.
|
|
211
|
+
ASSISTANT: Assistant-based implementation.
|
|
212
|
+
WEBHOOK: Webhook-triggered implementation.
|
|
213
|
+
OPERATION: Operation-based tool.
|
|
214
|
+
CUSTOM_FUNCTION: Custom function tool.
|
|
215
|
+
LOCAL_TOOL: Local tool implementation.
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
# Source node subtypes
|
|
219
|
+
SDK = "sdk"
|
|
220
|
+
TASK = "task"
|
|
221
|
+
ASSISTANT = "assistant"
|
|
222
|
+
WEBHOOK = "webhook"
|
|
223
|
+
|
|
224
|
+
# Tool subtypes
|
|
225
|
+
OPERATION = "operation"
|
|
226
|
+
CUSTOM_FUNCTION = "custom_function"
|
|
227
|
+
LOCAL_TOOL = "local_tool"
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class AgentGraphItemAdvancedFilteringOption(BaseModel):
|
|
231
|
+
"""
|
|
232
|
+
Model for advanced filtering options in agent graph items.
|
|
233
|
+
|
|
234
|
+
Attributes:
|
|
235
|
+
returnables (Optional[List[str]]): List of returnable fields.
|
|
236
|
+
searchables (Optional[List[str]]): List of searchable fields.
|
|
237
|
+
globally_enabled (Optional[bool]): Whether filtering is globally enabled.
|
|
238
|
+
"""
|
|
239
|
+
|
|
240
|
+
returnables: Optional[List[str]] = None
|
|
241
|
+
searchables: Optional[List[str]] = None
|
|
242
|
+
globally_enabled: Optional[bool] = False
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class AgentGraphItemSchema(BaseModel):
|
|
246
|
+
"""
|
|
247
|
+
Model for defining input/output schemas for agent graph items.
|
|
248
|
+
|
|
249
|
+
Attributes:
|
|
250
|
+
input (Optional[dict]): Input schema definition.
|
|
251
|
+
output (Optional[dict]): Output schema definition.
|
|
252
|
+
"""
|
|
253
|
+
|
|
254
|
+
input: Optional[dict] = None
|
|
255
|
+
output: Optional[dict] = None
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class AgentHITLType(str, Enum):
|
|
259
|
+
"""
|
|
260
|
+
Enumeration of Human-in-the-Loop integration types.
|
|
261
|
+
|
|
262
|
+
Values:
|
|
263
|
+
SLACK: Slack integration for human approval.
|
|
264
|
+
"""
|
|
265
|
+
|
|
266
|
+
SLACK = "slack"
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class AgentGraphItemHITLSettings(BaseModel):
|
|
270
|
+
"""
|
|
271
|
+
Model for Human-in-the-Loop settings in agent graph items.
|
|
272
|
+
|
|
273
|
+
Attributes:
|
|
274
|
+
title (Optional[str]): Title for the HITL request.
|
|
275
|
+
description (Optional[str]): Description of what requires approval.
|
|
276
|
+
recipients (Optional[List[str]]): List of recipient IDs for approval requests.
|
|
277
|
+
hitl_type (Optional[AgentHITLType]): Type of HITL integration.
|
|
278
|
+
slack_app (Optional[str]): Slack app identifier for notifications.
|
|
279
|
+
should_approve_with_current_user (Optional[bool]): Whether to auto-approve with current user.
|
|
280
|
+
"""
|
|
281
|
+
|
|
282
|
+
title: Optional[str] = None
|
|
283
|
+
description: Optional[str] = None
|
|
284
|
+
recipients: Optional[List[str]] = None
|
|
285
|
+
hitl_type: Optional[AgentHITLType] = None
|
|
286
|
+
slack_app: Optional[str] = None
|
|
287
|
+
should_approve_with_current_user: Optional[bool] = True
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class AgentGraphItemA2ASettings(BaseModel):
|
|
291
|
+
"""
|
|
292
|
+
Model for Agent-to-Agent communication settings.
|
|
293
|
+
|
|
294
|
+
Attributes:
|
|
295
|
+
url (Optional[str]): URL endpoint for A2A communication.
|
|
296
|
+
"""
|
|
297
|
+
|
|
298
|
+
url: Optional[str] = None
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
class AgentGraphItemCodingAgentSettings(BaseModel):
|
|
302
|
+
"""
|
|
303
|
+
Model for coding agent specific settings.
|
|
304
|
+
|
|
305
|
+
Attributes:
|
|
306
|
+
type (Optional[Literal["codex"]]): Type of coding agent, defaults to "codex".
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
type: Optional[Literal["codex"]] = "codex"
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
class AgentGraphItemSettings(BaseModel):
|
|
313
|
+
"""
|
|
314
|
+
Comprehensive settings model for agent graph items.
|
|
315
|
+
|
|
316
|
+
This model consolidates all possible settings for different types of
|
|
317
|
+
agent graph items, including instructions, schemas, and specialized configurations.
|
|
318
|
+
|
|
319
|
+
Attributes:
|
|
320
|
+
instructions (Optional[str]): Specific instructions for this graph item.
|
|
321
|
+
description (Optional[str]): Description of the graph item's purpose.
|
|
322
|
+
schemas (Optional[AgentGraphItemSchema]): Input/output schemas.
|
|
323
|
+
advanced_filtering_options (Optional[AgentGraphItemAdvancedFilteringOption]): Advanced filtering settings.
|
|
324
|
+
hitl_options (Optional[AgentGraphItemHITLSettings]): Human-in-the-loop settings.
|
|
325
|
+
a2a_options (Optional[AgentGraphItemA2ASettings]): Agent-to-agent communication settings.
|
|
326
|
+
coding_agent_settings (Optional[AgentGraphItemCodingAgentSettings]): Coding agent specific settings.
|
|
327
|
+
mcp_settings (Optional[MCPServerDetails]): Model Context Protocol settings.
|
|
328
|
+
"""
|
|
329
|
+
|
|
330
|
+
instructions: Optional[str] = None
|
|
331
|
+
description: Optional[str] = None
|
|
332
|
+
schemas: Optional[AgentGraphItemSchema] = None
|
|
333
|
+
advanced_filtering_options: Optional[AgentGraphItemAdvancedFilteringOption] = None
|
|
334
|
+
hitl_options: Optional[AgentGraphItemHITLSettings] = None
|
|
335
|
+
a2a_options: Optional[AgentGraphItemA2ASettings] = None
|
|
336
|
+
coding_agent_settings: Optional[AgentGraphItemCodingAgentSettings] = None
|
|
337
|
+
mcp_settings: Optional[MCPServerDetails] = None
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
class AgentGraphItemLLMSettings(BaseModel):
|
|
341
|
+
"""
|
|
342
|
+
Model for LLM (Large Language Model) settings in agent graph items.
|
|
343
|
+
|
|
344
|
+
Attributes:
|
|
345
|
+
type (Literal["before", "after"]): When to apply LLM processing.
|
|
346
|
+
provider (Optional[str]): LLM provider name, defaults to "openai".
|
|
347
|
+
model (Optional[str]): Specific model name, defaults to "gpt-4.1".
|
|
348
|
+
temperature (Optional[float]): Model temperature setting, defaults to 0.0.
|
|
349
|
+
"""
|
|
350
|
+
|
|
351
|
+
type: Literal["before", "after"]
|
|
352
|
+
provider: Optional[str] = "openai"
|
|
353
|
+
model: Optional[str] = "gpt-4.1"
|
|
354
|
+
temperature: Optional[float] = 0.0
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
class AgentGraphItem(BaseModel):
|
|
358
|
+
"""
|
|
359
|
+
Model representing a single item in an agent's execution graph.
|
|
360
|
+
|
|
361
|
+
This model defines a node in the agent's execution graph, including its
|
|
362
|
+
configuration, connections, and processing settings.
|
|
363
|
+
|
|
364
|
+
Attributes:
|
|
365
|
+
id (Optional[str]): Unique identifier for the graph item.
|
|
366
|
+
item_id (str): Reference ID for the underlying item.
|
|
367
|
+
name (Optional[str]): Human-readable name for the graph item.
|
|
368
|
+
type (AgentGraphItemType): Type of the graph item.
|
|
369
|
+
sub_type (Optional[AgentGraphItemSubType]): Subtype for more specific categorization.
|
|
370
|
+
targets (List[str]): List of target graph item IDs for execution flow.
|
|
371
|
+
settings (Optional[AgentGraphItemSettings]): Configuration settings for the item.
|
|
372
|
+
llm_settings (Optional[List[AgentGraphItemLLMSettings]]): LLM processing settings.
|
|
373
|
+
is_first (Optional[bool]): Whether this is the first item in the execution graph.
|
|
374
|
+
"""
|
|
375
|
+
|
|
376
|
+
id: Optional[str] = None
|
|
377
|
+
item_id: str
|
|
378
|
+
name: Optional[str] = None
|
|
379
|
+
type: AgentGraphItemType
|
|
380
|
+
sub_type: Optional[AgentGraphItemSubType] = None
|
|
381
|
+
targets: List[str]
|
|
382
|
+
settings: Optional[AgentGraphItemSettings] = None
|
|
383
|
+
llm_settings: Optional[List[AgentGraphItemLLMSettings]] = []
|
|
384
|
+
is_first: Optional[bool] = False
|
|
385
|
+
|
|
386
|
+
class LLMReasoningEffort(str, Enum):
|
|
387
|
+
Low = "low"
|
|
388
|
+
Medium = "medium"
|
|
389
|
+
High = "high"
|
|
390
|
+
|
|
391
|
+
class AIAgentConnectivityDetailsA2AAuthType(str, Enum):
|
|
392
|
+
NoAuth = "none"
|
|
393
|
+
ApiKey = "api_key"
|
|
394
|
+
Basic = "basic"
|
|
395
|
+
Bearer = "bearer"
|
|
396
|
+
|
|
397
|
+
class AIAgentConnectivityDetailsBase(XPanderSharedModel):
|
|
398
|
+
custom_headers: Optional[Dict[str, str]] = {}
|
|
399
|
+
auth_type: Optional[AIAgentConnectivityDetailsA2AAuthType] = AIAgentConnectivityDetailsA2AAuthType.NoAuth
|
|
400
|
+
api_key_header_name: Optional[str] = "X-API-Key"
|
|
401
|
+
auth_value: Optional[str] = None
|
|
402
|
+
|
|
403
|
+
class AIAgentConnectivityDetailsA2A(AIAgentConnectivityDetailsBase):
|
|
404
|
+
agent_url: str
|
|
405
|
+
|
|
406
|
+
class AIAgentConnectivityDetailsCurl(AIAgentConnectivityDetailsBase):
|
|
407
|
+
curl_command: str
|
|
408
|
+
invoke_url: Optional[str] = None # post analysis (auto populate by llm)
|
|
409
|
+
method: Optional[str] = "POST" # post analysis (auto populate by llm)
|
|
410
|
+
prompt_field_name: Optional[str] = "" # post analysis (auto populate by llm) - CAN BE SET BY THE USER
|
|
411
|
+
files_field_name: Optional[str] = "" # post analysis (auto populate by llm) - CAN BE SET BY THE USER
|
|
412
|
+
task_id_field_name: Optional[str] = "" # post analysis (auto populate by llm) - CAN BE SET BY THE USER
|
|
413
|
+
|
|
414
|
+
class AgentType(str, Enum):
|
|
415
|
+
"""
|
|
416
|
+
Enumeration of agent types.
|
|
417
|
+
|
|
418
|
+
Values:
|
|
419
|
+
Manager: Agent that manages and coordinates other agents.
|
|
420
|
+
Regular: Standard agent for individual task execution.
|
|
421
|
+
A2A: Agent that is used via A2A protocol.
|
|
422
|
+
Curl: Custom Agent that is used via curl.
|
|
423
|
+
"""
|
|
424
|
+
|
|
425
|
+
Manager = "manager"
|
|
426
|
+
Regular = "regular"
|
|
427
|
+
A2A = "a2a"
|
|
428
|
+
Curl = "curl"
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
@dataclass
|
|
432
|
+
class ConnectionURIResponse:
|
|
433
|
+
"""
|
|
434
|
+
Data class for database connection URI responses.
|
|
435
|
+
|
|
436
|
+
Attributes:
|
|
437
|
+
uri (str): The database connection URI string.
|
|
438
|
+
"""
|
|
439
|
+
|
|
440
|
+
uri: str
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
class DatabaseConnectionString(BaseModel):
|
|
444
|
+
"""
|
|
445
|
+
Model for database connection string configuration.
|
|
446
|
+
|
|
447
|
+
Attributes:
|
|
448
|
+
id (str): Unique identifier for the connection.
|
|
449
|
+
name (str): Human-readable name for the connection.
|
|
450
|
+
organization_id (Optional[str]): Organization ID associated with the connection.
|
|
451
|
+
connection_uri (Optional[ConnectionURIResponse]): Connection URI details.
|
|
452
|
+
"""
|
|
453
|
+
|
|
454
|
+
id: str
|
|
455
|
+
name: str
|
|
456
|
+
organization_id: Optional[str] = None
|
|
457
|
+
connection_uri: Optional[ConnectionURIResponse] = None
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class AgentOutput(BaseModel):
|
|
461
|
+
"""
|
|
462
|
+
Model for agent output configuration and formatting.
|
|
463
|
+
|
|
464
|
+
Attributes:
|
|
465
|
+
output_schema (Optional[Type[BaseModel]]): Pydantic model for structured output validation.
|
|
466
|
+
is_markdown (Optional[bool]): Whether output should be formatted as Markdown.
|
|
467
|
+
use_json_mode (Optional[bool]): Whether to use JSON mode for output formatting.
|
|
468
|
+
"""
|
|
469
|
+
|
|
470
|
+
output_schema: Optional[Type[BaseModel]] = None
|
|
471
|
+
is_markdown: Optional[bool] = False
|
|
472
|
+
use_json_mode: Optional[bool] = False
|
|
473
|
+
|
|
474
|
+
class LLMCredentials(XPanderSharedModel):
|
|
475
|
+
name: str
|
|
476
|
+
description: Optional[str] = None
|
|
477
|
+
value: str
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent list item model for the xpander.ai SDK.
|
|
3
|
+
|
|
4
|
+
This module contains the AgentsListItem model representing summary information
|
|
5
|
+
about agents returned in list operations, with methods to load full agent details.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from typing import Optional
|
|
10
|
+
from pydantic import BaseModel
|
|
11
|
+
|
|
12
|
+
from xpander_sdk.models.configuration import Configuration
|
|
13
|
+
from xpander_sdk.modules.agents.models.agent import (
|
|
14
|
+
AgentDeploymentType,
|
|
15
|
+
AgentInstructions,
|
|
16
|
+
AgentStatus,
|
|
17
|
+
)
|
|
18
|
+
from xpander_sdk.modules.agents.sub_modules.agent import Agent
|
|
19
|
+
from xpander_sdk.utils.event_loop import run_sync
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AgentsListItem(BaseModel):
|
|
23
|
+
"""
|
|
24
|
+
Summary representation of an agent in list operations.
|
|
25
|
+
|
|
26
|
+
This model contains essential information about an agent as returned by
|
|
27
|
+
list operations, providing enough detail for display and selection purposes
|
|
28
|
+
while allowing for efficient loading of the full agent when needed.
|
|
29
|
+
|
|
30
|
+
Attributes:
|
|
31
|
+
id (str): Unique identifier for the agent.
|
|
32
|
+
name (str): Human-readable name of the agent.
|
|
33
|
+
icon (str): Icon identifier or URL for the agent.
|
|
34
|
+
instructions (AgentInstructions): Basic instructions and configuration for the agent.
|
|
35
|
+
status (AgentStatus): Current operational status of the agent.
|
|
36
|
+
organization_id (str): ID of the organization that owns the agent.
|
|
37
|
+
created_at (datetime): Timestamp when the agent was created.
|
|
38
|
+
description (Optional[str]): Optional detailed description of the agent.
|
|
39
|
+
|
|
40
|
+
Methods:
|
|
41
|
+
aload: Asynchronously load the full agent details.
|
|
42
|
+
load: Synchronously load the full agent details.
|
|
43
|
+
|
|
44
|
+
Example:
|
|
45
|
+
>>> agents = Agents()
|
|
46
|
+
>>> agent_list = agents.list()
|
|
47
|
+
>>> for item in agent_list:
|
|
48
|
+
... print(f"Agent: {item.name} (Status: {item.status})")
|
|
49
|
+
... full_agent = item.load() # Load complete agent details
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
id: str
|
|
53
|
+
name: str
|
|
54
|
+
icon: str
|
|
55
|
+
instructions: AgentInstructions
|
|
56
|
+
status: AgentStatus
|
|
57
|
+
organization_id: str
|
|
58
|
+
created_at: datetime
|
|
59
|
+
description: Optional[str] = None
|
|
60
|
+
|
|
61
|
+
async def aload(self, configuration: Optional[Configuration] = None) -> Agent:
|
|
62
|
+
"""
|
|
63
|
+
Asynchronously load the complete Agent object for this agent.
|
|
64
|
+
|
|
65
|
+
This method fetches the full agent configuration, execution graph,
|
|
66
|
+
and all associated metadata from the xpander.ai platform.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
configuration (Optional[Configuration]): SDK configuration to use
|
|
70
|
+
for the request. If None, uses default configuration.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Agent: Complete agent object with full configuration and capabilities.
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
ModuleException: If the agent cannot be loaded or access is denied.
|
|
77
|
+
|
|
78
|
+
Example:
|
|
79
|
+
>>> agent_item = agent_list[0]
|
|
80
|
+
>>> full_agent = await agent_item.aload()
|
|
81
|
+
>>> result = await full_agent.aexecute("Hello, world!")
|
|
82
|
+
"""
|
|
83
|
+
return await Agent.aload(agent_id=self.id, configuration=configuration)
|
|
84
|
+
|
|
85
|
+
def load(self, configuration: Optional[Configuration] = None) -> Agent:
|
|
86
|
+
"""
|
|
87
|
+
Synchronously load the complete Agent object for this agent.
|
|
88
|
+
|
|
89
|
+
This is the synchronous version of aload(). It internally calls the
|
|
90
|
+
asynchronous method and waits for completion.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
configuration (Optional[Configuration]): SDK configuration to use
|
|
94
|
+
for the request. If None, uses default configuration.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Agent: Complete agent object with full configuration and capabilities.
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
ModuleException: If the agent cannot be loaded or access is denied.
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
>>> agent_item = agent_list[0]
|
|
104
|
+
>>> full_agent = agent_item.load()
|
|
105
|
+
>>> result = full_agent.execute("What's the weather today?")
|
|
106
|
+
"""
|
|
107
|
+
return run_sync(self.aload(configuration=configuration))
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Knowledge base models for agent integration in the xpander.ai SDK.
|
|
3
|
+
|
|
4
|
+
This module contains models that define how agents interact with knowledge bases,
|
|
5
|
+
including access permissions.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from pydantic import BaseModel
|
|
11
|
+
|
|
12
|
+
class AgentKnowledgeBase(BaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Model representing a knowledge base attached to an agent.
|
|
15
|
+
|
|
16
|
+
This model defines the relationship between an agent and a knowledge base,
|
|
17
|
+
including access permissions and usage configuration.
|
|
18
|
+
|
|
19
|
+
Attributes:
|
|
20
|
+
id (str): Unique identifier of the knowledge base.
|
|
21
|
+
rw (Optional[bool]): Read/write permissions. If True, the agent can
|
|
22
|
+
modify the knowledge base content. Defaults to False (read-only).
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
>>> kb = AgentKnowledgeBase(
|
|
26
|
+
... id="kb-123",
|
|
27
|
+
... rw=True # Agent can read and write to this knowledge base
|
|
28
|
+
... )
|
|
29
|
+
>>> print(f"Knowledge base {kb.id} - Read/Write: {kb.rw}")
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
id: str
|
|
33
|
+
rw: Optional[bool] = False
|
|
File without changes
|