@@ -6288,10 +6288,37 @@ async def astart(self, prompt: str, **kwargs):
62886288 **kwargs: Additional arguments passed to achat()
62896289
62906290 Returns:
6291- The agent's response as a string
6291+ The agent's response as a string, or AutonomyResult if autonomy enabled
6292+
6293+ Note:
6294+ If autonomy=True was set on the agent, astart() automatically uses
6295+ the autonomous loop (run_autonomous_async) instead of single-turn chat.
62926296 """
62936297 import sys
62946298
6299+ # ─────────────────────────────────────────────────────────────────────
6300+ # UNIFIED AUTONOMY API: If autonomy is enabled, route to run_autonomous_async
6301+ # This allows: Agent(autonomy=True) + await agent.astart("Task") to just work!
6302+ # ─────────────────────────────────────────────────────────────────────
6303+ if self .autonomy_enabled :
6304+ # Extract autonomy-specific kwargs
6305+ timeout = kwargs .pop ('timeout' , None )
6306+ kwargs .pop ('stream' , None ) # Not used in autonomous mode
6307+
6308+ # Get config values from autonomy_config
6309+ auto_config = self .autonomy_config or {}
6310+ max_iterations = auto_config .get ('max_iterations' , 20 )
6311+ completion_promise = auto_config .get ('completion_promise' )
6312+ clear_context = auto_config .get ('clear_context' , False )
6313+
6314+ return await self .run_autonomous_async (
6315+ prompt = prompt ,
6316+ max_iterations = max_iterations ,
6317+ timeout_seconds = timeout ,
6318+ completion_promise = completion_promise ,
6319+ clear_context = clear_context ,
6320+ )
6321+
62956322 # Determine streaming behavior (same logic as start())
62966323 stream_requested = kwargs .get ('stream' )
62976324 if stream_requested is None :
@@ -6523,6 +6550,9 @@ def start(self, prompt: str = None, **kwargs):
65236550 Unlike .run() which is always silent (production use), .start()
65246551 enables verbose output by default when in a TTY for beginner-friendly
65256552 interactive use. Use .run() for programmatic/scripted usage.
6553+
6554+ If autonomy=True was set on the agent, start() automatically uses
6555+ the autonomous loop (run_autonomous) instead of single-turn chat.
65266556 """
65276557 import sys
65286558
@@ -6535,6 +6565,28 @@ def start(self, prompt: str = None, **kwargs):
65356565 from praisonaiagents .utils .variables import substitute_variables
65366566 prompt = substitute_variables (prompt , {})
65376567
6568+ # ─────────────────────────────────────────────────────────────────────
6569+ # UNIFIED AUTONOMY API: If autonomy is enabled, route to run_autonomous
6570+ # This allows: Agent(autonomy=True) + agent.start("Task") to just work!
6571+ # ─────────────────────────────────────────────────────────────────────
6572+ if self .autonomy_enabled :
6573+ # Extract autonomy-specific kwargs
6574+ timeout = kwargs .pop ('timeout' , None )
6575+
6576+ # Get config values from autonomy_config
6577+ auto_config = self .autonomy_config or {}
6578+ max_iterations = auto_config .get ('max_iterations' , 20 )
6579+ completion_promise = auto_config .get ('completion_promise' )
6580+ clear_context = auto_config .get ('clear_context' , False )
6581+
6582+ return self .run_autonomous (
6583+ prompt = prompt ,
6584+ max_iterations = max_iterations ,
6585+ timeout_seconds = timeout ,
6586+ completion_promise = completion_promise ,
6587+ clear_context = clear_context ,
6588+ )
6589+
65386590 # Load history from past sessions
65396591 self ._load_history_context ()
65406592
0 commit comments