Skip to content

How can I create a simple agent in Llama_index .. just like CrewAI? #14499

Answered by dosubot bot
mraguth asked this question in Q&A
Discussion options

You must be logged in to vote

To include a detailed agent description such as "Senior Data Scientist" in your LlamaIndex agent, you can use the ReActAgent implementation. Here’s how you can do it:

  1. Set up your environment and install dependencies:

    poetry init
    poetry shell
    pip install llama-index python-dotenv
  2. Create a .env file with your OpenAI API key:

    OPENAI_API_KEY=sk-proj-xxxx
  3. Import necessary components and load environment variables:

    from dotenv import load_dotenv
    
    load_dotenv()
    from llama_index.core.tools import FunctionTool
    from llama_index.llms.openai import OpenAI
    from llama_index.core.agent import ReActAgent
    from llama_index.core.tools import ToolMetadata
  4. Define a sample tool (optional):

    def query_tool

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@mraguth
Comment options

@dosubot
Comment options

@mraguth
Comment options

@dosubot
Comment options

Answer selected by mraguth
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