Skip to content

[Bug] There is a bug in enabling non-stream mode when creating agent. #439

@JayPritchet

Description

@JayPritchet

Bug Description

I hope to use non-stream mode, but when creating AgentApp, if set stream=True, it will throw an error.

Reproduction Steps

from agentscope_runtime.engine import AgentApp
# Create the AgentApp instance
agent_app = AgentApp(
    app_name="LangGraphAgent",
    app_description="A LangGraph-based research assistant",
    stream=False
)

# from agent import agent_app
from dotenv import load_dotenv

load_dotenv()

if __name__ == "__main__":
    
    agent_app.run(host="0.0.0.0", port=8090, web_ui=False)

Expected vs Actual Behavior

Expected: The agent starts with non-stream mode.
Actual: The program throw an error.

Error Messages

[NacosRegistry] Nacos SDK (nacos-sdk-python) is not available. Install it with: pip install nacos-sdk-python
INFO:     Started server process [58540]
INFO:     Waiting for application startup.
ERROR:    Traceback (most recent call last):
  File "D:\myagent\.venv\Lib\site-packages\starlette\routing.py", line 694, in lifespan       
    async with self.lifespan_context(app) as maybe_state:
  File "D:\Programs\anaconda3\Lib\contextlib.py", line 210, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\myagent\.venv\Lib\site-packages\agentscope_runtime\engine\deployers\utils\service_utils\fastapi_factory.py", line 171, in lifespan
    await FastAPIAppFactory._handle_startup(
  File "D:\myagent\.venv\Lib\site-packages\agentscope_runtime\engine\deployers\utils\service_utils\fastapi_factory.py", line 267, in _handle_startup
    effective_func = app.state.runner.query
                     ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Runner' object has no attribute 'query'

ERROR:    Application startup failed. Exiting.

Environment

  • agentscope 1.0.14
  • agentscope-runtime 1.0.5
  • Python 3.11.7
  • Windows 11
  • Installation: uv

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions