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 (UV Package manager)
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. There are also examples for other package managers.
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
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
Releasing: Maintainers Only
To release a new version of the package, follow these steps:
-
Create a new branch for the release:
git checkout -b release-X.Y.Z. -
Update the version in
pyproject.toml. -
Commit the changes with a message like "Bump version to X.Y.Z".
git commit -m "Bump version to X.Y.Z". -
Make a pull request to the
masterbranch. -
Once the pull request is approved and merged, checkout the
masterbranch:git checkout master. -
Pull the latest changes:
git pull origin master. -
Tag the release:
git tag vX.Y.Z. Note that a tag name should be in the formatvX.Y.Z. -
Push the tag to the remote repository:
git push --tags. -
This will trigger the release workflow, which will build and publish the package to PyPI.
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.12.tar.gz.
File metadata
- Download URL: grasp_agents-0.1.12.tar.gz
- Upload date:
- Size: 32.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b98a1895cf12716a5755c501ad0744c5315e6946acc86e6b5e0391730aff642
|
|
| MD5 |
5edded22534d57394c0faaad4ac7373c
|
|
| BLAKE2b-256 |
793ce10a6f42dee29894dd0ea2d6af45beb2e45a485823e459a8c2601ff80753
|
File details
Details for the file grasp_agents-0.1.12-py3-none-any.whl.
File metadata
- Download URL: grasp_agents-0.1.12-py3-none-any.whl
- Upload date:
- Size: 48.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c71b403560049c8f054bd2ddc60d92c7374e0964b94d3609c8ef4107bc33a023
|
|
| MD5 |
54374be2e597b2e44508432326e6260e
|
|
| BLAKE2b-256 |
42449f959c4a57f6e30087ff3c39a4a3a2232555efa34b1a8fe3443c5137c09c
|