Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent callbacks should called as same as callbacks in agent_executor #716

Closed
JayClock opened this issue May 31, 2024 · 2 comments
Closed

Comments

@JayClock
Copy link

JayClock commented May 31, 2024

Something missed in Document

Agent attribute: callbacks

I found this attribute in sourcecode,I think it should be work.
image

the follow examples use the same callback StreamlitCallbackHandler

In AgentExecutor

code example

from langchain_community.callbacks.streamlit import (
    StreamlitCallbackHandler,
)

agent_executor = AgentExecutor(agent=agent, tools=[], verbose=True)

st_callback = StreamlitCallbackHandler(st.container())

response = agent_executor.invoke(
                {
                    "input": "",
                    "story": user_story,
                    "context": business_context,
                    "history": "",
                },
                {"callbacks": [st_callback]},
            )

Performance

Screen.Recording.2024-05-31.at.16.30.16.mov

In Crewai Agent

code example

writer = Agent(
    role="Writer",
    goal="Narrate compelling tech stories about {topic}",
    verbose=True,
    memory=True,
    backstory=(
        "With a flair for simplifying complex topics, you craft"
        "engaging narratives that captivate and educate, bringing new"
        "discoveries to light in an accessible manner."
    ),
    allow_delegation=False,
    callbacks=[StreamlitCallbackHandler(st.container())],
)

Performance

the result can not be response with streams

Copy link

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant