Skip to content

馃煛 [API] AgentService response type inconsistency聽#16

Closed

Description

@FullFran

Problem

chat() returns AsyncIterator[str] | str:

response: AsyncIterator[str] | str

This forces consumers to branch on type, creating complexity.

Solution

Always return consistent type:

@dataclass
class AgentResult:
    stream: AsyncIterator[str]
    searched: bool
    search_query: str | None
    matches: List[SearchHit]
    
    async def collect(self) -> str:
        '''Consume stream and return full text.'''
        return ''.join([chunk async for chunk in self.stream])

Acceptance Criteria

  • AgentResponse always has stream
  • Helper to collect full response
  • CLI uses consistent consumption

Activity

  1. FullFran commented on Jan 26, 2026

    @FullFran
    OwnerAuthor

    Sigue abierta. en sigue siendo , y no hay un tipo unificado tipo AgentResult con stream + collect. Dejo abierta.

  2. FullFran commented on Jan 26, 2026

    @FullFran
    OwnerAuthor

    Corrijo comentario anterior (el backtick se interpret贸 en shell).

    Sigue abierta. AgentResponse.response en src/services/agent_service.py sigue siendo AsyncIterator[str] | str, y no hay un tipo unificado tipo AgentResult con stream + collect.

  3. FullFran commented on Jan 26, 2026

    @FullFran
    OwnerAuthor

    Resuelto. AgentService ahora devuelve AgentResult con stream siempre presente y m茅todo collect(). Se normaliza el stream en src/services/agent_service.py y el CLI/tests consumen result.stream o collect().

  4. added a commit that references this issue on Jan 26, 2026
    861479f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions