xpander-sdk 2.0.151__tar.gz → 2.0.153__tar.gz
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-2.0.151 → xpander_sdk-2.0.153}/PKG-INFO +96 -4
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/README.md +95 -3
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/setup.py +1 -1
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk.egg-info/PKG-INFO +96 -4
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/LICENSE +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/pyproject.toml +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/setup.cfg +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/consts/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/consts/api_routes.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/core/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/core/module_base.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/core/state.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/core/xpander_api_client.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/exceptions/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/exceptions/module_exception.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/activity.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/configuration.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/events.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/frameworks.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/shared.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/models/user.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/agents_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/agent.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/agent_list.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/knowledge_bases.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/sub_modules/agent.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/utils/generic.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/backend_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/frameworks/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/frameworks/agno.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/frameworks/dispatch.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/utils/mcp_oauth.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/on_boot.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/on_shutdown.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/on_task.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/events_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/models/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/models/deployments.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/models/events.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/utils/generic.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/utils/git_init.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/knowledge_bases_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/models/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/models/knowledge_bases.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/sub_modules/knowledge_base.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/sub_modules/knowledge_base_document_item.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/models/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/models/task.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/models/tasks_list.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/sub_modules/task.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/tasks_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/utils/files.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/decorators/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/decorators/register_tool.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/models/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/models/mcp.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/models/tool_invocation_result.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/sub_modules/tool.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/tools_repository_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/utils/generic.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/utils/local_tools.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/utils/schemas.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/utils/__init__.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/utils/env.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/utils/event_loop.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/utils/tools.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk.egg-info/SOURCES.txt +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk.egg-info/dependency_links.txt +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk.egg-info/requires.txt +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk.egg-info/top_level.txt +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_agents_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_api_client.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_backend_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_boot_shutdown_handlers.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_configuration.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_knowledge_bases_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_tasks_module.py +0 -0
- {xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/tests/test_tools_repository.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xpander-sdk
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.153
|
|
4
4
|
Summary: xpander.ai Backend-as-a-service for AI Agents - SDK
|
|
5
5
|
Home-page: https://www.xpander.ai
|
|
6
6
|
Author: xpanderAI
|
|
@@ -296,6 +296,11 @@ async for event in task.aevents():
|
|
|
296
296
|
|
|
297
297
|
```python
|
|
298
298
|
from xpander_sdk import Task
|
|
299
|
+
from xpander_sdk.models.activity import (
|
|
300
|
+
AgentActivityThreadMessage,
|
|
301
|
+
AgentActivityThreadToolCall,
|
|
302
|
+
AgentActivityThreadReasoning
|
|
303
|
+
)
|
|
299
304
|
|
|
300
305
|
# Load a completed task
|
|
301
306
|
task = await Task.aload("task-id")
|
|
@@ -305,14 +310,14 @@ activity_log = await task.aget_activity_log()
|
|
|
305
310
|
|
|
306
311
|
# Analyze messages between user and agent
|
|
307
312
|
for message in activity_log.messages:
|
|
308
|
-
if
|
|
313
|
+
if isinstance(message, AgentActivityThreadMessage):
|
|
309
314
|
print(f"{message.role}: {message.content.text}")
|
|
310
|
-
elif
|
|
315
|
+
elif isinstance(message, AgentActivityThreadToolCall):
|
|
311
316
|
# Tool call
|
|
312
317
|
print(f"Tool: {message.tool_name}")
|
|
313
318
|
print(f"Payload: {message.payload}")
|
|
314
319
|
print(f"Result: {message.result}")
|
|
315
|
-
elif
|
|
320
|
+
elif isinstance(message, AgentActivityThreadReasoning):
|
|
316
321
|
# Reasoning step
|
|
317
322
|
print(f"Reasoning ({message.type}): {message.thought}")
|
|
318
323
|
|
|
@@ -412,6 +417,93 @@ load_dotenv()
|
|
|
412
417
|
config = Configuration()
|
|
413
418
|
```
|
|
414
419
|
|
|
420
|
+
## 🏢 Self-Hosted Deployment
|
|
421
|
+
|
|
422
|
+
If you're using a self-hosted xpander.ai deployment, configure the SDK to point to your Agent Controller endpoint.
|
|
423
|
+
|
|
424
|
+
**Important**: Use the **Agent Controller API key** generated during Helm installation, not your xpander.ai cloud API key.
|
|
425
|
+
|
|
426
|
+
### Configuration
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# Set environment variables
|
|
430
|
+
export XPANDER_API_KEY="your-agent-controller-api-key" # From Helm installation
|
|
431
|
+
export XPANDER_ORGANIZATION_ID="your-org-id"
|
|
432
|
+
export XPANDER_BASE_URL="https://agent-controller.my-company.com"
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Or configure explicitly:
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
from xpander_sdk import Configuration
|
|
439
|
+
|
|
440
|
+
config = Configuration(
|
|
441
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
442
|
+
organization_id="your-org-id",
|
|
443
|
+
base_url="https://agent-controller.my-company.com"
|
|
444
|
+
)
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Using with Agno Framework
|
|
448
|
+
|
|
449
|
+
```python
|
|
450
|
+
from xpander_sdk import Backend, Configuration
|
|
451
|
+
from agno.agent import Agent
|
|
452
|
+
|
|
453
|
+
# Configure for self-hosted
|
|
454
|
+
config = Configuration(
|
|
455
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
456
|
+
organization_id="your-org-id",
|
|
457
|
+
base_url="https://agent-controller.my-company.com"
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
# Initialize Backend with self-hosted config
|
|
461
|
+
backend = Backend(configuration=config)
|
|
462
|
+
|
|
463
|
+
# Create agent - it will use your self-hosted infrastructure
|
|
464
|
+
agno_agent = Agent(**backend.get_args(agent_id="agent-123"))
|
|
465
|
+
|
|
466
|
+
# Run agent
|
|
467
|
+
result = await agno_agent.arun(
|
|
468
|
+
input="What can you help me with?",
|
|
469
|
+
stream=True
|
|
470
|
+
)
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Complete Self-Hosted Example
|
|
474
|
+
|
|
475
|
+
```python
|
|
476
|
+
import asyncio
|
|
477
|
+
from xpander_sdk import Configuration, Agent
|
|
478
|
+
|
|
479
|
+
async def main():
|
|
480
|
+
# Configure for self-hosted deployment
|
|
481
|
+
config = Configuration(
|
|
482
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
483
|
+
organization_id="your-org-id",
|
|
484
|
+
base_url="https://agent-controller.my-company.com"
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
# Load agent from self-hosted deployment
|
|
488
|
+
agent = await Agent.aload("agent-123", configuration=config)
|
|
489
|
+
print(f"Agent: {agent.name}")
|
|
490
|
+
|
|
491
|
+
# Create and execute task
|
|
492
|
+
task = await agent.acreate_task(
|
|
493
|
+
prompt="Analyze Q4 sales data",
|
|
494
|
+
file_urls=["https://example.com/sales-q4.csv"]
|
|
495
|
+
)
|
|
496
|
+
print(f"Task created: {task.id}")
|
|
497
|
+
print(f"Status: {task.status}")
|
|
498
|
+
|
|
499
|
+
if __name__ == "__main__":
|
|
500
|
+
asyncio.run(main())
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Important**: Make sure your `base_url` points to the Agent Controller endpoint (e.g., `https://agent-controller.{your-domain}`), not the root domain.
|
|
504
|
+
|
|
505
|
+
📖 **Full Guide**: [Self-Hosted Configuration Documentation](https://docs.xpander.ai/api-reference/configuration/self-hosted)
|
|
506
|
+
|
|
415
507
|
## 🔄 Error Handling
|
|
416
508
|
|
|
417
509
|
```python
|
|
@@ -247,6 +247,11 @@ async for event in task.aevents():
|
|
|
247
247
|
|
|
248
248
|
```python
|
|
249
249
|
from xpander_sdk import Task
|
|
250
|
+
from xpander_sdk.models.activity import (
|
|
251
|
+
AgentActivityThreadMessage,
|
|
252
|
+
AgentActivityThreadToolCall,
|
|
253
|
+
AgentActivityThreadReasoning
|
|
254
|
+
)
|
|
250
255
|
|
|
251
256
|
# Load a completed task
|
|
252
257
|
task = await Task.aload("task-id")
|
|
@@ -256,14 +261,14 @@ activity_log = await task.aget_activity_log()
|
|
|
256
261
|
|
|
257
262
|
# Analyze messages between user and agent
|
|
258
263
|
for message in activity_log.messages:
|
|
259
|
-
if
|
|
264
|
+
if isinstance(message, AgentActivityThreadMessage):
|
|
260
265
|
print(f"{message.role}: {message.content.text}")
|
|
261
|
-
elif
|
|
266
|
+
elif isinstance(message, AgentActivityThreadToolCall):
|
|
262
267
|
# Tool call
|
|
263
268
|
print(f"Tool: {message.tool_name}")
|
|
264
269
|
print(f"Payload: {message.payload}")
|
|
265
270
|
print(f"Result: {message.result}")
|
|
266
|
-
elif
|
|
271
|
+
elif isinstance(message, AgentActivityThreadReasoning):
|
|
267
272
|
# Reasoning step
|
|
268
273
|
print(f"Reasoning ({message.type}): {message.thought}")
|
|
269
274
|
|
|
@@ -363,6 +368,93 @@ load_dotenv()
|
|
|
363
368
|
config = Configuration()
|
|
364
369
|
```
|
|
365
370
|
|
|
371
|
+
## 🏢 Self-Hosted Deployment
|
|
372
|
+
|
|
373
|
+
If you're using a self-hosted xpander.ai deployment, configure the SDK to point to your Agent Controller endpoint.
|
|
374
|
+
|
|
375
|
+
**Important**: Use the **Agent Controller API key** generated during Helm installation, not your xpander.ai cloud API key.
|
|
376
|
+
|
|
377
|
+
### Configuration
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Set environment variables
|
|
381
|
+
export XPANDER_API_KEY="your-agent-controller-api-key" # From Helm installation
|
|
382
|
+
export XPANDER_ORGANIZATION_ID="your-org-id"
|
|
383
|
+
export XPANDER_BASE_URL="https://agent-controller.my-company.com"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
Or configure explicitly:
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
from xpander_sdk import Configuration
|
|
390
|
+
|
|
391
|
+
config = Configuration(
|
|
392
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
393
|
+
organization_id="your-org-id",
|
|
394
|
+
base_url="https://agent-controller.my-company.com"
|
|
395
|
+
)
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Using with Agno Framework
|
|
399
|
+
|
|
400
|
+
```python
|
|
401
|
+
from xpander_sdk import Backend, Configuration
|
|
402
|
+
from agno.agent import Agent
|
|
403
|
+
|
|
404
|
+
# Configure for self-hosted
|
|
405
|
+
config = Configuration(
|
|
406
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
407
|
+
organization_id="your-org-id",
|
|
408
|
+
base_url="https://agent-controller.my-company.com"
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
# Initialize Backend with self-hosted config
|
|
412
|
+
backend = Backend(configuration=config)
|
|
413
|
+
|
|
414
|
+
# Create agent - it will use your self-hosted infrastructure
|
|
415
|
+
agno_agent = Agent(**backend.get_args(agent_id="agent-123"))
|
|
416
|
+
|
|
417
|
+
# Run agent
|
|
418
|
+
result = await agno_agent.arun(
|
|
419
|
+
input="What can you help me with?",
|
|
420
|
+
stream=True
|
|
421
|
+
)
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### Complete Self-Hosted Example
|
|
425
|
+
|
|
426
|
+
```python
|
|
427
|
+
import asyncio
|
|
428
|
+
from xpander_sdk import Configuration, Agent
|
|
429
|
+
|
|
430
|
+
async def main():
|
|
431
|
+
# Configure for self-hosted deployment
|
|
432
|
+
config = Configuration(
|
|
433
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
434
|
+
organization_id="your-org-id",
|
|
435
|
+
base_url="https://agent-controller.my-company.com"
|
|
436
|
+
)
|
|
437
|
+
|
|
438
|
+
# Load agent from self-hosted deployment
|
|
439
|
+
agent = await Agent.aload("agent-123", configuration=config)
|
|
440
|
+
print(f"Agent: {agent.name}")
|
|
441
|
+
|
|
442
|
+
# Create and execute task
|
|
443
|
+
task = await agent.acreate_task(
|
|
444
|
+
prompt="Analyze Q4 sales data",
|
|
445
|
+
file_urls=["https://example.com/sales-q4.csv"]
|
|
446
|
+
)
|
|
447
|
+
print(f"Task created: {task.id}")
|
|
448
|
+
print(f"Status: {task.status}")
|
|
449
|
+
|
|
450
|
+
if __name__ == "__main__":
|
|
451
|
+
asyncio.run(main())
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**Important**: Make sure your `base_url` points to the Agent Controller endpoint (e.g., `https://agent-controller.{your-domain}`), not the root domain.
|
|
455
|
+
|
|
456
|
+
📖 **Full Guide**: [Self-Hosted Configuration Documentation](https://docs.xpander.ai/api-reference/configuration/self-hosted)
|
|
457
|
+
|
|
366
458
|
## 🔄 Error Handling
|
|
367
459
|
|
|
368
460
|
```python
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xpander-sdk
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.153
|
|
4
4
|
Summary: xpander.ai Backend-as-a-service for AI Agents - SDK
|
|
5
5
|
Home-page: https://www.xpander.ai
|
|
6
6
|
Author: xpanderAI
|
|
@@ -296,6 +296,11 @@ async for event in task.aevents():
|
|
|
296
296
|
|
|
297
297
|
```python
|
|
298
298
|
from xpander_sdk import Task
|
|
299
|
+
from xpander_sdk.models.activity import (
|
|
300
|
+
AgentActivityThreadMessage,
|
|
301
|
+
AgentActivityThreadToolCall,
|
|
302
|
+
AgentActivityThreadReasoning
|
|
303
|
+
)
|
|
299
304
|
|
|
300
305
|
# Load a completed task
|
|
301
306
|
task = await Task.aload("task-id")
|
|
@@ -305,14 +310,14 @@ activity_log = await task.aget_activity_log()
|
|
|
305
310
|
|
|
306
311
|
# Analyze messages between user and agent
|
|
307
312
|
for message in activity_log.messages:
|
|
308
|
-
if
|
|
313
|
+
if isinstance(message, AgentActivityThreadMessage):
|
|
309
314
|
print(f"{message.role}: {message.content.text}")
|
|
310
|
-
elif
|
|
315
|
+
elif isinstance(message, AgentActivityThreadToolCall):
|
|
311
316
|
# Tool call
|
|
312
317
|
print(f"Tool: {message.tool_name}")
|
|
313
318
|
print(f"Payload: {message.payload}")
|
|
314
319
|
print(f"Result: {message.result}")
|
|
315
|
-
elif
|
|
320
|
+
elif isinstance(message, AgentActivityThreadReasoning):
|
|
316
321
|
# Reasoning step
|
|
317
322
|
print(f"Reasoning ({message.type}): {message.thought}")
|
|
318
323
|
|
|
@@ -412,6 +417,93 @@ load_dotenv()
|
|
|
412
417
|
config = Configuration()
|
|
413
418
|
```
|
|
414
419
|
|
|
420
|
+
## 🏢 Self-Hosted Deployment
|
|
421
|
+
|
|
422
|
+
If you're using a self-hosted xpander.ai deployment, configure the SDK to point to your Agent Controller endpoint.
|
|
423
|
+
|
|
424
|
+
**Important**: Use the **Agent Controller API key** generated during Helm installation, not your xpander.ai cloud API key.
|
|
425
|
+
|
|
426
|
+
### Configuration
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# Set environment variables
|
|
430
|
+
export XPANDER_API_KEY="your-agent-controller-api-key" # From Helm installation
|
|
431
|
+
export XPANDER_ORGANIZATION_ID="your-org-id"
|
|
432
|
+
export XPANDER_BASE_URL="https://agent-controller.my-company.com"
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Or configure explicitly:
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
from xpander_sdk import Configuration
|
|
439
|
+
|
|
440
|
+
config = Configuration(
|
|
441
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
442
|
+
organization_id="your-org-id",
|
|
443
|
+
base_url="https://agent-controller.my-company.com"
|
|
444
|
+
)
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Using with Agno Framework
|
|
448
|
+
|
|
449
|
+
```python
|
|
450
|
+
from xpander_sdk import Backend, Configuration
|
|
451
|
+
from agno.agent import Agent
|
|
452
|
+
|
|
453
|
+
# Configure for self-hosted
|
|
454
|
+
config = Configuration(
|
|
455
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
456
|
+
organization_id="your-org-id",
|
|
457
|
+
base_url="https://agent-controller.my-company.com"
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
# Initialize Backend with self-hosted config
|
|
461
|
+
backend = Backend(configuration=config)
|
|
462
|
+
|
|
463
|
+
# Create agent - it will use your self-hosted infrastructure
|
|
464
|
+
agno_agent = Agent(**backend.get_args(agent_id="agent-123"))
|
|
465
|
+
|
|
466
|
+
# Run agent
|
|
467
|
+
result = await agno_agent.arun(
|
|
468
|
+
input="What can you help me with?",
|
|
469
|
+
stream=True
|
|
470
|
+
)
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Complete Self-Hosted Example
|
|
474
|
+
|
|
475
|
+
```python
|
|
476
|
+
import asyncio
|
|
477
|
+
from xpander_sdk import Configuration, Agent
|
|
478
|
+
|
|
479
|
+
async def main():
|
|
480
|
+
# Configure for self-hosted deployment
|
|
481
|
+
config = Configuration(
|
|
482
|
+
api_key="your-agent-controller-api-key", # From Helm installation
|
|
483
|
+
organization_id="your-org-id",
|
|
484
|
+
base_url="https://agent-controller.my-company.com"
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
# Load agent from self-hosted deployment
|
|
488
|
+
agent = await Agent.aload("agent-123", configuration=config)
|
|
489
|
+
print(f"Agent: {agent.name}")
|
|
490
|
+
|
|
491
|
+
# Create and execute task
|
|
492
|
+
task = await agent.acreate_task(
|
|
493
|
+
prompt="Analyze Q4 sales data",
|
|
494
|
+
file_urls=["https://example.com/sales-q4.csv"]
|
|
495
|
+
)
|
|
496
|
+
print(f"Task created: {task.id}")
|
|
497
|
+
print(f"Status: {task.status}")
|
|
498
|
+
|
|
499
|
+
if __name__ == "__main__":
|
|
500
|
+
asyncio.run(main())
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
**Important**: Make sure your `base_url` points to the Agent Controller endpoint (e.g., `https://agent-controller.{your-domain}`), not the root domain.
|
|
504
|
+
|
|
505
|
+
📖 **Full Guide**: [Self-Hosted Configuration Documentation](https://docs.xpander.ai/api-reference/configuration/self-hosted)
|
|
506
|
+
|
|
415
507
|
## 🔄 Error Handling
|
|
416
508
|
|
|
417
509
|
```python
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/agent_list.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/models/knowledge_bases.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/sub_modules/__init__.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/sub_modules/agent.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/agents/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/backend_module.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/frameworks/__init__.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/frameworks/agno.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/frameworks/dispatch.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/utils/__init__.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/backend/utils/mcp_oauth.py
RENAMED
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/__init__.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/on_boot.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/on_shutdown.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/decorators/on_task.py
RENAMED
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/models/__init__.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/models/deployments.py
RENAMED
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/utils/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/events/utils/git_init.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/knowledge_bases/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/models/tasks_list.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/sub_modules/__init__.py
RENAMED
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tasks/sub_modules/task.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{xpander_sdk-2.0.151 → xpander_sdk-2.0.153}/src/xpander_sdk/modules/tools_repository/models/mcp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|