xpander-sdk 2.0.159__py3-none-any.whl → 2.0.160__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.
@@ -8,6 +8,9 @@ class DeepPlanningItem(XPanderSharedModel):
8
8
 
9
9
  class DeepPlanning(XPanderSharedModel):
10
10
  enabled: Optional[bool] = False
11
+ enforce: Optional[bool] = False
12
+ started: Optional[bool] = False
13
+ question_raised: Optional[bool] = False
11
14
  tasks: Optional[List[DeepPlanningItem]] = []
12
15
 
13
16
  class PlanFollowingStatus(XPanderSharedModel):
@@ -154,6 +154,7 @@ class Agent(XPanderSharedModel):
154
154
  model_name: str
155
155
  llm_reasoning_effort: Optional[LLMReasoningEffort] = LLMReasoningEffort.Medium
156
156
  deep_planning: Optional[bool] = False
157
+ enforce_deep_planning: Optional[bool] = False
157
158
  llm_api_base: Optional[str]
158
159
  webhook_url: Optional[str]
159
160
  created_at: Optional[datetime]
@@ -197,6 +198,7 @@ class Agent(XPanderSharedModel):
197
198
  model_name: str
198
199
  llm_reasoning_effort: Optional[LLMReasoningEffort] = LLMReasoningEffort.Medium
199
200
  deep_planning: Optional[bool] = False
201
+ enforce_deep_planning: Optional[bool] = False
200
202
  llm_api_base: Optional[str] = None
201
203
  webhook_url: Optional[str] = None
202
204
  created_at: Optional[datetime] = None
