grasp_agents 0.1.7__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. grasp_agents-0.1.9/LICENSE.md +11 -0
  2. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/PKG-INFO +74 -19
  3. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/README.md +70 -18
  4. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/pyproject.toml +3 -1
  5. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/.gitignore +0 -0
  6. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/LICENSE +0 -0
  7. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/agent_message.py +0 -0
  8. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/agent_message_pool.py +0 -0
  9. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/base_agent.py +0 -0
  10. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/cloud_llm.py +0 -0
  11. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/comm_agent.py +0 -0
  12. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/costs_dict.yaml +0 -0
  13. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/data_retrieval/__init__.py +0 -0
  14. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/data_retrieval/rate_limiter_chunked.py +0 -0
  15. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/data_retrieval/types.py +0 -0
  16. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/data_retrieval/utils.py +0 -0
  17. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/grasp_logging.py +0 -0
  18. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/http_client.py +0 -0
  19. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/llm.py +0 -0
  20. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/llm_agent.py +0 -0
  21. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/llm_agent_state.py +0 -0
  22. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/memory.py +0 -0
  23. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/__init__.py +0 -0
  24. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/completion_converters.py +0 -0
  25. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/content_converters.py +0 -0
  26. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/converters.py +0 -0
  27. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/message_converters.py +0 -0
  28. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/openai_llm.py +0 -0
  29. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/openai/tool_converters.py +0 -0
  30. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/printer.py +0 -0
  31. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/prompt_builder.py +0 -0
  32. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/run_context.py +0 -0
  33. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/tool_orchestrator.py +0 -0
  34. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/__init__.py +0 -0
  35. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/completion.py +0 -0
  36. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/content.py +0 -0
  37. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/converters.py +0 -0
  38. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/io.py +0 -0
  39. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/message.py +0 -0
  40. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/typing/tool.py +0 -0
  41. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/usage_tracker.py +0 -0
  42. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/utils.py +0 -0
  43. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/workflow/__init__.py +0 -0
  44. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/workflow/looped_agent.py +0 -0
  45. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/workflow/sequential_agent.py +0 -0
  46. {grasp_agents-0.1.7 → grasp_agents-0.1.9}/src/grasp_agents/workflow/workflow_agent.py +0 -0
