xpander-sdk 2.0.145__tar.gz → 2.0.157__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.145 → xpander_sdk-2.0.157}/PKG-INFO +130 -4
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/README.md +129 -3
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/setup.py +1 -1
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/consts/api_routes.py +1 -0
- xpander_sdk-2.0.157/src/xpander_sdk/models/activity.py +65 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/models/agent.py +4 -1
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/sub_modules/agent.py +5 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/frameworks/agno.py +8 -2
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/utils/mcp_oauth.py +1 -1
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/sub_modules/task.py +163 -78
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/models/mcp.py +1 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/tools_repository_module.py +6 -2
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk.egg-info/PKG-INFO +130 -4
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk.egg-info/SOURCES.txt +1 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/LICENSE +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/pyproject.toml +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/setup.cfg +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/consts/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/core/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/core/module_base.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/core/state.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/core/xpander_api_client.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/exceptions/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/exceptions/module_exception.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/models/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/models/configuration.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/models/events.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/models/frameworks.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/models/shared.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/models/user.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/agents_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/models/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/models/agent_list.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/models/knowledge_bases.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/utils/generic.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/backend_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/frameworks/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/frameworks/dispatch.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/decorators/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/decorators/on_boot.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/decorators/on_shutdown.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/decorators/on_task.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/events_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/models/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/models/deployments.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/models/events.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/utils/generic.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/events/utils/git_init.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/knowledge_bases_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/models/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/models/knowledge_bases.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/sub_modules/knowledge_base.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/sub_modules/knowledge_base_document_item.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/knowledge_bases/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/models/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/models/task.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/models/tasks_list.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/tasks_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tasks/utils/files.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/decorators/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/decorators/register_tool.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/models/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/models/tool_invocation_result.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/sub_modules/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/sub_modules/tool.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/utils/generic.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/utils/local_tools.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/tools_repository/utils/schemas.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/utils/__init__.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/utils/env.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/utils/event_loop.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/utils/tools.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk.egg-info/dependency_links.txt +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk.egg-info/requires.txt +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk.egg-info/top_level.txt +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_agents_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_api_client.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_backend_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_boot_shutdown_handlers.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_configuration.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_knowledge_bases_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/tests/test_tasks_module.py +0 -0
- {xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/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.157
|
|
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
|
|
@@ -131,6 +131,11 @@ tasks = Tasks(configuration=config)
|
|
|
131
131
|
task = await tasks.aget("task-id")
|
|
132
132
|
await task.aset_status(AgentExecutionStatus.Running)
|
|
133
133
|
await task.asave()
|
|
134
|
+
|
|
135
|
+
# Retrieve task activity log
|
|
136
|
+
activity_log = await task.aget_activity_log()
|
|
137
|
+
for message in activity_log.messages:
|
|
138
|
+
print(f"{message.role}: {message.content.text}")
|
|
134
139
|
```
|
|
135
140
|
|
|
136
141
|
### 4. Tools Integration
|
|
@@ -287,6 +292,40 @@ async for event in task.aevents():
|
|
|
287
292
|
print(f"Event Data: {event.data}")
|
|
288
293
|
```
|
|
289
294
|
|
|
295
|
+
### Task Activity Monitoring
|
|
296
|
+
|
|
297
|
+
```python
|
|
298
|
+
from xpander_sdk import Task
|
|
299
|
+
from xpander_sdk.models.activity import (
|
|
300
|
+
AgentActivityThreadMessage,
|
|
301
|
+
AgentActivityThreadToolCall,
|
|
302
|
+
AgentActivityThreadReasoning
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
# Load a completed task
|
|
306
|
+
task = await Task.aload("task-id")
|
|
307
|
+
|
|
308
|
+
# Get detailed activity log
|
|
309
|
+
activity_log = await task.aget_activity_log()
|
|
310
|
+
|
|
311
|
+
# Analyze messages between user and agent
|
|
312
|
+
for message in activity_log.messages:
|
|
313
|
+
if isinstance(message, AgentActivityThreadMessage):
|
|
314
|
+
print(f"{message.role}: {message.content.text}")
|
|
315
|
+
elif isinstance(message, AgentActivityThreadToolCall):
|
|
316
|
+
# Tool call
|
|
317
|
+
print(f"Tool: {message.tool_name}")
|
|
318
|
+
print(f"Payload: {message.payload}")
|
|
319
|
+
print(f"Result: {message.result}")
|
|
320
|
+
elif isinstance(message, AgentActivityThreadReasoning):
|
|
321
|
+
# Reasoning step
|
|
322
|
+
print(f"Reasoning ({message.type}): {message.thought}")
|
|
323
|
+
|
|
324
|
+
# Synchronous version
|
|
325
|
+
task = Task.load("task-id")
|
|
326
|
+
activity_log = task.get_activity_log()
|
|
327
|
+
```
|
|
328
|
+
|
|
290
329
|
### Local Task Testing
|
|
291
330
|
|
|
292
331
|
```python
|
|
@@ -378,6 +417,93 @@ load_dotenv()
|
|
|
378
417
|
config = Configuration()
|
|
379
418
|
```
|
|
380
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
|
+
|
|
381
507
|
## 🔄 Error Handling
|
|
382
508
|
|
|
383
509
|
```python
|
|
@@ -392,9 +518,9 @@ except ModuleException as e:
|
|
|
392
518
|
## 🤝 Contributing
|
|
393
519
|
|
|
394
520
|
1. Fork the repository
|
|
395
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
396
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
397
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
521
|
+
2. Create a feature branch (`git checkout -b feature/{base_branch}/amazing-feature`)
|
|
522
|
+
3. Commit your changes (`git commit -m 'feat/chore/fix: Add amazing feature'`)
|
|
523
|
+
4. Push to the branch (`git push origin feature/{base_branch}/amazing-feature`)
|
|
398
524
|
5. Open a Pull Request
|
|
399
525
|
|
|
400
526
|
## 📄 License
|
|
@@ -82,6 +82,11 @@ tasks = Tasks(configuration=config)
|
|
|
82
82
|
task = await tasks.aget("task-id")
|
|
83
83
|
await task.aset_status(AgentExecutionStatus.Running)
|
|
84
84
|
await task.asave()
|
|
85
|
+
|
|
86
|
+
# Retrieve task activity log
|
|
87
|
+
activity_log = await task.aget_activity_log()
|
|
88
|
+
for message in activity_log.messages:
|
|
89
|
+
print(f"{message.role}: {message.content.text}")
|
|
85
90
|
```
|
|
86
91
|
|
|
87
92
|
### 4. Tools Integration
|
|
@@ -238,6 +243,40 @@ async for event in task.aevents():
|
|
|
238
243
|
print(f"Event Data: {event.data}")
|
|
239
244
|
```
|
|
240
245
|
|
|
246
|
+
### Task Activity Monitoring
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
from xpander_sdk import Task
|
|
250
|
+
from xpander_sdk.models.activity import (
|
|
251
|
+
AgentActivityThreadMessage,
|
|
252
|
+
AgentActivityThreadToolCall,
|
|
253
|
+
AgentActivityThreadReasoning
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
# Load a completed task
|
|
257
|
+
task = await Task.aload("task-id")
|
|
258
|
+
|
|
259
|
+
# Get detailed activity log
|
|
260
|
+
activity_log = await task.aget_activity_log()
|
|
261
|
+
|
|
262
|
+
# Analyze messages between user and agent
|
|
263
|
+
for message in activity_log.messages:
|
|
264
|
+
if isinstance(message, AgentActivityThreadMessage):
|
|
265
|
+
print(f"{message.role}: {message.content.text}")
|
|
266
|
+
elif isinstance(message, AgentActivityThreadToolCall):
|
|
267
|
+
# Tool call
|
|
268
|
+
print(f"Tool: {message.tool_name}")
|
|
269
|
+
print(f"Payload: {message.payload}")
|
|
270
|
+
print(f"Result: {message.result}")
|
|
271
|
+
elif isinstance(message, AgentActivityThreadReasoning):
|
|
272
|
+
# Reasoning step
|
|
273
|
+
print(f"Reasoning ({message.type}): {message.thought}")
|
|
274
|
+
|
|
275
|
+
# Synchronous version
|
|
276
|
+
task = Task.load("task-id")
|
|
277
|
+
activity_log = task.get_activity_log()
|
|
278
|
+
```
|
|
279
|
+
|
|
241
280
|
### Local Task Testing
|
|
242
281
|
|
|
243
282
|
```python
|
|
@@ -329,6 +368,93 @@ load_dotenv()
|
|
|
329
368
|
config = Configuration()
|
|
330
369
|
```
|
|
331
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
|
+
|
|
332
458
|
## 🔄 Error Handling
|
|
333
459
|
|
|
334
460
|
```python
|
|
@@ -343,9 +469,9 @@ except ModuleException as e:
|
|
|
343
469
|
## 🤝 Contributing
|
|
344
470
|
|
|
345
471
|
1. Fork the repository
|
|
346
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
347
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
348
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
472
|
+
2. Create a feature branch (`git checkout -b feature/{base_branch}/amazing-feature`)
|
|
473
|
+
3. Commit your changes (`git commit -m 'feat/chore/fix: Add amazing feature'`)
|
|
474
|
+
4. Push to the branch (`git push origin feature/{base_branch}/amazing-feature`)
|
|
349
475
|
5. Open a Pull Request
|
|
350
476
|
|
|
351
477
|
## 📄 License
|
|
@@ -35,6 +35,7 @@ and deleting resources.
|
|
|
35
35
|
ListTasks = "/agent-execution/executions/history/{agent_id}"
|
|
36
36
|
ListUserTasks = "/agent-execution/executions/history/user/{user_id}"
|
|
37
37
|
GetTask = "/agent-execution/{task_id}/status"
|
|
38
|
+
GetTaskActivityLog = "/activity/{agent_id}/{task_id}"
|
|
38
39
|
TaskCrud = "/agent-execution/{agent_or_task_id}"
|
|
39
40
|
UpdateTask = "/agent-execution/{task_id}/update"
|
|
40
41
|
ReportExternalTask = "/agent-execution/{agent_id}/report_task"
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from typing import Any, List, Literal, Optional, Union
|
|
4
|
+
|
|
5
|
+
from xpander_sdk.models.events import ToolCallRequestReasoning
|
|
6
|
+
from xpander_sdk.models.shared import XPanderSharedModel
|
|
7
|
+
from xpander_sdk.models.user import User
|
|
8
|
+
from xpander_sdk.modules.tools_repository.models.mcp import MCPOAuthGetTokenResponse
|
|
9
|
+
|
|
10
|
+
class AgentActivityThreadMessageContent(XPanderSharedModel):
|
|
11
|
+
text: Optional[str] = None
|
|
12
|
+
files: Optional[List[str]] = []
|
|
13
|
+
|
|
14
|
+
class AgentActivityThreadMessage(XPanderSharedModel):
|
|
15
|
+
id: str
|
|
16
|
+
created_at: datetime
|
|
17
|
+
role: Literal["user","agent"]
|
|
18
|
+
content: AgentActivityThreadMessageContent
|
|
19
|
+
|
|
20
|
+
class AgentActivityThreadToolCall(XPanderSharedModel):
|
|
21
|
+
id: str
|
|
22
|
+
created_at: datetime
|
|
23
|
+
tool_name: str
|
|
24
|
+
payload: Any
|
|
25
|
+
is_error: Optional[bool] = False
|
|
26
|
+
reasoning: Optional[ToolCallRequestReasoning] = None
|
|
27
|
+
result: Optional[Any] = None
|
|
28
|
+
|
|
29
|
+
class AgentActivityThreadReasoningType(str, Enum):
|
|
30
|
+
Think = "think"
|
|
31
|
+
Analyze = "analyze"
|
|
32
|
+
|
|
33
|
+
class AgentActivityThreadReasoning(XPanderSharedModel):
|
|
34
|
+
id: str
|
|
35
|
+
created_at: datetime
|
|
36
|
+
type: AgentActivityThreadReasoningType
|
|
37
|
+
title: str
|
|
38
|
+
confidence: float
|
|
39
|
+
thought: Optional[str] = None
|
|
40
|
+
action: Optional[str] = None
|
|
41
|
+
result: Optional[str] = None
|
|
42
|
+
analysis: Optional[str] = None
|
|
43
|
+
|
|
44
|
+
class AgentActivityThreadSubAgentTrigger(XPanderSharedModel):
|
|
45
|
+
id: str
|
|
46
|
+
created_at: datetime
|
|
47
|
+
agent_id: str
|
|
48
|
+
query: Optional[str] = None
|
|
49
|
+
files: Optional[List[str]] = []
|
|
50
|
+
reasoning: ToolCallRequestReasoning
|
|
51
|
+
|
|
52
|
+
class AgentActivityThreadAuth(MCPOAuthGetTokenResponse):
|
|
53
|
+
id: str
|
|
54
|
+
created_at: datetime
|
|
55
|
+
|
|
56
|
+
AgentActivityThreadMessageType = Union[AgentActivityThreadMessage, AgentActivityThreadToolCall, AgentActivityThreadReasoning, AgentActivityThreadSubAgentTrigger, AgentActivityThreadAuth]
|
|
57
|
+
class AgentActivityThread(XPanderSharedModel):
|
|
58
|
+
id: str
|
|
59
|
+
created_at: datetime
|
|
60
|
+
messages: List[AgentActivityThreadMessageType]
|
|
61
|
+
user: Optional[User] = None
|
|
62
|
+
|
|
63
|
+
class AgentActivityThreadListItem(XPanderSharedModel):
|
|
64
|
+
id: str
|
|
65
|
+
created_at: datetime
|
|
@@ -383,7 +383,10 @@ class AgentGraphItem(BaseModel):
|
|
|
383
383
|
llm_settings: Optional[List[AgentGraphItemLLMSettings]] = []
|
|
384
384
|
is_first: Optional[bool] = False
|
|
385
385
|
|
|
386
|
-
|
|
386
|
+
class LLMReasoningEffort(str, Enum):
|
|
387
|
+
Low = "low"
|
|
388
|
+
Medium = "medium"
|
|
389
|
+
High = "high"
|
|
387
390
|
|
|
388
391
|
class AIAgentConnectivityDetailsA2AAuthType(str, Enum):
|
|
389
392
|
NoAuth = "none"
|
{xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/agents/sub_modules/agent.py
RENAMED
|
@@ -40,6 +40,7 @@ from xpander_sdk.modules.agents.models.agent import (
|
|
|
40
40
|
AgentType,
|
|
41
41
|
DatabaseConnectionString,
|
|
42
42
|
LLMCredentials,
|
|
43
|
+
LLMReasoningEffort,
|
|
43
44
|
)
|
|
44
45
|
from xpander_sdk.modules.agents.models.knowledge_bases import AgentKnowledgeBase
|
|
45
46
|
from xpander_sdk.modules.knowledge_bases.knowledge_bases_module import KnowledgeBases
|
|
@@ -151,6 +152,8 @@ class Agent(XPanderSharedModel):
|
|
|
151
152
|
using_nemo: Optional[bool]
|
|
152
153
|
model_provider: str
|
|
153
154
|
model_name: str
|
|
155
|
+
llm_reasoning_effort: Optional[LLMReasoningEffort] = LLMReasoningEffort.Medium
|
|
156
|
+
deep_plan: Optional[bool] = False
|
|
154
157
|
llm_api_base: Optional[str]
|
|
155
158
|
webhook_url: Optional[str]
|
|
156
159
|
created_at: Optional[datetime]
|
|
@@ -192,6 +195,8 @@ class Agent(XPanderSharedModel):
|
|
|
192
195
|
using_nemo: Optional[bool] = False
|
|
193
196
|
model_provider: str
|
|
194
197
|
model_name: str
|
|
198
|
+
llm_reasoning_effort: Optional[LLMReasoningEffort] = LLMReasoningEffort.Medium
|
|
199
|
+
deep_plan: Optional[bool] = False
|
|
195
200
|
llm_api_base: Optional[str] = None
|
|
196
201
|
webhook_url: Optional[str] = None
|
|
197
202
|
created_at: Optional[datetime] = None
|
{xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/frameworks/agno.py
RENAMED
|
@@ -8,7 +8,7 @@ from loguru import logger
|
|
|
8
8
|
from xpander_sdk import Configuration
|
|
9
9
|
from xpander_sdk.models.shared import OutputFormat, ThinkMode
|
|
10
10
|
from xpander_sdk.modules.agents.agents_module import Agents
|
|
11
|
-
from xpander_sdk.modules.agents.models.agent import AgentGraphItemType
|
|
11
|
+
from xpander_sdk.modules.agents.models.agent import AgentGraphItemType, LLMReasoningEffort
|
|
12
12
|
from xpander_sdk.modules.agents.sub_modules.agent import Agent
|
|
13
13
|
from xpander_sdk.modules.backend.utils.mcp_oauth import authenticate_mcp_server
|
|
14
14
|
from xpander_sdk.modules.tasks.sub_modules.task import Task
|
|
@@ -278,6 +278,10 @@ def _load_llm_model(agent: Agent, override: Optional[Dict[str, Any]]) -> Any:
|
|
|
278
278
|
return env_llm_key or agent.llm_credentials.value
|
|
279
279
|
|
|
280
280
|
llm_args = {}
|
|
281
|
+
|
|
282
|
+
if agent.llm_reasoning_effort and agent.llm_reasoning_effort != LLMReasoningEffort.Medium and agent.model_name and "gpt-5" in agent.model_name.lower():
|
|
283
|
+
llm_args = { "reasoning_effort": agent.llm_reasoning_effort.value }
|
|
284
|
+
|
|
281
285
|
if agent.llm_api_base and len(agent.llm_api_base) != 0:
|
|
282
286
|
llm_args["base_url"] = agent.llm_api_base
|
|
283
287
|
|
|
@@ -579,6 +583,7 @@ async def _resolve_agent_tools(agent: Agent, task: Optional[Task] = None) -> Lis
|
|
|
579
583
|
),
|
|
580
584
|
include_tools=mcp.allowed_tools or None,
|
|
581
585
|
timeout_seconds=120,
|
|
586
|
+
tool_name_prefix="mcp_tool"
|
|
582
587
|
)
|
|
583
588
|
)
|
|
584
589
|
elif mcp.url:
|
|
@@ -612,7 +617,8 @@ async def _resolve_agent_tools(agent: Agent, task: Optional[Task] = None) -> Lis
|
|
|
612
617
|
transport=transport,
|
|
613
618
|
server_params=params_cls(url=mcp.url, headers=mcp.headers),
|
|
614
619
|
include_tools=mcp.allowed_tools or None,
|
|
615
|
-
timeout_seconds=120
|
|
620
|
+
timeout_seconds=120,
|
|
621
|
+
tool_name_prefix="mcp_tool"
|
|
616
622
|
)
|
|
617
623
|
)
|
|
618
624
|
|
{xpander_sdk-2.0.145 → xpander_sdk-2.0.157}/src/xpander_sdk/modules/backend/utils/mcp_oauth.py
RENAMED
|
@@ -8,7 +8,7 @@ from xpander_sdk.modules.tasks.sub_modules.task import Task, TaskUpdateEvent
|
|
|
8
8
|
from xpander_sdk.modules.tools_repository.models.mcp import MCPOAuthGetTokenGenericResponse, MCPOAuthGetTokenResponse, MCPOAuthResponseType, MCPServerDetails
|
|
9
9
|
|
|
10
10
|
POLLING_INTERVAL = 1 # every 1s
|
|
11
|
-
MAX_WAIT_FOR_LOGIN =
|
|
11
|
+
MAX_WAIT_FOR_LOGIN = 600 # 10 mintutes
|
|
12
12
|
|
|
13
13
|
async def push_event(task: Task, event: TaskUpdateEvent):
|
|
14
14
|
client = APIClient(configuration=task.configuration)
|