agentr 0.1.5__tar.gz → 0.1.7__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 (37) hide show
  1. {agentr-0.1.5 → agentr-0.1.7}/.gitignore +14 -14
  2. {agentr-0.1.5 → agentr-0.1.7}/.python-version +1 -1
  3. {agentr-0.1.5 → agentr-0.1.7}/LICENSE +21 -21
  4. {agentr-0.1.5 → agentr-0.1.7}/PKG-INFO +5 -2
  5. {agentr-0.1.5 → agentr-0.1.7}/README.md +147 -147
  6. {agentr-0.1.5 → agentr-0.1.7}/pyproject.toml +29 -23
  7. agentr-0.1.7/src/agentr/__init__.py +2 -0
  8. agentr-0.1.7/src/agentr/application.py +93 -0
  9. agentr-0.1.7/src/agentr/applications/__init__.py +27 -0
  10. agentr-0.1.7/src/agentr/applications/github/app.py +408 -0
  11. agentr-0.1.7/src/agentr/applications/google_calendar/app.py +548 -0
  12. agentr-0.1.7/src/agentr/applications/google_mail/app.py +565 -0
  13. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/applications/reddit/app.py +29 -29
  14. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/applications/resend/app.py +43 -43
  15. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/applications/tavily/app.py +57 -57
  16. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/applications/zenquotes/app.py +20 -20
  17. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/cli.py +76 -75
  18. agentr-0.1.7/src/agentr/config.py +15 -0
  19. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/exceptions.py +6 -5
  20. agentr-0.1.7/src/agentr/integration.py +85 -0
  21. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/server.py +113 -105
  22. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/store.py +70 -70
  23. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/test.py +39 -37
  24. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/utils/openapi.py +185 -184
  25. agentr-0.1.7/src/tests/__init__.py +0 -0
  26. agentr-0.1.7/src/tests/conftest.py +1 -0
  27. agentr-0.1.7/src/tests/test_agentr_server.py +20 -0
  28. agentr-0.1.7/src/tests/test_zenquotes.py +27 -0
  29. {agentr-0.1.5 → agentr-0.1.7}/uv.lock +140 -52
  30. agentr-0.1.5/src/agentr/__init__.py +0 -2
  31. agentr-0.1.5/src/agentr/application.py +0 -57
  32. agentr-0.1.5/src/agentr/applications/github/app.py +0 -56
  33. agentr-0.1.5/src/agentr/applications/google_calendar/app.py +0 -74
  34. agentr-0.1.5/src/agentr/applications/google_mail/app.py +0 -68
  35. agentr-0.1.5/src/agentr/integration.py +0 -98
  36. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/py.typed +0 -0
  37. {agentr-0.1.5 → agentr-0.1.7}/src/agentr/utils/bridge.py +0 -0
@@ -1,14 +1,14 @@
1
- # Python-generated files
2
- __pycache__/
3
- *.py[oc]
4
- build/
5
- dist/
6
- wheels/
7
- *.egg-info
8
-
9
- # Virtual environments
10
- .venv
11
-
12
- # Environment variables
13
- .env
14
- .env.local
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Environment variables
13
+ .env
14
+ .env.local
@@ -1 +1 @@
1
- 3.13
1
+ 3.13
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 AgentR
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 AgentR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentr
3
- Version: 0.1.5
4
- Summary: AgentR is a Python framework for building MCP servers to serve agentic applications and LLM clients
3
+ Version: 0.1.7
4
+ Summary: A python framework to build MCP servers
5
5
  Author-email: Manoj Bajaj <manojbajaj95@gmail.com>
6
6
  License-File: LICENSE
7
7
  Requires-Python: >=3.11
@@ -9,6 +9,9 @@ Requires-Dist: loguru>=0.7.3
9
9
  Requires-Dist: mcp>=1.5.0
10
10
  Requires-Dist: pyyaml>=6.0.2
11
11
  Requires-Dist: typer>=0.15.2
