Skip to content

Threads for completed agent runs can be resumed #60

Description

@TanGentleman

When executing a graph in tangents, we have two cases for agent behavior:

  1. Runs until completion. Guarantee that state['is_done']==True.
  2. Runs until interrupted. Guarantee that thread can be resumed with a new user input.

Applications invoking this graph should not attempt to resume a graph that has already been completed (Case 1). Here is an example where this causes erroneous behavior:

INFO:__main__:Continuing session: 765d52ad-880d-4f7e-9713-0c421f810a66
INFO:root:Executing action: ActionType.GENERATE
Stream callback: True
INFO:openai._base_client:Retrying request to /chat/completions in 0.450344 seconds
INFO:openai._base_client:Retrying request to /chat/completions in 0.982073 seconds
INFO:root:{'success': False, 'data': None, 'error': 'Connection error.'}
INFO:root:Saved action: ActionType.GENERATE
ERROR:root:Action failed, marking task as failed
INFO:root:Saving task chat_task to convex
INFO:root:Saved failed task
WARNING:root:Saved failed tasks: ['chat_task']
INFO:root:No tasks remaining!
INFO:__main__:Workflow completed.
INFO:__main__:Workflow completed.
WARNING:__main__:Empty response received.
INFO:__main__:Removed incomplete exchange.
INFO:__main__:Continuing session: 765d52ad-880d-4f7e-9713-0c421f810a66
WARNING:__main__:Empty response received.
INFO:__main__:Removed incomplete exchange.

User input that leads to an invalid response is popped off. These cases should be avoided.

Proposed solution:

  • Remove session_id from the gradio state when a graph is run to completion.

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