Skip to content

Commit

Permalink
Add hosted app reference to README
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaC215 committed Aug 8, 2024
1 parent df65818 commit 2e9e4a8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@

This repository provides a blueprint and full toolkit for a LangGraph-based agent service architecture. It includes a [LangGraph](https://langchain-ai.github.io/langgraph/) agent, a [FastAPI](https://fastapi.tiangolo.com/) service to serve it, a client to interact with the service, and a [Streamlit](https://streamlit.io/) app that uses the client to provide a chat interface.

## Purpose
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 to user interface, making it easier to get started with LangGraph-based projects by providing a full, robust toolkit.

The purpose of this project is to offer a template for developers to easily build and run their own agents using the LangGraph framework. It demonstrates a complete setup from agent definition to user interface, making it easier to get started with LangGraph-based projects by providing a full, robust kit.
## Overview

## Structure
### [Try the app!](https://agent-service-toolkit.streamlit.app/)

[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://agent-service-toolkit.streamlit.app/)


<a href="https://agent-service-toolkit.streamlit.app/"><img src="media/app_screenshot.png" width="600"></a>

The repository is structured as follows:

- `agent/agent.py`: Defines the LangGraph agent
- `schema/__init__.py`: Defines the service schema
- `service/service.py`: FastAPI service to serve the agent
- `client/__init__.py`: Client to interact with the agent service
- `streamlit_app.py`: Streamlit app providing a chat interface

### Architecture Diagram

<img src="media/agent_architecture.png" width="600">

## Key Features
### 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.
Expand All @@ -31,6 +30,16 @@ The repository is structured as follows:
7. **Feedback Mechanism**: Includes a star-based feedback system integrated with LangSmith.
8. **Docker Support**: Includes Dockerfiles and a docker compose file for easy development and deployment.

### Key Files

The repository is structured as follows:

- `agent/agent.py`: Defines the LangGraph agent
- `schema/__init__.py`: Defines the service schema
- `service/service.py`: FastAPI service to serve the agent
- `client/__init__.py`: Client to interact with the agent service
- `streamlit_app.py`: Streamlit app providing a chat interface

## Why LangGraph?

AI agents are increasingly being built with more explicitly structured and tightly controlled [Compound AI Systems](https://bair.berkeley.edu/blog/2024/02/18/compound-ai-systems/), with careful attention to the [cognitive architecture](https://blog.langchain.dev/what-is-a-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.
Expand Down
13 changes: 8 additions & 5 deletions agent/tools.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import inspect
import math
import numexpr
import re
from langchain_core.tools import tool
from langchain_core.tools import tool, BaseTool
from langchain_community.tools import DuckDuckGoSearchResults, ArxivQueryRun

web_search = DuckDuckGoSearchResults()
web_search = DuckDuckGoSearchResults(name="WebSearch")

# Kinda busted since it doesn't return links
arxiv_search = ArxivQueryRun()
arxiv_search = ArxivQueryRun(name="ArxivSearch")

@tool
def calculator(expression: str) -> str:
def calculator_func(expression: str) -> str:
"""Calculates a math expression using numexpr.
Useful for when you need to answer questions about math using numexpr.
Expand Down Expand Up @@ -39,3 +39,6 @@ def calculator(expression: str) -> str:
f'calculator("{expression}") raised error: {e}.'
" Please try again with a valid numerical expression"
)

calculator: BaseTool = tool(calculator_func)
calculator.name = "Calculator"
Binary file added media/app_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2e9e4a8

Please sign in to comment.