12
+ Provides-Extra: test
13
+ Requires-Dist: pytest-asyncio>=0.26.0; extra == 'test'
14
+ Requires-Dist: pytest>=8.3.5; extra == 'test'
12
15
  Description-Content-Type: text/markdown
13
16
 
14
17
  # AgentR
@@ -1,147 +1,147 @@
1
- # AgentR
2
-
3
- AgentR is a Python framework for building MCP servers to serve agentic applications and LLM clients. It provides a clean abstraction for incorporating various API services as "applications" into your agent workflow.
4
-
5
- ## 🌟 Features
6
-
7
- - **MCP (Model Context Protocol) Integration**: Seamlessly works with MCP server architecture
8
- - **Simplified API Integration**: Connect to services like GitHub, Google Calendar, Gmail, Reddit, Tavily, and more with minimal code
9
- - **Managed Authentication**: Built-in support for API keys and OAuth-based authentication flows
10
- - **Extensible Architecture**: Easily build and add new app integrations with minimal boilerplate
11
- - **Credential Management**: Flexible storage options for API credentials with memory and environment-based implementations
12
-
13
- ## 🔧 Installation
14
-
15
- Install AgentR using pip:
16
-
17
- ```bash
18
- pip install agentr
19
- ```
20
-
21
- ## 🚀 Quick Start
22
-
23
- ### 1. Get an API Key
24
- Before using AgentR with services that require authorization (like GitHub, Gmail, etc.), you'll need an AgentR API key:
25
-
26
- Visit https://agentr.dev to create an account
27
- Generate an API key from your dashboard
28
- Set it as an environment variable or include it directly in your code:
29
-
30
- ```bash
31
- export AGENTR_API_KEY="your_api_key_here"
32
- ```
33
-
34
- ### 2. Create a basic server
35
-
36
- ```bash
37
- from agentr.server import TestServer
38
-
39
- # Define your applications list
40
- apps_list = [
41
- {
42
- "name": "tavily",
43
- "integration": {
44
- "name": "tavily_api_key",
45
- "type": "api_key",
46
- "store": {
47
- "type": "environment",
48
- }
49
- },
50
- },
51
- {
52
- "name": "zenquotes",
53
- "integration": None
54
- },
55
- {
56
- "name": "github",
57
- "integration": {
58
- "name": "github",
59
- "type": "agentr",
60
- }
61
- }
62
- ]
63
-
64
- # Create a server with these applications
65
- server = TestServer(name="My Agent Server", description="A server for my agent apps", apps_list=apps_list)
66
-
67
- # Run the server
68
- if __name__ == "__main__":
69
- server.run()
70
- ```
71
-
72
- ## 🧩 Available Applications
73
- AgentR comes with several pre-built applications:
74
-
75
- | Application | Description | Authentication Type |
76
- |-------------|-------------|---------------------|
77
- | GitHub | Star repositories and more | OAuth (AgentR) |
78
- | Google Calendar | Retrieve calendar events | OAuth (AgentR) |
79
- | Gmail | Send emails | OAuth (AgentR) |
80
- | Reddit | Access Reddit data | OAuth (AgentR) |
81
- | Resend | Send emails via Resend API | API Key |
82
- | Tavily | Web search capabilities | API Key |
83
- | ZenQuotes | Get inspirational quotes | None |
84
-
85
- > **Note**: More applications are coming soon! Stay tuned for updates to our application catalog.
86
-
87
- ## 🔐 Integration Types
88
- AgentR supports two primary integration types:
89
-
90
- ### 1. API Key Integration
91
- For services that authenticate via API keys:
92
- ```python
93
- {
94
- "name": "service_name",
95
- "integration": {
96
- "name": "service_api_key",
97
- "type": "api_key",
98
- "store": {
99
- "type": "environment", # or "memory"
100
- }
101
- }
102
- }
103
- ```
104
-
105
- ### 2. OAuth Integration (via AgentR)
106
- For services requiring OAuth flow:
107
- ```python
108
- {
109
- "name": "service_name",
110
- "integration": {
111
- "name": "service_name",
112
- "type": "agentr"
113
- }
114
- }
115
- ```
116
- When using OAuth integrations, users will be directed to authenticate with the service provider through a secure flow managed by AgentR.
117
-
118
- ## 🤖 CLI Usage
119
- AgentR includes a command-line interface for common operations:
120
-
121
- ```bash
122
- # Get version information
123
- agentr version
124
-
125
- # Generate API client from OpenAPI schema
126
- agentr generate --schema path/to/openapi.yaml
127
-
128
- # Run the test server
129
- agentr run
130
-
131
- # Install AgentR for specific applications
132
- agentr install claude
133
- ```
134
-
135
- ## 📋 Requirements
136
-
137
- - Python 3.11+
138
- - Dependencies (automatically installed):
139
- - loguru >= 0.7.3
140
- - mcp >= 1.5.0
141
- - pyyaml >= 6.0.2
142
- - typer >= 0.15.2
143
-
144
-
145
- ## 📝 License
146
-
147
- This project is licensed under the MIT License.
1
+ # AgentR
2
+
3
+ AgentR is a Python framework for building MCP servers to serve agentic applications and LLM clients. It provides a clean abstraction for incorporating various API services as "applications" into your agent workflow.
4
+
5
+ ## 🌟 Features
6
+
7
+ - **MCP (Model Context Protocol) Integration**: Seamlessly works with MCP server architecture
8
+ - **Simplified API Integration**: Connect to services like GitHub, Google Calendar, Gmail, Reddit, Tavily, and more with minimal code
9
+ - **Managed Authentication**: Built-in support for API keys and OAuth-based authentication flows
10
+ - **Extensible Architecture**: Easily build and add new app integrations with minimal boilerplate
11
+ - **Credential Management**: Flexible storage options for API credentials with memory and environment-based implementations
12
+
13
+ ## 🔧 Installation
14
+
15
+ Install AgentR using pip:
16
+
17
+ ```bash
18
+ pip install agentr
19
+ ```
20
+
21
+ ## 🚀 Quick Start
22
+
23
+ ### 1. Get an API Key
24
+ Before using AgentR with services that require authorization (like GitHub, Gmail, etc.), you'll need an AgentR API key:
25
+
26
+ Visit https://agentr.dev to create an account
27
+ Generate an API key from your dashboard
28
+ Set it as an environment variable or include it directly in your code:
29
+
30
+ ```bash
31
+ export AGENTR_API_KEY="your_api_key_here"
32
+ ```
33
+
34
+ ### 2. Create a basic server
35
+
36
+ ```bash
37
+ from agentr.server import TestServer
38
+
39
+ # Define your applications list
40
+ apps_list = [
41
+ {
42
+ "name": "tavily",
43
+ "integration": {
44
+ "name": "tavily_api_key",
45
+ "type": "api_key",
46
+ "store": {
47
+ "type": "environment",
48
+ }
49
+ },
50
+ },
51
+ {
52
+ "name": "zenquotes",
53
+ "integration": None
54
+ },
55
+ {
56
+ "name": "github",
57
+ "integration": {
58
+ "name": "github",
59
+ "type": "agentr",
60
+ }
61
+ }
62
+ ]
63
+
64
+ # Create a server with these applications
65
+ server = TestServer(name="My Agent Server", description="A server for my agent apps", apps_list=apps_list)
66
+
67
+ # Run the server
68
+ if __name__ == "__main__":
69
+ server.run()
70
+ ```
71
+
72
+ ## 🧩 Available Applications
73
+ AgentR comes with several pre-built applications:
74
+
75
+ | Application | Description | Authentication Type |
76
+ |-------------|-------------|---------------------|
77
+ | GitHub | Star repositories and more | OAuth (AgentR) |
78
+ | Google Calendar | Retrieve calendar events | OAuth (AgentR) |
79
+ | Gmail | Send emails | OAuth (AgentR) |
80
+ | Reddit | Access Reddit data | OAuth (AgentR) |
81
+ | Resend | Send emails via Resend API | API Key |
82
+ | Tavily | Web search capabilities | API Key |
83
+ | ZenQuotes | Get inspirational quotes | None |
84
+
85
+ > **Note**: More applications are coming soon! Stay tuned for updates to our application catalog.
86
+
87
+ ## 🔐 Integration Types
88
+ AgentR supports two primary integration types:
89
+
90
+ ### 1. API Key Integration
91
+ For services that authenticate via API keys:
92
+ ```python
93
+ {
94
+ "name": "service_name",
95
+ "integration": {
96
+ "name": "service_api_key",
97
+ "type": "api_key",
98
+ "store": {
99
+ "type": "environment", # or "memory"
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ### 2. OAuth Integration (via AgentR)
106
+ For services requiring OAuth flow:
107
+ ```python
108
+ {
109
+ "name": "service_name",
110
+ "integration": {
111
+ "name": "service_name",
112
+ "type": "agentr"
113
+ }
114
+ }
115
+ ```
116
+ When using OAuth integrations, users will be directed to authenticate with the service provider through a secure flow managed by AgentR.
117
+
118
+ ## 🤖 CLI Usage
119
+ AgentR includes a command-line interface for common operations:
120
+
121
+ ```bash
122
+ # Get version information
123
+ agentr version
124
+
125
+ # Generate API client from OpenAPI schema
126
+ agentr generate --schema path/to/openapi.yaml
127
+
128
+ # Run the test server
129
+ agentr run
130
+
131
+ # Install AgentR for specific applications
132
+ agentr install claude
133
+ ```
134
+
135
+ ## 📋 Requirements
136
+
137
+ - Python 3.11+
138
+ - Dependencies (automatically installed):
139
+ - loguru >= 0.7.3
140
+ - mcp >= 1.5.0
141
+ - pyyaml >= 6.0.2
142
+ - typer >= 0.15.2
143
+
144
+
145
+ ## 📝 License
146
+
147
+ This project is licensed under the MIT License.
@@ -1,23 +1,29 @@
1
- [project]
2
- name = "agentr"
3
- version = "0.1.5"
4
- description = "AgentR is a Python framework for building MCP servers to serve agentic applications and LLM clients"
5
- readme = "README.md"
6
- authors = [
7
- { name = "Manoj Bajaj", email = "manojbajaj95@gmail.com" }
8
- ]
9
- requires-python = ">=3.11"
10
- dependencies = [
11
- "loguru>=0.7.3",
12
- "mcp>=1.5.0",
13
- "pyyaml>=6.0.2",
14
- "typer>=0.15.2",
15
- ]
16
-
17
- [project.scripts]
18
- agentr = "agentr.cli:app"
19
-
20
-
21
- [build-system]
22
- requires = ["hatchling"]
23
- build-backend = "hatchling.build"
1
+ [project]
2
+ name = "agentr"
3
+ version = "0.1.7"
4
+ description = "A python framework to build MCP servers"
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Manoj Bajaj", email = "manojbajaj95@gmail.com" }
8
+ ]
9
+ requires-python = ">=3.11"
10
+ dependencies = [
11
+ "loguru>=0.7.3",
12
+ "mcp>=1.5.0",
13
+ "pyyaml>=6.0.2",
14
+ "typer>=0.15.2",
15
+ ]
16
+
17
+ [project.optional-dependencies]
18
+ test = [
19
+ "pytest>=8.3.5",
20
+ "pytest-asyncio>=0.26.0",
21
+ ]
22
+
23
+ [project.scripts]
24
+ agentr = "agentr.cli:app"
25
+
26
+
27
+ [build-system]
28
+ requires = ["hatchling"]
29
+ build-backend = "hatchling.build"
@@ -0,0 +1,2 @@
1
+ def main():
2
+ print("hello")
@@ -0,0 +1,93 @@
1
+ from abc import ABC, abstractmethod
2
+
3
+ from loguru import logger
4
+ from agentr.exceptions import NotAuthorizedError
5
+ from agentr.integration import Integration
6
+ import httpx
7
+
8
+ class Application(ABC):
9
+ """
10
+ Application is collection of tools that can be used by an agent.
11
+ """
12
+ def __init__(self, name: str, **kwargs):
13
+ self.name = name
14
+
15
+ @abstractmethod
16
+ def list_tools(self):
17
+ pass
18
+
19
+
20
+ class APIApplication(Application):
21
+ """
22
+ APIApplication is an application that uses an API to interact with the world.
23
+ """
24
+ def __init__(self, name: str, integration: Integration = None, **kwargs):
25
+ super().__init__(name, **kwargs)
26
+ self.integration = integration
27
+
28
+ def _get_headers(self):
29
+ return {}
30
+
31
+ def _get(self, url, params=None):
32
+ try:
33
+ headers = self._get_headers()
34
+ response = httpx.get(url, headers=headers, params=params)
35
+ response.raise_for_status()
36
+ return response
37
+ except NotAuthorizedError as e:
38
+ logger.warning(f"Reddit authorization needed: {e.message}")
39
+ return e.message
40
+ except Exception as e:
41
+ logger.error(f"Error getting {url}: {e}")
42
+ raise e
43
+
44
+
45
+ def _post(self, url, data):
46
+ try:
47
+ headers = self._get_headers()
48
+ response = httpx.post(url, headers=headers, json=data)
49
+ response.raise_for_status()
50
+ return response
51
+ except NotAuthorizedError as e:
52
+ logger.warning(f"Reddit authorization needed: {e.message}")
53
+ return e.message
54
+ except httpx.HTTPStatusError as e:
55
+ if e.response.status_code == 429:
56
+ return e.response.text or "Rate limit exceeded. Please try again later."
57
+ else:
58
+ raise e
59
+ except Exception as e:
60
+ logger.error(f"Error posting {url}: {e}")
61
+ raise e
62
+
63
+ def _put(self, url, data):
64
+ try:
65
+ headers = self._get_headers()
66
+ response = httpx.put(url, headers=headers, json=data)
67
+ response.raise_for_status()
68
+ return response
69
+ except NotAuthorizedError as e:
70
+ logger.warning(f"Reddit authorization needed: {e.message}")
71
+ return e.message
72
+ except Exception as e:
73
+ logger.error(f"Error posting {url}: {e}")
74
+ raise e
75
+
76
+ def _delete(self, url):
77
+ try:
78
+ headers = self._get_headers()
79
+ response = httpx.delete(url, headers=headers)
80
+ response.raise_for_status()
81
+ return response
82
+ except NotAuthorizedError as e:
83
+ logger.warning(f"Reddit authorization needed: {e.message}")
84
+ return e.message
85
+ except Exception as e:
86
+ logger.error(f"Error posting {url}: {e}")
87
+
88
+ def validate(self):
89
+ pass
90
+
91
+ @abstractmethod
92
+ def list_tools(self):
93
+ pass
@@ -0,0 +1,27 @@
1
+ from agentr.applications.zenquotes.app import ZenQuoteApp
2
+ from agentr.applications.tavily.app import TavilyApp
3
+ from agentr.applications.github.app import GithubApp
4
+ from agentr.applications.google_calendar.app import GoogleCalendarApp
5
+ from agentr.applications.google_mail.app import GmailApp
6
+ from agentr.applications.resend.app import ResendApp
7
+ from agentr.applications.reddit.app import RedditApp
8
+
9
+ def app_from_name(name: str):
10
+ name = name.lower().strip()
11
+ name = name.replace(" ", "-")
12
+ if name == "zenquotes":
13
+ return ZenQuoteApp
14
+ elif name == "tavily":
15
+ return TavilyApp
16
+ elif name == "github":
17
+ return GithubApp
18
+ elif name == "google-calendar":
19
+ return GoogleCalendarApp
20
+ elif name == "google-mail":
21
+ return GmailApp
22
+ elif name == "resend":
23
+ return ResendApp
24
+ elif name == "reddit":
25
+ return RedditApp
26
+ else:
27
+ raise ValueError(f"App {name} not found")