9595>
9696> ** About Framework-Agnostic** : Currently, AgentScope Runtime supports the ** AgentScope** framework. We plan to extend compatibility to more agent development frameworks in the future. This table shows the current version’s adapter support for different frameworks. The level of support for each functionality varies across frameworks:
9797>
98- > | Framework/Feature | Message/Event | Tool | Service |
99- > | ------------------------------------------------------------ | ------------- | ---- | ------- |
100- > | [ AgentScope] ( https://runtime.agentscope.io/en/quickstart.html ) | ✅ | ✅ | ✅ |
101- > | [ LangGraph] ( https://runtime.agentscope.io/en/langgraph_guidelines.html ) | ✅ | 🚧 | 🚧 |
102- > | [ Microsoft Agent Framework] ( https://runtime.agentscope.io/en/ms_agent_framework_guidelines.html ) | ✅ | ✅ | 🚧 |
103- > | [ Agno] ( https://runtime.agentscope.io/en/agno_guidelines.html ) | ✅ | ✅ | 🚧 |
104- > | AutoGen | 🚧 | ✅ | 🚧 |
98+ > | Framework/Feature | Message/Event | Tool |
99+ > | ------------------------------------------------------------ | ------------- | ---- |
100+ > | [ AgentScope] ( https://runtime.agentscope.io/en/quickstart.html ) | ✅ | ✅ |
101+ > | [ LangGraph] ( https://runtime.agentscope.io/en/langgraph_guidelines.html ) | ✅ | 🚧 |
102+ > | [ Microsoft Agent Framework] ( https://runtime.agentscope.io/en/ms_agent_framework_guidelines.html ) | ✅ | ✅ |
103+ > | [ Agno] ( https://runtime.agentscope.io/en/agno_guidelines.html ) | ✅ | ✅ |
104+ > | AutoGen | 🚧 | ✅ |
105105
106106---
107107
@@ -155,14 +155,11 @@ from agentscope.formatter import DashScopeChatFormatter
155155from agentscope.tool import Toolkit, execute_python_code
156156from agentscope.pipeline import stream_printing_messages
157157from agentscope.memory import InMemoryMemory
158+ from agentscope.session import RedisSession
158159
159160from agentscope_runtime.engine import AgentApp
160161from agentscope_runtime.engine.schemas.agent_schemas import AgentRequest
161162
162- from agentscope_runtime.engine.services.agent_state import (
163- InMemoryStateService,
164- )
165-
166163agent_app = AgentApp(
167164 app_name = " Friday" ,
168165 app_description = " A helpful assistant" ,
@@ -171,14 +168,13 @@ agent_app = AgentApp(
171168
172169@agent_app.init
173170async def init_func (self ):
174- self .state_service = InMemoryStateService()
175-
176- await self .state_service.start()
177-
171+ import fakeredis
178172
179- @agent_app.shutdown
180- async def shutdown_func (self ):
181- await self .state_service.stop()
173+ fake_redis = fakeredis.aioredis.FakeRedis(decode_responses = True )
174+ # NOTE : This FakeRedis instance is for development/testing only.
175+ # In production, replace it with your own Redis client/connection
176+ # (e.g., aioredis.Redis)
177+ self .session = RedisSession(connection_pool = fake_redis.connection_pool)
182178
183179
184180@agent_app.query (framework = " agentscope" )
@@ -191,11 +187,6 @@ async def query_func(
191187 session_id = request.session_id
192188 user_id = request.user_id
193189
194- state = await self .state_service.export_state(
195- session_id = session_id,
196- user_id = user_id,
197- )
198-
199190 toolkit = Toolkit()
200191 toolkit.register_tool_function(execute_python_code)
201192
@@ -213,21 +204,22 @@ async def query_func(
213204 )
214205 agent.set_console_output_enabled(enabled = False )
215206
216- if state:
217- agent.load_state_dict(state)
207+ await self .session.load_session_state(
208+ session_id = session_id,
209+ user_id = user_id,
210+ agent = agent,
211+ )
218212
219213 async for msg, last in stream_printing_messages(
220214 agents = [agent],
221215 coroutine_task = agent(msgs),
222216 ):
223217 yield msg, last
224218
225- state = agent.state_dict()
226-
227- await self .state_service.save_state(
228- user_id = user_id,
219+ await self .session.save_session_state(
229220 session_id = session_id,
230- state = state,
221+ user_id = user_id,
222+ agent = agent,
231223 )
232224
233225
0 commit comments