Skip to content

Langgraph Finish When a Path is Repeated #21567

Closed Answered by ardakocaman100101
ardakocaman100101 asked this question in Q&A
Discussion options

You must be logged in to vote

I wrote a work around for this:

with tracing_v2_enabled(project_name="agents") as cb:
    keys = []
    for output in graph.stream(inputs, {"recursion_limit": 10}):
        agent = next(iter(output.items()))[0]
        if agent in keys and agent!="supervisor":
            break
        keys.append(next(iter(output.items()))[0])
        for key, value in output.items():
            print(f"Output from node '{key}':")
            print("---")
            print(value)
            result.append(value)
        print("---\n")

so basically i created a list for used agent memory. when an agent other than the supervisor is repeated, stream is broken to call the final answer manually

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ardakocaman100101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant