https://github.com/abeenoch/base-network-agent

fullstack . AI AGENT for BASE network.

https://github.com/abeenoch/base-network-agent

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
Last synced: 9 months ago · JSON representation

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
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License

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

  1. LangGraph Agent: A customizable agent built using the LangGraph framework.
  2. FastAPI Service: Serves the agent with both streaming and non-streaming endpoints.
  3. PostgreSQL Database Support: Uses PostgreSQL with an asynchronous engine to handle database operations efficiently.
  4. Docker Support: Simplifies deployment with a preconfigured Dockerfile.
  5. Render Hosting:Backend hosted on Render for streamlined deployment and scalability.
  6. Asynchronous Requests: Fully supports asynchronous processing for high-concurrency applications.
  7. Advanced Streaming: A novel approach to support both token-based and message-based streaming.
  8. Streamlit Interface: Provides a user-friendly chat interface for interacting with the agent.
  9. Multiple Agent Support: Run multiple agents in the service and call by URL path
  10. Asynchronous Design: Utilizes async/await for efficient handling of concurrent requests.
  11. 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 agent
  • src/agents/models.py: Configures available models based on ENV
  • src/agents/agents.py: Mapping of all agents provided by the service
  • src/schema/schema.py: Defines the protocol schema
  • src/service/service.py: FastAPI service to serve the agents
  • src/client/client.py: Client to interact with the agent service
  • src/streamlit_app.py: Streamlit app providing a chat interface
  • docker: 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

  1. Clone the repository:

sh git clone https://github.com/abeenoch/base-network-agent.git cd base-network-agent

  1. Set up environment variables: Create a .env file 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= ```

  1. 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.

  1. Create a virtual environment and install dependencies:

sh pip install uv uv sync --frozen --extra dev source .venv/bin/activate

  1. Run the FastAPI server:

sh python src/run_service.py

  1. In a separate terminal, run the Streamlit app:

sh streamlit run src/streamlit_app.py

  1. 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:

  1. Add your new agent to the src/agents directory. You can copy research_assistant.py or chatbot.py and modify it to change the agent's behavior and tools.
  2. Import and add your new agent to the agents dictionary in src/agents/agents.py. Your agent can be called by /<your_agent_name>/invoke or /<your_agent_name>/stream.
  3. Adjust the Streamlit interface in src/streamlit_app.py to match your agent's capabilities.

Owner

  • Name: Abe Enoch Aboluwarin
  • Login: abeenoch
  • Kind: user
  • Location: nigeria

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

.github/workflows/deploy.yml actions
  • 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
.github/workflows/test-docker.yml actions
  • actions/checkout v4 composite
  • docker/build-push-action v3 composite
  • docker/setup-buildx-action v2 composite
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • astral-sh/setup-uv v2 composite
pyproject.toml pypi
  • 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
requirements.txt pypi
  • httpx *
  • pydantic *
  • streamlit *