@@ -231,9 +231,11 @@ def _configure_deep_planning_guidance(args: Dict[str, Any], agent: Agent, task:
231
231
 
232
232
  ### **Core Workflow**
233
233
  1. **CREATE** plan at the start (`xpcreate-agent-plan`)
234
- 2. **CHECK** plan before each action (`xpget-agent-plan`)
235
- 3. **COMPLETE** task immediately after finishing it (`xpcomplete-agent-plan-item`)
236
- 4. Repeat steps 2-3 until all tasks are done
234
+ 2. **START** plan execution (`xpstart-execution-plan`) - MANDATORY to enable enforcement
235
+ 3. **CHECK** plan before each action (`xpget-agent-plan`)
236
+ 4. **COMPLETE** task immediately after finishing it (`xpcomplete-agent-plan-item`)
237
+ 5. **ASK** user for info if needed (`xpask-for-information`)
238
+ 6. Repeat steps 3-5 until all tasks are done
237
239
 
238
240
  ---
239
241
 
@@ -241,6 +243,7 @@ def _configure_deep_planning_guidance(args: Dict[str, Any], agent: Agent, task:
241
243
 
242
244
  #### **1. xpcreate-agent-plan** - Create Initial Plan
243
245
  **When to use**: At the very start of any multi-step task, ONLY if no plan exists yet
246
+ **Note**: After creating a plan, you MUST call `xpstart-execution-plan` to begin enforcement
244
247
 
245
248
  **How to use**:
246
249
  - Pass an array of task objects (NOT strings)
@@ -339,13 +342,55 @@ def _configure_deep_planning_guidance(args: Dict[str, Any], agent: Agent, task:
339
342
  ```
340
343
  ---
341
344
 
345
+ #### **7. xpstart-execution-plan** - Start Plan Execution
346
+ **When to use**: Immediately after creating a plan with `xpcreate-agent-plan`
347
+ **CRITICAL**: Must be called to enable enforcement mode before executing tasks
348
+
349
+ **How to use**:
350
+ ```json
351
+ {
352
+ "body_params": {}
353
+ }
354
+ ```
355
+ **No parameters needed** - just call after plan creation
356
+
357
+ **What it does**:
358
+ - Marks plan as "started"
359
+ - Enables enforcement mode if `enforce` flag is true
360
+ - Allows plan execution to proceed
361
+
362
+ ---
363
+
364
+ #### **8. xpask-for-information** - Ask User a Question
365
+ **When to use**: When you need information from the user during plan execution
366
+ **PREREQUISITE**: Plan must be started (running) first
367
+
368
+ **How to use**:
369
+ ```json
370
+ {
371
+ "body_params": {
372
+ "question": "What is the customer email address?"
373
+ }
374
+ }
375
+ ```
376
+
377
+ **What it does**:
378
+ - Sets `question_raised` flag to true
379
+ - Prints the question for the user
380
+ - Keeps enforcement active (does NOT pause execution)
381
+ - Returns waiting status
382
+
383
+ ---
384
+
342
385
  ### **Best Practices**
343
386
 
344
387
  ✅ **DO:**
345
388
  - Create comprehensive plans with ALL necessary steps
389
+ - **START** the plan with `xpstart-execution-plan` after creating it
346
390
  - Use descriptive, actionable task titles
347
391
  - Check plan before each action to stay oriented
348
392
  - Mark tasks complete immediately after finishing them
393
+ - Ask for user information when needed with `xpask-for-information`
349
394
  - Call plan tools **sequentially** (one at a time, never in parallel)
350
395
 
351
396
  ❌ **DON'T:**
@@ -371,18 +416,25 @@ def _configure_deep_planning_guidance(args: Dict[str, Any], agent: Agent, task:
371
416
  {"title": "Write integration tests"}
372
417
  ]
373
418
 
374
- 3. Call: xpget-agent-plan
419
+ 3. Call: xpstart-execution-plan
420
+ → Plan now started, enforcement enabled (if enforce=true)
421
+
422
+ 4. Call: xpget-agent-plan
375
423
  → See: Task 1 (ID: abc-123) - Design user schema - Not complete
376
424
 
377
- 4. [Do the work: Design schema]
425
+ 5. [Realize need user input] Call: xpask-for-information
426
+ question: "Which database should we use - PostgreSQL or MySQL?"
427
+ → question_raised=true, waiting for response
428
+
429
+ 6. [After user responds, do the work: Design schema]
378
430
 
379
- 5. Call: xpcomplete-agent-plan-item
431
+ 7. Call: xpcomplete-agent-plan-item
380
432
  id: "abc-123"
381
433
 
382
- 6. Call: xpget-agent-plan
434
+ 8. Call: xpget-agent-plan
383
435
  → See: Task 1 ✓ complete, Task 2 next...
384
436
 
385
- 7. [Continue through remaining tasks]
437
+ 9. [Continue through remaining tasks]
386
438
  ```
387
439
  **Remember**: The plan is your roadmap. Check it often, update it as needed, and always mark tasks complete when done!
388
440
  </important_planning_instructions>
@@ -785,8 +785,12 @@ class Task(XPanderSharedModel):
785
785
  ... print(f"Remaining tasks: {len(status.uncompleted_tasks)}")
786
786
  """
787
787
  try:
788
- if self.deep_planning and self.deep_planning.enabled:
788
+ if self.deep_planning and self.deep_planning.enabled and self.deep_planning.started and self.deep_planning.enforce:
789
789
  await self.areload()
790
+
791
+ # allow early exit to ask question
792
+ if self.deep_planning.question_raised:
793
+ return PlanFollowingStatus(can_finish=True)
790
794
 
791
795
  uncompleted_tasks = [
792
796
  task for task in self.deep_planning.tasks if not task.completed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xpander-sdk
3
- Version: 2.0.159
3
+ Version: 2.0.160
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
@@ -10,7 +10,7 @@ xpander_sdk/exceptions/module_exception.py,sha256=2Urni1QEdzOrCdYSRc5eLpuz8aDlvR
10
10
  xpander_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  xpander_sdk/models/activity.py,sha256=I3CxOzUNbrKwHqynCbm7FJja6vanVkCzwwBwET7qvzA,2085
12
12
  xpander_sdk/models/configuration.py,sha256=Un8p3C3p3eMiqKK5VsHaZdWhZTRYHbrw2aPUMV8lJSc,3370
13
- xpander_sdk/models/deep_planning.py,sha256=Z7E55ORBvxRZM6zo3V0rkHZPNhVsRP9wYN3H8p-EKtY,438
13
+ xpander_sdk/models/deep_planning.py,sha256=pCFV5iNSfT99ap1-09k7oO_DIwXx2vPJ3aVM472xL4w,554
14
14
  xpander_sdk/models/events.py,sha256=2vIkuPGAbntN_7xggJRw5sMJ1_EzcXyljxPH0ekISlw,2235
15
15
  xpander_sdk/models/frameworks.py,sha256=Ptf4aMjZ44L_x8WsCc5X0kjsJObv4dwgSM61no0aW6E,2937
16
16
  xpander_sdk/models/shared.py,sha256=gW88kA_UslNinUjtQKpLVF0sHDZnckwLWexRapxPivU,3125
@@ -23,13 +23,13 @@ xpander_sdk/modules/agents/models/agent.py,sha256=tJXNogRjvwlxzJPzesdHm-NBhMOzDn
23
23
  xpander_sdk/modules/agents/models/agent_list.py,sha256=byEayS2uLwDKaVT3lAHltrFocQFKpr8XEwQ6NTEEEMo,4081
24
24
  xpander_sdk/modules/agents/models/knowledge_bases.py,sha256=YimpjVJxWe8YTbGMD6oGQOA_YV8ztHQHTTBOaBB44ZM,1037
25
25
  xpander_sdk/modules/agents/sub_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- xpander_sdk/modules/agents/sub_modules/agent.py,sha256=T45T1KkR2OfdEdOmu7Ikf6eiV9pYJMz-uH1Xtm_3XJU,36190
26
+ xpander_sdk/modules/agents/sub_modules/agent.py,sha256=HHVz00hrRCFZV9uj8Q5TvZHO_ObijMwQw5Gqdwa_nDY,36298
27
27
  xpander_sdk/modules/agents/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  xpander_sdk/modules/agents/utils/generic.py,sha256=XbG4OeHMQo4gVYCsasMlW_b8OoqS1xL3MlUZSjXivu0,81
29
29
  xpander_sdk/modules/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  xpander_sdk/modules/backend/backend_module.py,sha256=wYghMuNXEtXgoyMXBgbMhgE7wYcbRwXJcpEyybF30kA,18927
31
31
  xpander_sdk/modules/backend/frameworks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
- xpander_sdk/modules/backend/frameworks/agno.py,sha256=tuw_2mYA_7DsFpIPpoeY4w_qpK5iAGgaooZ9d4fN3KA,30435
32
+ xpander_sdk/modules/backend/frameworks/agno.py,sha256=VDrNb2M2RaKDPjlmc-yQeXJZVDpTifF4zl2xaLXvDeg,32538
33
33
  xpander_sdk/modules/backend/frameworks/dispatch.py,sha256=5dP4c37C42U53VjM2kkwIRwEw1i0IN3G0YESHH7J3OE,1557
34
34
  xpander_sdk/modules/backend/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  xpander_sdk/modules/backend/utils/mcp_oauth.py,sha256=a4xQGQwRGf2T9h38Vc9VNUwpIeY9y7Mn6B4D2G3tMQM,4387
@@ -59,7 +59,7 @@ xpander_sdk/modules/tasks/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
59
59
  xpander_sdk/modules/tasks/models/task.py,sha256=B0_fwzQEkRE_pZMSLnWuXsUBMdy8HEIxm1FfRpCQma0,5000
60
60
  xpander_sdk/modules/tasks/models/tasks_list.py,sha256=8V1T0vCtGN79qLMPwe37pOA7Wvuf8pbJNOhWL0BPo-8,5126
61
61
  xpander_sdk/modules/tasks/sub_modules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
- xpander_sdk/modules/tasks/sub_modules/task.py,sha256=C6cHx4tHhbnfrDqiLkrWr7AB5H8V8mmy4snOXMnP6TA,35886
62
+ xpander_sdk/modules/tasks/sub_modules/task.py,sha256=RlYe4XAhWeUGk2JwlRC__SWP7OFoym8fnCTluYrhHLg,36135
63
63
  xpander_sdk/modules/tasks/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
64
64
  xpander_sdk/modules/tasks/utils/files.py,sha256=KqqwSQSrwim2-H3XP5wOadDDfngAyEI034tA7Oon-vc,3631
65
65
  xpander_sdk/modules/tools_repository/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -79,8 +79,8 @@ xpander_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
79
79
  xpander_sdk/utils/env.py,sha256=U_zIhqWgKs5fk2-HXjAaODj4oWMc5dRQ0fvw6fqVcFk,1522
80
80
  xpander_sdk/utils/event_loop.py,sha256=kJrN0upgBhyI86tkTdfHeajznrIZl44Rl6WDiDG3GHE,2516
81
81
  xpander_sdk/utils/tools.py,sha256=lyFkq2yP7DxBkyXYVlnFRwDhQCvf0fZZMDm5fBycze4,1244
82
- xpander_sdk-2.0.159.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
- xpander_sdk-2.0.159.dist-info/METADATA,sha256=5YTQaIhI5xOl_RAQEi9LLE1tO0p-GBvXTXohwIby_gg,15312
84
- xpander_sdk-2.0.159.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
- xpander_sdk-2.0.159.dist-info/top_level.txt,sha256=UCjnxQpsMy5Zoe7lmRuVDO6DI2V_6PgRFfm4oizRbVs,12
86
- xpander_sdk-2.0.159.dist-info/RECORD,,
82
+ xpander_sdk-2.0.160.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
83
+ xpander_sdk-2.0.160.dist-info/METADATA,sha256=KRfnTL_z2awclUG4SAg_LCOGdPkYoQl8F4AxVLD6nBI,15312
84
+ xpander_sdk-2.0.160.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
85
+ xpander_sdk-2.0.160.dist-info/top_level.txt,sha256=UCjnxQpsMy5Zoe7lmRuVDO6DI2V_6PgRFfm4oizRbVs,12
86
+ xpander_sdk-2.0.160.dist-info/RECORD,,