ephemeral • AI Agent SDK

ephemeral: Context manager for ephemeral conversations.

ephemeral

Method

</div>

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

Context manager for ephemeral conversations.

Messages within this block are NOT permanently stored in chat_history. History is restored to pre-block state after exiting.

Signature

python
def ephemeral() -> Any

Returns

ResponseField Any

The result of the operation.

Usage

python
with agent.ephemeral():
        response = agent.chat("[IMAGE] Analyze this")
        # After block, history is restored - image NOT persisted

Source

View on GitHub

praisonaiagents/agent/agent.py at line 4278