Grasp Agents Library
Project description
grasp_agents
Overview
grasp-agents is a modular Python framework for building agentic AI pipelines and applications. It provides reusable agent classes, message handling, LLM integration, memory, and orchestration utilities. The framework is designed for flexibility, composability, and clarity, enabling rapid prototyping and robust development of multi-agent systems.
Features
- Modular agent base classes
- Message and memory management
- LLM and tool orchestration
- Logging and usage tracking
- Extensible architecture
Project Structure
src/grasp_agents/— Core framework modulesbase_agent.py,llm_agent.py,comm_agent.py: Agent classesagent_message.py,agent_message_pool.py: Messagingmemory.py: Memory managementcloud_llm.py,llm.py: LLM integrationtool_orchestrator.py: Tool orchestrationusage_tracker.py,grasp_logging.py: Usage and loggingdata_retrieval/,openai/,typing/,workflow/: Extensions and utilities
configs/— Configuration filesdata/— Logs and datasets
Quickstart & Installation Variants
Option 1: UV Package Manager Project
Note: You can check this sample project code in the src/grasp_agents/examples/demo/uv folder. Feel free to copy and paste the code from there to a separate project.
1. Prerequisites
Install the UV Package Manager:
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Create Project & Install Dependencies
mkdir my-test-uv-app
cd my-test-uv-app
uv init .
Create and activate a virtual environment:
uv venv
source .venv/bin/activate
Add and sync dependencies:
uv add grasp_agents
uv sync
3. Example Usage
Create a file, e.g., hello.py:
Ensure you have a .env file with your OpenAI and Google AI Studio API keys set
OPENAI_API_KEY=your_openai_api_key
GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
import asyncio
from typing import Any
from grasp_agents.llm_agent import LLMAgent
from grasp_agents.openai.openai_llm import (
OpenAILLM,
OpenAILLMSettings,
)
from grasp_agents.typing.io import (
AgentPayload,
)
from grasp_agents.run_context import RunContextWrapper
from dotenv import load_dotenv
load_dotenv()
class Response(AgentPayload):
response: str
chatbot = LLMAgent[Any, Response, None](
agent_id="chatbot",
llm=OpenAILLM(
model_name="gpt-4o",
llm_settings=OpenAILLMSettings(),
),
sys_prompt=None,
out_schema=Response,
)
@chatbot.parse_output_handler
def output_handler(conversation, ctx, **kwargs) -> Response:
return Response(response=conversation[-1].content)
async def main():
ctx = RunContextWrapper(print_messages=True)
out = await chatbot.run("Hello, agent!", ctx=ctx)
print(out.payloads[0].response)
asyncio.run(main())
Run your script:
uv run hello.py
Option 2: PIP-only (requirements.txt-based) Project
Note: You can check this sample project code in the src/grasp_agents/examples/demo/pip folder. Feel free to copy and paste the code from there to a separate project.
1. Create Project Folder
mkdir my-test-pip-app
cd my-test-pip-app
2. Install Python 3.11.9 (Recommended)
If using pyenv:
brew install pyenv
pyenv install 3.11.9
pyenv local 3.11.9
Open a new terminal after setting the Python version.
3. Create & Activate Virtual Environment
python -m venv .venv
source .venv/bin/activate
If you see ModuleNotFoundError: No module named 'yaml', run:
pip install pyyaml
4. Install Grasp Agents SDK
If you have a requirements.txt:
pip install -r requirements.txt
Or install directly:
pip install grasp-agents
5. Example Usage
Create a file, e.g., hello.py, and use the same code as above.
6. Run the App
python hello.py
Development
To develop and test the library locally, follow these steps:
1. Install UV Package Manager
Make sure UV is installed on your system:
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Install Dependencies
Create a new virtual environment and install dependencies:
uv venv
source .venv/bin/activate
uv sync
3. Test Example for VS Code
-
Install the Jupyter Notebook extension.
-
Ensure you have a
.envfile with your OpenAI and Google AI Studio API keys set (see .env.example).
OPENAI_API_KEY=your_openai_api_key
GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
You're now ready to run and experiment with the example notebook.
4. Recommended VS Code Extensions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grasp_agents-0.1.9.tar.gz.
File metadata
- Download URL: grasp_agents-0.1.9.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5b3491b0597fd24abee34d88fd7749b9f393642f67ea9da8d13924f8a1f3098
|
|
| MD5 |
92aeb00e6d865478faf45f804755e24c
|
|
| BLAKE2b-256 |
d87a360abc6c6d79f7091d43bbbbbd26b91b09f50a2404f18fd60d0c3f3bd221
|
File details
Details for the file grasp_agents-0.1.9-py3-none-any.whl.
File metadata
- Download URL: grasp_agents-0.1.9-py3-none-any.whl
- Upload date:
- Size: 48.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5064265be9031054101d7a29488caa9d356be89b65057c40266cdfe0e10fb35d
|
|
| MD5 |
8e72b90d2af07dd426d7c1635bdf7122
|
|
| BLAKE2b-256 |
36144ef5415bfa34367a5dae8dda6af4f36ea8666e31d5394281f0c1f73c48b2
|