Skip to content

[Bug] Setting session name blocks main thread #7719

@FuturPanda

Description

@FuturPanda

Description

When setting a session name with agent or team.aset_session_name, all concurrent requests are blocked.
The method aset_session_name_util should call a method agenerate_session_name that calls team.model.aresponse()
Currently, aset_session_name_util calls generate_session_name that calls team.model.response() that is thread blocking.

Image

Steps to Reproduce

team= Team(...) async for chunk in team.arun(**kwargs): if hasattr(chunk, "model_dump"): data = json.dumps(chunk.model_dump(), default=str, ensure_ascii=False) elif hasattr(chunk, "to_dict"): data = json.dumps(chunk.to_dict(), default=str, ensure_ascii=False) else: data = json.dumps({"content": str(chunk)}, default=str, ensure_ascii=False) yield f"data: {data}\n\n" team.aset_session_name(autogenerate=True)
Run the inference. When it's generating the name, try to access something in the app or make any request. It should hang till the name generation is done.

Agent Configuration (if applicable)

No response

Expected Behavior

The name generation shouldn't block the main thread when using async methods.

Actual Behavior

It is blocking the min thread with model.response()

Screenshots or Logs (if applicable)

No response

Environment

- Fastapi server 
- Agno 2.4.8

Possible Solutions (optional)

Make a agenerate_name() that use team or agent.model.aresponse()

Additional Context

No response

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