@@ -0,0 +1,11 @@
1
+ Grasp Agents itself is [MIT](https://mit-license.org/)-licensed.
2
+
3
+ Package production dependencies are licensed under the following terms:
4
+
5
+ | Name | Version | License | URL |
6
+ | --------- | ------- | ------------------------------------------------- | --------------------------------------- |
7
+ | httpx | 0.28.1 | BSD License | https://github.com/encode/httpx |
8
+ | openai | 1.77.0 | Apache Software License | https://github.com/openai/openai-python |
9
+ | tenacity | 9.1.2 | Apache Software License | https://github.com/jd/tenacity |
10
+ | termcolor | 2.5.0 | MIT License | https://github.com/termcolor/termcolor |
11
+ | tqdm | 4.67.1 | MIT License; Mozilla Public License 2.0 (MPL 2.0) | https://tqdm.github.io |
@@ -1,11 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: grasp_agents
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Grasp Agents Library
5
5
  License-File: LICENSE
6
+ License-File: LICENSE.md
6
7
  Requires-Python: <3.12,>=3.11.4
8
+ Requires-Dist: dotenv>=0.9.9
7
9
  Requires-Dist: httpx<1,>=0.27.0
8
10
  Requires-Dist: openai<2,>=1.68.2
11
+ Requires-Dist: pyyaml>=6.0.2
9
12
  Requires-Dist: tenacity>=9.1.2
10
13
  Requires-Dist: termcolor<3,>=2.4.0
11
14
  Requires-Dist: tqdm<5,>=4.66.2
@@ -20,7 +23,7 @@ Description-Content-Type: text/markdown
20
23
 
21
24
  [![PyPI version](https://badge.fury.io/py/grasp_agents.svg)](https://badge.fury.io/py/grasp_agents)
22
25
  [![Python Versions](https://img.shields.io/pypi/pyversions/grasp_agents?style=flat-square)](https://pypi.org/project/grasp_agents/)
23
- [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](LICENSE)
26
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](https://mit-license.org/)
24
27
 
25
28
  ## Overview
26
29
 
@@ -51,6 +54,8 @@ grasp-agents is a modular Python framework for building agentic AI pipelines and
51
54
 
52
55
  ### Option 1: UV Package Manager Project
53
56
 
57
+ > **Note:** You can check this sample project code in the [src/grasp_agents/examples/demo/uv](src/grasp_agents/examples/demo/uv) folder. Feel free to copy and paste the code from there to a separate project.
58
+
54
59
  #### 1. Prerequisites
55
60
 
56
61
  Install the [UV Package Manager](https://github.com/astral-sh/uv):
@@ -85,31 +90,72 @@ uv sync
85
90
 
86
91
  Create a file, e.g., `hello.py`:
87
92
 
93
+ Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set
94
+
95
+ ```
96
+ OPENAI_API_KEY=your_openai_api_key
97
+ GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
98
+ ```
99
+
88
100
  ```python
101
+ import asyncio
102
+ from typing import Any
103
+
89
104
  from grasp_agents.llm_agent import LLMAgent
90
- from grasp_agents.base_agent import BaseAgentConfig
105
+ from grasp_agents.openai.openai_llm import (
106
+ OpenAILLM,
107
+ OpenAILLMSettings,
108
+ )
109
+ from grasp_agents.typing.io import (
110
+ AgentPayload,
111
+ )
112
+ from grasp_agents.run_context import RunContextWrapper
113
+
114
+ from dotenv import load_dotenv
115
+
116
+ load_dotenv()
117
+
118
+ class Response(AgentPayload):
119
+ response: str
91
120
 
92
- agent = LLMAgent(
93
- config=BaseAgentConfig(
94
- model="gpt-4o-mini",
95
- memory=None, # or your memory implementation
96
- )
121
+
122
+ chatbot = LLMAgent[Any, Response, None](
123
+ agent_id="chatbot",
124
+ llm=OpenAILLM(
125
+ model_name="gpt-4o",
126
+ llm_settings=OpenAILLMSettings(),
127
+ ),
128
+ sys_prompt=None,
129
+ out_schema=Response,
97
130
  )
98
131
 
99
- response = agent.run("Hello, agent!")
100
- print(response)
132
+
133
+ @chatbot.parse_output_handler
134
+ def output_handler(conversation, ctx, **kwargs) -> Response:
135
+ return Response(response=conversation[-1].content)
136
+
137
+
138
+ async def main():
139
+ ctx = RunContextWrapper(print_messages=True)
140
+ out = await chatbot.run("Hello, agent!", ctx=ctx)
141
+ print(out.payloads[0].response)
142
+
143
+
144
+ asyncio.run(main())
101
145
  ```
102
146
 
103
147
  Run your script:
104
148
 
105
149
  ```bash
106
- python hello.py
150
+ uv run hello.py
107
151
  ```
108
152
 
109
153
  ---
110
154
 
111
155
  ### Option 2: PIP-only (requirements.txt-based) Project
112
156
 
157
+ > **Note:** You can check this sample project code in the [src/grasp_agents/examples/demo/pip](src/grasp_agents/examples/demo/pip) folder. Feel free to copy and paste the code from there to a separate project.
158
+
113
159
  #### 1. Create Project Folder
114
160
 
115
161
  ```bash
@@ -168,10 +214,6 @@ python hello.py
168
214
 
169
215
  ---
170
216
 
171
- ## License
172
-
173
- MIT License. See [LICENSE](LICENSE) for details.
174
-
175
217
  ## Development
176
218
 
177
219
  To develop and test the library locally, follow these steps:
@@ -194,10 +236,23 @@ source .venv/bin/activate
194
236
  uv sync
195
237
  ```
196
238
 
197
- ### 3. Test Example
239
+ ### 3. Test Example for VS Code
198
240
 
199
- - Install the Jupyter Notebook extension for VS Code.
200
- - Open `src/grasp_agents/examples/notebooks/agents_demo.ipynb` in VS Code.
201
- - Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set (see `.env.example`).
241
+ - Install the [Jupyter Notebook extension](https://marketplace.visualstudio.com/items/?itemName=ms-toolsai.jupyter).
242
+
243
+ - Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set (see [.env.example](.env.example)).
244
+
245
+ ```
246
+ OPENAI_API_KEY=your_openai_api_key
247
+ GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
248
+ ```
249
+
250
+ - Open [src/grasp_agents/examples/notebooks/agents_demo.ipynb](src/grasp_agents/examples/notebooks/agents_demo.ipynb).
202
251
 
203
252
  You're now ready to run and experiment with the example notebook.
253
+
254
+ ### 4. Recommended VS Code Extensions
255
+
256
+ - [Ruff](https://marketplace.visualstudio.com/items/?itemName=charliermarsh.ruff) -- for formatting and code analysis
257
+ - [Pylint](https://marketplace.visualstudio.com/items/?itemName=ms-python.pylint) -- for linting
258
+ - [Pylance](https://marketplace.visualstudio.com/items/?itemName=ms-python.vscode-pylance) -- for type checking
@@ -7,7 +7,7 @@
7
7
 
8
8
  [![PyPI version](https://badge.fury.io/py/grasp_agents.svg)](https://badge.fury.io/py/grasp_agents)
9
9
  [![Python Versions](https://img.shields.io/pypi/pyversions/grasp_agents?style=flat-square)](https://pypi.org/project/grasp_agents/)
10
- [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](LICENSE)
10
+ [![License: MIT](https://img.shields.io/badge/license-MIT-yellow?style=flat-square)](https://mit-license.org/)
11
11
 
12
12
  ## Overview
13
13
 
@@ -38,6 +38,8 @@ grasp-agents is a modular Python framework for building agentic AI pipelines and
38
38
 
39
39
  ### Option 1: UV Package Manager Project
40
40
 
41
+ > **Note:** You can check this sample project code in the [src/grasp_agents/examples/demo/uv](src/grasp_agents/examples/demo/uv) folder. Feel free to copy and paste the code from there to a separate project.
42
+
41
43
  #### 1. Prerequisites
42
44
 
43
45
  Install the [UV Package Manager](https://github.com/astral-sh/uv):
@@ -72,31 +74,72 @@ uv sync
72
74
 
73
75
  Create a file, e.g., `hello.py`:
74
76
 
77
+ Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set
78
+
79
+ ```
80
+ OPENAI_API_KEY=your_openai_api_key
81
+ GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
82
+ ```
83
+
75
84
  ```python
85
+ import asyncio
86
+ from typing import Any
87
+
76
88
  from grasp_agents.llm_agent import LLMAgent
77
- from grasp_agents.base_agent import BaseAgentConfig
89
+ from grasp_agents.openai.openai_llm import (
90
+ OpenAILLM,
91
+ OpenAILLMSettings,
92
+ )
93
+ from grasp_agents.typing.io import (
94
+ AgentPayload,
95
+ )
96
+ from grasp_agents.run_context import RunContextWrapper
97
+
98
+ from dotenv import load_dotenv
99
+
100
+ load_dotenv()
101
+
102
+ class Response(AgentPayload):
103
+ response: str
78
104
 
79
- agent = LLMAgent(
80
- config=BaseAgentConfig(
81
- model="gpt-4o-mini",
82
- memory=None, # or your memory implementation
83
- )
105
+
106
+ chatbot = LLMAgent[Any, Response, None](
107
+ agent_id="chatbot",
108
+ llm=OpenAILLM(
109
+ model_name="gpt-4o",
110
+ llm_settings=OpenAILLMSettings(),
111
+ ),
112
+ sys_prompt=None,
113
+ out_schema=Response,
84
114
  )
85
115
 
86
- response = agent.run("Hello, agent!")
87
- print(response)
116
+
117
+ @chatbot.parse_output_handler
118
+ def output_handler(conversation, ctx, **kwargs) -> Response:
119
+ return Response(response=conversation[-1].content)
120
+
121
+
122
+ async def main():
123
+ ctx = RunContextWrapper(print_messages=True)
124
+ out = await chatbot.run("Hello, agent!", ctx=ctx)
125
+ print(out.payloads[0].response)
126
+
127
+
128
+ asyncio.run(main())
88
129
  ```
89
130
 
90
131
  Run your script:
91
132
 
92
133
  ```bash
93
- python hello.py
134
+ uv run hello.py
94
135
  ```
95
136
 
96
137
  ---
97
138
 
98
139
  ### Option 2: PIP-only (requirements.txt-based) Project
99
140
 
141
+ > **Note:** You can check this sample project code in the [src/grasp_agents/examples/demo/pip](src/grasp_agents/examples/demo/pip) folder. Feel free to copy and paste the code from there to a separate project.
142
+
100
143
  #### 1. Create Project Folder
101
144
 
102
145
  ```bash
@@ -155,10 +198,6 @@ python hello.py
155
198
 
156
199
  ---
157
200
 
158
- ## License
159
-
160
- MIT License. See [LICENSE](LICENSE) for details.
161
-
162
201
  ## Development
163
202
 
164
203
  To develop and test the library locally, follow these steps:
@@ -181,10 +220,23 @@ source .venv/bin/activate
181
220
  uv sync
182
221
  ```
183
222
 
184
- ### 3. Test Example
223
+ ### 3. Test Example for VS Code
185
224
 
186
- - Install the Jupyter Notebook extension for VS Code.
187
- - Open `src/grasp_agents/examples/notebooks/agents_demo.ipynb` in VS Code.
188
- - Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set (see `.env.example`).
225
+ - Install the [Jupyter Notebook extension](https://marketplace.visualstudio.com/items/?itemName=ms-toolsai.jupyter).
226
+
227
+ - Ensure you have a `.env` file with your OpenAI and Google AI Studio API keys set (see [.env.example](.env.example)).
228
+
229
+ ```
230
+ OPENAI_API_KEY=your_openai_api_key
231
+ GOOGLE_AI_STUDIO_API_KEY=your_google_ai_studio_api_key
232
+ ```
233
+
234
+ - Open [src/grasp_agents/examples/notebooks/agents_demo.ipynb](src/grasp_agents/examples/notebooks/agents_demo.ipynb).
189
235
 
190
236
  You're now ready to run and experiment with the example notebook.
237
+
238
+ ### 4. Recommended VS Code Extensions
239
+
240
+ - [Ruff](https://marketplace.visualstudio.com/items/?itemName=charliermarsh.ruff) -- for formatting and code analysis
241
+ - [Pylint](https://marketplace.visualstudio.com/items/?itemName=ms-python.pylint) -- for linting
242
+ - [Pylance](https://marketplace.visualstudio.com/items/?itemName=ms-python.vscode-pylance) -- for type checking
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "grasp_agents"
3
- version = "0.1.7"
3
+ version = "0.1.9"
4
4
  description = "Grasp Agents Library"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11.4,<3.12"
@@ -10,6 +10,8 @@ dependencies = [
10
10
  "tenacity>=9.1.2",
11
11
  "termcolor>=2.4.0,<3",
12
12
  "tqdm>=4.66.2,<5",
13
+ "dotenv>=0.9.9",
14
+ "pyyaml>=6.0.2",
13
15
  ]
14
16
 
15
17
  [dependency-groups]
File without changes
File without changes