Find answers from the community

Updated 10 months ago

agent_worker not found

@kapa.ai agent_worker not found
k
v
4 comments
Please stand by @vigneshzoro as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
The agent_worker is a key component in the LlamaIndex framework. It controls the step-wise execution of a Task. You can create an agent_worker by using different classes depending on your needs. Here are some examples from the extracts:

  1. Using CustomSimpleAgentWorker class for a custom agent:
Plain Text
from llama_index.agent import CustomSimpleAgentWorker

class MyAgentWorker(CustomSimpleAgentWorker):
    """Custom agent worker."""
    # define class here
    pass

You can find more details in the Custom Agent Notebook Guide (). source ()

  1. Using QueryPipelineAgentWorker class for a Query Pipeline agent:
Plain Text
from llama_index.core.agent import QueryPipelineAgentWorker, AgentRunner
from llama_index.core.callbacks import CallbackManager

agent_worker = QueryPipelineAgentWorker(qp)
agent = AgentRunner(
    agent_worker, callback_manager=CallbackManager([]), verbose=True
)

source ()

  1. Using LLMCompilerAgentWorker class for a LLM Compiler agent:
Plain Text
from llama_index.core.agent import AgentRunner
from llama_index.llms.openai import OpenAI

llm = OpenAI(model="gpt-4")
agent_worker = LLMCompilerAgentWorker.from_tools(
    query_engine_tools,
    llm=llm,
    verbose=True,
    callback_manager=callback_manager,
)
agent = AgentRunner(agent_worker, callback_manager=callback_manager)

source ()
Please ensure that you have correctly imported the necessary classes and created the agent_worker instance as shown in the examples.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Cannot import llmcompileragentworker from llama_index.core.agent
Add a reply
Sign up and join the conversation on Discord