1010These protocols are lightweight and have zero performance impact.
1111"""
1212from typing import Protocol , runtime_checkable , Optional , Any , AsyncIterator , Dict , List
13- from dataclasses import dataclass , field
1413
1514
1615@runtime_checkable
@@ -303,44 +302,6 @@ def launch(
303302 ...
304303
305304
306- @dataclass
307- class ManagedBackendConfig :
308- """Configuration for managed agent backends.
309-
310- Portable dataclass that describes *what* to create on the managed
311- infrastructure without tying to any provider SDK.
312-
313- Example::
314-
315- cfg = ManagedBackendConfig(
316- model="claude-sonnet-4-6",
317- system="You are a coding assistant.",
318- tools=[{"type": "agent_toolset_20260401"}],
319- packages={"pip": ["pandas", "numpy"]},
320- networking={"type": "unrestricted"},
321- )
322- """
323- # ── Agent fields ──
324- name : str = "PraisonAI Managed Agent"
325- model : str = "claude-sonnet-4-6"
326- system : str = "You are a helpful AI assistant."
327- tools : List [Dict [str , Any ]] = field (default_factory = lambda : [{"type" : "agent_toolset_20260401" }])
328- mcp_servers : List [Dict [str , Any ]] = field (default_factory = list )
329- skills : List [Dict [str , Any ]] = field (default_factory = list )
330- callable_agents : List [Dict [str , Any ]] = field (default_factory = list )
331- metadata : Dict [str , Any ] = field (default_factory = dict )
332-
333- # ── Environment fields ──
334- env_name : str = "praisonai-env"
335- packages : Optional [Dict [str , List [str ]]] = None
336- networking : Dict [str , Any ] = field (default_factory = lambda : {"type" : "unrestricted" })
337-
338- # ── Session fields ──
339- session_title : str = "PraisonAI session"
340- resources : List [Dict [str , Any ]] = field (default_factory = list )
341- vault_ids : List [str ] = field (default_factory = list )
342-
343-
344305@runtime_checkable
345306class ManagedBackendProtocol (Protocol ):
346307 """Protocol for external managed agent backends.
@@ -354,7 +315,7 @@ class ManagedBackendProtocol(Protocol):
354315
355316 Lifecycle::
356317
357- backend = SomeManagedBackend(config=ManagedBackendConfig( ...) )
318+ backend = SomeManagedBackend(config={ ...} )
358319 agent = Agent(name="coder", backend=backend)
359320 result = agent.start("Write a script") # delegates to backend.execute()
360321
@@ -429,6 +390,46 @@ def reset_all(self) -> None:
429390 """
430391 ...
431392
393+ # ── Optional methods (default no-ops for backward compat) ──
394+
395+ def update_agent (self , ** kwargs ) -> None :
396+ """Update an existing managed agent's configuration.
397+
398+ Allows changing system prompt, tools, model, etc. on a previously
399+ created agent without recreating it.
400+
401+ Args:
402+ **kwargs: Fields to update (system, tools, model, name, etc.).
403+ """
404+ ...
405+
406+ def interrupt (self ) -> None :
407+ """Send a user interrupt to the active session.
408+
409+ Signals the managed agent to stop its current work (equivalent to
410+ ``user.interrupt`` event in the Anthropic API).
411+ """
412+ ...
413+
414+ def retrieve_session (self ) -> Dict [str , Any ]:
415+ """Retrieve the current managed session's metadata and usage.
416+
417+ Returns:
418+ Dict with session info (id, status, usage, etc.).
419+ """
420+ ...
421+
422+ def list_sessions (self , ** kwargs ) -> List [Dict [str , Any ]]:
423+ """List sessions for the current agent.
424+
425+ Args:
426+ **kwargs: Provider-specific filters (limit, status, etc.).
427+
428+ Returns:
429+ List of session summary dicts.
430+ """
431+ ...
432+
432433
433434__all__ = [
434435 'AgentProtocol' ,
@@ -440,5 +441,4 @@ def reset_all(self) -> None:
440441 'HttpLauncherProtocol' ,
441442 'McpLauncherProtocol' ,
442443 'ManagedBackendProtocol' ,
443- 'ManagedBackendConfig' ,
444444]
0 commit comments