### Install and Run Agent Service with uv Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Installs the agent-service-toolkit using uv, sets up the environment, and runs the FastAPI service. Requires an OpenAI API key to be set in a .env file. uv is the recommended installation method. ```shell # At least one LLM API key is required echo 'OPENAI_API_KEY=your_openai_api_key' >> .env # uv is the recommended way to install agent-service-toolkit, but "pip install ." also works # For uv installation options, see: https://docs.astral.sh/uv/getting-started/installation/ curl -LsSf https://astral.sh/uv/0.7.19/install.sh | sh # Install dependencies. "uv sync" creates .venv automatically uv sync --frozen source .venv/bin/activate python src/run_service.py ``` -------------------------------- ### Copy Environment Example Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Copies the example environment file to create a new environment file for configuration. ```sh cp .env.example .env ``` -------------------------------- ### Python AgentClient Invoke Example Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Example demonstrating how to use the AgentClient to invoke an agent and print the response. ```python from client import AgentClient client = AgentClient() response = client.invoke("Tell me a brief joke?") response.pretty_print() # ================================== Ai Message ================================== # # A man walked into a library and asked the librarian, "Do you have any books on Pavlov's dogs and Schrödinger's cat?" # The librarian replied, "It rings a bell, but I'm not sure if it's here or not." ``` -------------------------------- ### Install Dependencies and Activate Virtual Environment Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Installs project dependencies using uv sync and activates the Python virtual environment for local development. ```shell uv sync --frozen source .venv/bin/activate ``` -------------------------------- ### Install Development Dependencies and Pre-commit Hooks Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Installs development-specific dependencies and sets up pre-commit hooks for contributing to the project. Requires the virtual environment to be activated. ```shell uv sync --frozen pre-commit install ``` -------------------------------- ### Launch LangGraph Studio CLI Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Launches LangGraph Studio for agent development. Requires langgraph-cli[inmem] to be installed, typically via 'uv sync'. Ensure a .env file is present in the root directory. ```shell langgraph dev ``` -------------------------------- ### Run FastAPI Server Locally Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Starts the FastAPI server for the agent service. Assumes the virtual environment is activated and the script is in the correct path. ```shell python src/run_service.py ``` -------------------------------- ### Run Project Tests with Pytest Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Executes the project's tests using pytest. Ensure all development dependencies are installed and the virtual environment is activated before running. ```shell pytest ``` -------------------------------- ### Run Agent Service with Docker Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Sets an OpenAI API key in the .env file and starts the agent service using Docker Compose. This command is used for running the service in a containerized environment. ```shell echo 'OPENAI_API_KEY=your_openai_api_key' >> .env docker compose watch ``` -------------------------------- ### Pull Ollama Model Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/Ollama.md Command to download a specific model from Ollama, for example, 'llama3.2'. This model will then be available for the agent service to use. ```shell ollama pull llama3.2 ``` -------------------------------- ### Environment Variable for Google Vertex Credentials Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/File_Based_Credentials.md This example shows how to set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable in a `.env` file to point to a service account key file stored in the `privatecredentials/` directory. The Google Vertex SDK automatically uses this variable to locate the credentials. ```env GOOGLE_APPLICATION_CREDENTIALS=/privatecredentials/service-account-key.json ``` -------------------------------- ### Environment Variable for Remote API Certificate Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/File_Based_Credentials.md This example demonstrates setting a custom environment variable, `MY_REMOTE_API_CERTIFICATE`, in a `.env` file to specify the path to a certificate file located in the `privatecredentials/` directory. The agent's HTTP client can then use this environment variable to access the certificate for secure communication. ```env MY_REMOTE_API_CERTIFICATE=/privatecredentials/my_remote_api_certificate.cer ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Basic commands to clone the agent service toolkit repository and navigate into the project directory. ```sh git clone https://github.com/JoshuaC215/agent-service-toolkit.git cd agent-service-toolkit ``` -------------------------------- ### RAG Assistant Instructions Configuration Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/RAG_Assistant.md Python code snippet to define the instructions for a RAG assistant. It includes placeholders for the current date and emphasizes using only database information and a friendly tone. ```python instructions = f""" You are a helpful HR assistant with the ability to search a database containing information on our company's policies, benefits and handbook. Today's date is {current_date}. NOTE: THE USER CAN'T SEE THE TOOL RESPONSE. A few things to remember: - If you have access to multiple databases, gather information from a diverse range of sources before crafting your response. - Please include the source of the information used in your response. - Use a friendly but professional tone when replying. - Only use information from the database. Do not use information from outside sources. """ ``` -------------------------------- ### RAG Assistant Welcome Message Configuration Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/RAG_Assistant.md Python code snippet defining the welcome message for the RAG assistant. This message greets the user and explains the assistant's capabilities. ```python WELCOME = """Hello! I'm your AI-powered HR assistant, here to help you navigate company policies, the employee handbook, and benefits. Ask me anything!""" ``` -------------------------------- ### Run Streamlit App Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Activates the virtual environment and runs the Streamlit application, which provides a chat interface for the agent service. Assumes the virtual environment has already been set up. ```shell source .venv/bin/activate streamlit run src/streamlit_app.py ``` -------------------------------- ### Create Chroma Database CLI Command Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/RAG_Assistant.md This command initiates the creation of a Chroma database. Ensure the virtual environment is activated and the script points to the correct data directory. ```shell python scripts/create_chroma_db.py ``` -------------------------------- ### Build and Launch Services with Docker Compose Watch Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Command to build and launch the project services using Docker Compose in watch mode, enabling automatic updates on code changes. ```sh docker compose watch ``` -------------------------------- ### Run Streamlit App Locally Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Launches the Streamlit UI for the agent service in a separate terminal. The app is typically accessible at http://localhost:8501. ```shell streamlit run src/streamlit_app.py ``` -------------------------------- ### Set GOOGLE_APPLICATION_CREDENTIALS for Vertex AI (Unix/Linux) Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/VertexAI.md This command demonstrates how to export the GOOGLE_APPLICATION_CREDENTIALS environment variable on Unix-like systems. It directs applications to the location of the Vertex AI service account JSON key file for authentication. ```bash export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/project/privatecredentials/service-account-key.json ``` -------------------------------- ### Verify Vertex AI Service Account Activation Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/VertexAI.md These gcloud commands are used to activate a service account using its key file and list the authenticated accounts. This verifies that your Vertex AI credentials are set up correctly and recognized by the Google Cloud CLI. ```bash gcloud auth activate-service-account --key-file=/path/to/your/service-account-key.json gcloud auth list ``` -------------------------------- ### Rebuild Services with Docker Compose Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Command to rebuild services when configuration files like pyproject.toml or uv.lock are modified. ```sh docker compose up --build ``` -------------------------------- ### Set GOOGLE_APPLICATION_CREDENTIALS for Vertex AI (Windows) Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/VertexAI.md This command illustrates setting the GOOGLE_APPLICATION_CREDENTIALS environment variable on Windows systems. It specifies the path to the Vertex AI service account JSON key file, enabling application authentication. ```cmd set GOOGLE_APPLICATION_CREDENTIALS=C:\path\to\your\project\privatecredentials\service-account-key.json ``` -------------------------------- ### Add service-account-key.json to .gitignore Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/VertexAI.md This snippet shows how to add the service account key file name to the .gitignore file. This prevents accidental committing of sensitive credentials to version control, enhancing security. ```gitignore service-account-key.json ``` -------------------------------- ### Configure Ollama Host on MacOS Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/Ollama.md Sets the Ollama host environment variable on MacOS to allow external connections, necessary when running the service in Docker. ```shell launchctl setenv OLLAMA_HOST "0.0.0.0" ``` -------------------------------- ### Set OLLAMA_BASE_URL environment variable for Docker Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/Ollama.md Configures the base URL for the Ollama server when running the agent service in Docker. This allows the service to connect to the Ollama instance, often running on the host machine. ```shell export OLLAMA_BASE_URL=http://host.docker.internal:11434 ``` -------------------------------- ### Stop Docker Services Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/README.md Command to stop and remove all services defined in the Docker Compose file. ```sh docker compose down ``` -------------------------------- ### Docker Compose Volume Mount for Private Credentials Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/File_Based_Credentials.md This docker-compose.yml snippet demonstrates mounting the local `privatecredentials/` directory into the container at the `/privatecredentials/` path. This allows the running container to access the sensitive files stored locally on the development machine. ```yaml services: your_agent_service: build: context: . volumes: - ./privatecredentials/:/privatecredentials/ ``` -------------------------------- ### Set OLLAMA_MODEL environment variable Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/Ollama.md Sets the environment variable to specify which Ollama model the agent service should use. This is crucial for selecting the desired LLM. ```shell export OLLAMA_MODEL=llama3.2 ``` -------------------------------- ### Docker Ignore for Private Credentials Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/File_Based_Credentials.md This .dockerignore configuration prevents the entire `privatecredentials/` folder from being included in the Docker build context. This is crucial for security, as it ensures that sensitive credentials are not baked into the container image. ```docker privatecredentials/ ``` -------------------------------- ### Git Ignore for Private Credentials Source: https://github.com/joshuac215/agent-service-toolkit/blob/main/docs/File_Based_Credentials.md This .gitignore configuration prevents the `privatecredentials/` folder, except for a `.gitkeep` file, from being tracked by Git. This ensures that sensitive files within this directory are not committed to the repository, while still allowing the directory structure to be present. ```git privatecredentials/* !privatecredentials/.gitkeep ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.