https://github.com/abeenoch/base-network-agent
fullstack . AI AGENT for BASE network.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.4%) to scientific vocabulary
Repository
fullstack . AI AGENT for BASE network.
Basic Info
- Host: GitHub
- Owner: abeenoch
- License: mit
- Language: Python
- Default Branch: main
- Size: 983 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
BASE BOT
This repository provides the backend blueprint for a LangGraph-based agent service architecture. It includes a LangGraph agent, a FastAPI service to serve it, a client to interact with the service, and a Streamlit app that uses the client to provide a chat interface for local testing purposes. The backend is hosted on Render.
This project offers a template for you to easily build and run your own agents using the LangGraph framework. It demonstrates a complete setup from agent definition, backend to user interface, making it easier to get started with LangGraph-based projects by providing a full, robust codebase for everything you'll need.
Overview
Quickstart
Run directly in python
```sh
An OPENAIAPIKEY is required
echo 'OPENAIAPIKEY=youropenaiapi_key' >> .env
uv is recommended but "pip install ." also works
pip install uv uv sync --frozen
Or install all the libaries once with
pip install -r requirements.txt
edit(comment either of the two) code in to choose if you want test with streamlit or swagger docs
"uv sync" creates .venv automatically
source .venv/bin/activate python src/run_service.py
In another shell
source .venv/bin/activate streamlit run src/streamlit_app.py ```
Key Features
- LangGraph Agent: A customizable agent built using the LangGraph framework.
- FastAPI Service: Serves the agent with both streaming and non-streaming endpoints.
- PostgreSQL Database Support: Uses PostgreSQL with an asynchronous engine to handle database operations efficiently.
- Docker Support: Simplifies deployment with a preconfigured Dockerfile.
- Render Hosting:Backend hosted on Render for streamlined deployment and scalability.
- Asynchronous Requests: Fully supports asynchronous processing for high-concurrency applications.
- Advanced Streaming: A novel approach to support both token-based and message-based streaming.
- Streamlit Interface: Provides a user-friendly chat interface for interacting with the agent.
- Multiple Agent Support: Run multiple agents in the service and call by URL path
- Asynchronous Design: Utilizes async/await for efficient handling of concurrent requests.
- Feedback Mechanism: Includes a star-based feedback system integrated with LangSmith.
Key Files
The repository is structured as follows:
src/agents/research_assistant.py: Defines the main LangGraph agentsrc/agents/models.py: Configures available models based on ENVsrc/agents/agents.py: Mapping of all agents provided by the servicesrc/schema/schema.py: Defines the protocol schemasrc/service/service.py: FastAPI service to serve the agentssrc/client/client.py: Client to interact with the agent servicesrc/streamlit_app.py: Streamlit app providing a chat interfacedocker: Defines the container environment for the project.
Why LangGraph?
AI agents are increasingly being built with more explicitly structured and tightly controlled Compound AI Systems, with careful attention to the cognitive architecture. At the time of this repo's creation, LangGraph seems like the most advanced open source framework for building such systems, with a high degree of control as well as support for features like concurrent execution, cycles in the graph, streaming results, built-in observability, and the rich ecosystem around LangChain.
Setup and Usage
- Clone the repository:
sh
git clone https://github.com/abeenoch/base-network-agent.git
cd base-network-agent
- Set up environment variables:
Create a
.envfile in the root directory and add the following:
```sh # Provide at least one LLM API key to enable the agent service
# Optional, to enable OpenAI gpt-4o-mini OPENAIAPIKEY=youropenaiapi_key
# Optional, to enable LlamaGuard and Llama 3.1 GROQAPIKEY=yourgroqapi_key
# Optional, to enable Gemini 1.5 Flash # See: https://ai.google.dev/gemini-api/docs/api-key GOOGLEAPIKEY=yourgeminikey
# Optional, to enable Claude 3 Haiku # See: https://docs.anthropic.com/en/api/getting-started ANTHROPICAPIKEY=youranthropickey
# Optional, to enable AWS Bedrock models Haiku # See: https://docs.aws.amazon.com/bedrock/latest/userguide/setting-up.html USEAWSBEDROCK=true
# Optional, to enable simple header-based auth on the service AUTHSECRET=anystringyouchoose
# Optional, to enable OpenWeatherMap OPENWEATHERMAPAPIKEY=youropenweathermapapi_key
# Optional, to enable LangSmith tracing LANGCHAINTRACINGV2=true LANGCHAINENDPOINT=https://api.smith.langchain.com LANGCHAINAPIKEY=yourlangchainapikey LANGCHAINPROJECT=yourproject
# Optional, if MODE=dev, uvicorn will reload the server on file changes MODE= ```
- You can now run the agent service and the Streamlit app locally, either with Docker or just using Python. The Docker setup is recommended for simpler environment setup and immediate reloading of the services when you make changes to your code.
You can also run the agent service and the Streamlit app locally without Docker, just using a Python virtual environment.
- Create a virtual environment and install dependencies:
sh
pip install uv
uv sync --frozen --extra dev
source .venv/bin/activate
- Run the FastAPI server:
sh
python src/run_service.py
- In a separate terminal, run the Streamlit app:
sh
streamlit run src/streamlit_app.py
- Open your browser and navigate to the URL provided by Streamlit (usually
http://localhost:8501).
Customization
To customize the agent for your own use case:
- Add your new agent to the
src/agentsdirectory. You can copyresearch_assistant.pyorchatbot.pyand modify it to change the agent's behavior and tools. - Import and add your new agent to the
agentsdictionary insrc/agents/agents.py. Your agent can be called by/<your_agent_name>/invokeor/<your_agent_name>/stream. - Adjust the Streamlit interface in
src/streamlit_app.pyto match your agent's capabilities.
Owner
- Name: Abe Enoch Aboluwarin
- Login: abeenoch
- Kind: user
- Location: nigeria
- Website: fortyfourhundred.business.site
- Twitter: benzoorimolade
- Repositories: 3
- Profile: https://github.com/abeenoch
dislikes snakes except python.
GitHub Events
Total
- Issue comment event: 2
- Member event: 1
- Push event: 18
- Pull request event: 14
- Create event: 1
Last Year
- Issue comment event: 2
- Member event: 1
- Push event: 18
- Pull request event: 14
- Create event: 1
Dependencies
- actions/checkout v4 composite
- azure/webapps-deploy v2 composite
- docker/build-push-action v3 composite
- docker/login-action v2 composite
- docker/setup-buildx-action v2 composite
- actions/checkout v4 composite
- docker/build-push-action v3 composite
- docker/setup-buildx-action v2 composite
- actions/checkout v4 composite
- actions/setup-python v5 composite
- astral-sh/setup-uv v2 composite
- duckduckgo-search >=6.3
- fastapi ~=0.115.0
- httpx ~=0.26.0
- langchain-anthropic ~= 0.2.0
- langchain-aws >=0.2.6
- langchain-community ~=0.3.0
- langchain-core ~=0.3.0
- langchain-google-genai ~=2.0.0
- langchain-groq ~=0.2.0
- langchain-openai ~=0.2.0
- langgraph ~=0.2.22
- langgraph-checkpoint ~=2.0.0
- langgraph-checkpoint-sqlite ~=2.0.0
- langsmith ~=0.1.96
- numexpr ~=2.10.1
- pydantic ~=2.9.0
- pyowm ~=3.3.0
- python-dotenv ~=1.0.1
- setuptools ~=74.0.0
- streamlit ~=1.37.0
- uvicorn ~=0.30.5
- httpx *
- pydantic *
- streamlit *