xpander-sdk 2.0.151__py3-none-any.whl → 2.0.153__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xpander-sdk
3
- Version: 2.0.151
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 hasattr(message, 'role'):
313
+ if isinstance(message, AgentActivityThreadMessage):
309
314
  print(f"{message.role}: {message.content.text}")
310
- elif hasattr(message, 'tool_name'):
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 hasattr(message, 'type'):
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
@@ -78,8 +78,8 @@ xpander_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
78
78
  xpander_sdk/utils/env.py,sha256=U_zIhqWgKs5fk2-HXjAaODj4oWMc5dRQ0fvw6fqVcFk,1522
79
79
  xpander_sdk/utils/event_loop.py,sha256=kJrN0upgBhyI86tkTdfHeajznrIZl44Rl6WDiDG3GHE,2516
80
80
  xpander_sdk/utils/tools.py,sha256=lyFkq2yP7DxBkyXYVlnFRwDhQCvf0fZZMDm5fBycze4,1244
81
- xpander_sdk-2.0.151.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
82
- xpander_sdk-2.0.151.dist-info/METADATA,sha256=kU4Txnw1xWppiWtwCFrvees_Cwd-YP0HrWfssqvyVBM,12554
83
- xpander_sdk-2.0.151.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
- xpander_sdk-2.0.151.dist-info/top_level.txt,sha256=UCjnxQpsMy5Zoe7lmRuVDO6DI2V_6PgRFfm4oizRbVs,12
85
- xpander_sdk-2.0.151.dist-info/RECORD,,
81
+ xpander_sdk-2.0.153.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
82
+ xpander_sdk-2.0.153.dist-info/METADATA,sha256=fm7JEBws1xp_mnW7EUAo7Q25xbRpBAmf8q_GzvCCRtc,15312
83
+ xpander_sdk-2.0.153.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
84
+ xpander_sdk-2.0.153.dist-info/top_level.txt,sha256=UCjnxQpsMy5Zoe7lmRuVDO6DI2V_6PgRFfm4oizRbVs,12
85
+ xpander_sdk-2.0.153.dist-info/RECORD,,