Clone For Channel • AI Agent SDK

clone_for_channel: Return a fully independent copy of this agent for a gateway channel.

clone_for_channel

Method

</div>

This is a method of the Agent class in the agent module.

Return a fully independent copy of this agent for a gateway channel.

This method safely clones an agent for use in multi-channel scenarios by avoiding deepcopy issues with tools/handoffs and creating fresh instances of mutable objects like interrupt_controller.

Signature

python
def clone_for_channel() -> 'Agent'

Returns

ResponseField 'Agent'

A new Agent instance with copied configuration but fresh locks, interrupt controller, and shallow-copied tools.

Uses

  • warnings.warn
  • ExecutionConfig
  • MemoryConfig

Source

View on GitHub

praisonaiagents/agent/agent.py at line 3362