This simple walkthrough will help you get started with building powerful applications using SuperAgentX in just a few steps.
1. Installation: How to install SuperAgentX on your system. 2. Create an Application: Set up a new SuperAgentX project with the basic structure. 3. Virtual Environment Setup: How to create and configure a Python virtual environment for your project. 4. Building a Use Case: Customizing the pipe.py file to fit your application’s needs. 5. Run the Application: Finally, how to execute your new project with a simple command.
Note:
After installation, the superagentx-cli will be available in the path ~/.local/bin on linux. You may need to add
this to your environment’s path variable.
To create a new superagentx project, run the following command in your terminal. This will prompt you to create
project with the basic structure set up for your superagentx.
# First you have to give an application name or folder name.Enter application name: content creator# Then you have to enter pipe name or it will take a default application name.Enter pipe name. Default is application name []: content# Next you have to give any one of option given below, or it be take a default value all.Enter one of the option (all, console, websocket, rest) [all]: all
After your inputs the superagentx-cli create a application like a below structure.
Copy
App Name ✈️ content creatorPacakge Name 📦 content_creatorPipe Name 🎢 contentApp Type 🛠️ allCreating app at /home/ben/content creatorCreating toml file at /home/ben/content creator/pyproject.tomlCreating readme file at /home/ben/content creator/README.mdCreating pipe file at /home/ben/content creator/content_creator/pipe.pyYour app type selection contains `websocket`, `rest api` option(s).Enter auth token for `websocket`, `rest api` [5499161e37cb46809791596c0ce49483]:Creating config file at /home/ben/content creator/content_creator/config.pyCreating iopipe file at /home/ben/content creator/content_creator/iopipe.pyCreating wspipe file at /home/ben/content creator/content_creator/wspipe.pyCreating restpipe file at /home/ben/content creator/content_creator/restpipe.py
If you’re building a new use case, You need to modify the file at /home/ben/Content Creator/content_creator/pipe.py.
The path in this file will be generated based on the input you provide through the SuperAgentX application. In that
file you can do your changes.
This method get_content_creator_pipe initializes a content creation pipeline by configuring an LLM
(Large Language Model) client using OpenAI’s API, for more detail about LLMClient refer here.
This line enables memory functionality in the pipeline by configuring a Memory object that created llm_client
for storing and retrieving, for more detail about Memory refer here.
This line creates an instance of PromptTemplate, which is used to define and manage prompt structures for the language model,
for more detail refer here.
This line initializes an Engine object for the handlers, combining it with the llm_client and prompt_template
to process tasks with the specified handler and prompt structure, for more details refer here.
This line creates an Agent with the role and goal to generate a list of URLs, and configuring it with the llm_client,
prompt_template, and engine to perform, for more details about engine refer here.
Copy
# Create Agent with ai Engines execute ai_agent = Agent( name='AI Agent', goal="Summarize the given content", role="You are the summarization.", llm=llm_client, prompt_template=prompt_template, engines=[ai_engine] )
This line sets up an AgentXPipe, combining multiple agents (serper_agent, crawler_agent, and ai_agent)
with shared memory to enable coordinated processing and communication between the agents, for more details
refer here.
Copy
# Pipe Interface to send it to public accessible interface (Cli Console / WebSocket / Restful API) pipe = AgentXPipe( agents=[ai_agent], memory=memory )
Enter your search here: Give me summary about Hon SoloResult:"Han Solo is a fictional character in the 'Star Wars' franchise, known for his quickwit and roguish charm as a smuggler. He becomes a key figure in the Rebel Alliance,aiding in significant battles like Yavin and Endor. Portrayed by Harrison Ford,Han transforms from a self-interested rogue to a dedicated ally, playing acrucial role in the storyline with connections to Princess Leia and Luke Skywalker."Reason:: The summary provides an accurate and concise overview of Han Solo'scharacter based on the given output context.Goal Satisfied: True────────────────────────────────────────────────────────────────────────── End ───────────────────────────────────────────────────────────────────────────