agentscope-chat / src /agentscope /workspace /_offload_protocol.py
Akshay66777's picture
AgentScope Gradio chat app — ZeroGPU-ready
9792ea7 verified
Raw
History Blame Contribute Delete
1.07 kB
# -*- coding: utf-8 -*-
"""The offload protocol."""
from typing import Protocol
from ..message import Msg, ToolResultBlock
class Offloader(Protocol):
"""The offloader protocol."""
async def offload_context(
self,
session_id: str,
msgs: list[Msg],
) -> str:
"""Offload compressed context to workspace-accessible storage.
Args:
session_id (`str`):
The session id.
msgs (`list[Msg]`):
The messages to offload.
Returns:
`str`:
The offloaded context reference.
"""
async def offload_tool_result(
self,
session_id: str,
tool_result: ToolResultBlock,
) -> str:
"""Offload a tool result to workspace-accessible storage.
Args:
session_id (`str`):
The session id.
tool_result (`ToolResultBlock`):
The tool result.
Returns:
`str`:
The offloaded context reference.
"""