agentr 0.1.3__tar.gz → 0.1.5__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 (28) hide show
  1. {agentr-0.1.3 → agentr-0.1.5}/.gitignore +14 -14
  2. {agentr-0.1.3 → agentr-0.1.5}/.python-version +1 -1
  3. agentr-0.1.5/LICENSE +21 -0
  4. agentr-0.1.5/PKG-INFO +160 -0
  5. agentr-0.1.5/README.md +147 -0
  6. {agentr-0.1.3 → agentr-0.1.5}/pyproject.toml +23 -23
  7. agentr-0.1.5/src/agentr/__init__.py +2 -0
  8. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/application.py +56 -56
  9. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/github/app.py +55 -51
  10. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/google_calendar/app.py +73 -73
  11. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/google_mail/app.py +67 -67
  12. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/reddit/app.py +29 -29
  13. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/resend/app.py +43 -43
  14. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/tavily/app.py +57 -57
  15. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/applications/zenquotes/app.py +20 -20
  16. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/cli.py +75 -58
  17. agentr-0.1.5/src/agentr/exceptions.py +5 -0
  18. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/integration.py +98 -91
  19. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/server.py +105 -105
  20. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/store.py +70 -70
  21. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/test.py +37 -37
  22. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/utils/openapi.py +184 -184
  23. {agentr-0.1.3 → agentr-0.1.5}/uv.lock +7 -7
  24. agentr-0.1.3/PKG-INFO +0 -10
  25. agentr-0.1.3/README.md +0 -0
  26. agentr-0.1.3/src/agentr/__init__.py +0 -2
  27. {agentr-0.1.3 → agentr-0.1.5}/src/agentr/py.typed +0 -0
  28. {agentr-0.1.3 → agentr-0.1.5}/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
agentr-0.1.5/LICENSE ADDED
@@ -0,0 +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.
agentr-0.1.5/PKG-INFO ADDED
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
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
5
+ Author-email: Manoj Bajaj <manojbajaj95@gmail.com>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: loguru>=0.7.3
9
+ Requires-Dist: mcp>=1.5.0
10
+ Requires-Dist: pyyaml>=6.0.2
11
+ Requires-Dist: typer>=0.15.2
12
+ Description-Content-Type: text/markdown
13
+
14
+ # AgentR
15
+
16
+ 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.
17
+
18
+ ## 🌟 Features
19
+
20
+ - **MCP (Model Context Protocol) Integration**: Seamlessly works with MCP server architecture
21
+ - **Simplified API Integration**: Connect to services like GitHub, Google Calendar, Gmail, Reddit, Tavily, and more with minimal code
22
+ - **Managed Authentication**: Built-in support for API keys and OAuth-based authentication flows
23
+ - **Extensible Architecture**: Easily build and add new app integrations with minimal boilerplate
24
+ - **Credential Management**: Flexible storage options for API credentials with memory and environment-based implementations
25
+
26
+ ## 🔧 Installation
27
+
28
+ Install AgentR using pip:
29
+
30
+ ```bash
31
+ pip install agentr
32
+ ```
33
+
34
+ ## 🚀 Quick Start
35
+
36
+ ### 1. Get an API Key
37
+ Before using AgentR with services that require authorization (like GitHub, Gmail, etc.), you'll need an AgentR API key:
38
+
39
+ Visit https://agentr.dev to create an account
40
+ Generate an API key from your dashboard
41
+ Set it as an environment variable or include it directly in your code:
42
+
43
+ ```bash
44
+ export AGENTR_API_KEY="your_api_key_here"
45
+ ```
46
+
47
+ ### 2. Create a basic server
48
+
49
+ ```bash
50
+ from agentr.server import TestServer
51
+
52
+ # Define your applications list
53
+ apps_list = [
54
+ {
55
+ "name": "tavily",
56
+ "integration": {
57
+ "name": "tavily_api_key",
58
+ "type": "api_key",
59
+ "store": {
60
+ "type": "environment",
61
+ }
62
+ },
63
+ },
64
+ {
65
+ "name": "zenquotes",
66
+ "integration": None
67
+ },
68
+ {
69
+ "name": "github",
70
+ "integration": {
71
+ "name": "github",
72
+ "type": "agentr",
73
+ }
74
+ }
75
+ ]
76
+
77
+ # Create a server with these applications
78
+ server = TestServer(name="My Agent Server", description="A server for my agent apps", apps_list=apps_list)
79
+
80
+ # Run the server
81
+ if __name__ == "__main__":
82
+ server.run()
83
+ ```
84
+
85
+ ## 🧩 Available Applications
86
+ AgentR comes with several pre-built applications:
87
+
88
+ | Application | Description | Authentication Type |
89
+ |-------------|-------------|---------------------|
90
+ | GitHub | Star repositories and more | OAuth (AgentR) |
91
+ | Google Calendar | Retrieve calendar events | OAuth (AgentR) |
92
+ | Gmail | Send emails | OAuth (AgentR) |
93
+ | Reddit | Access Reddit data | OAuth (AgentR) |
94
+ | Resend | Send emails via Resend API | API Key |
95
+ | Tavily | Web search capabilities | API Key |
96
+ | ZenQuotes | Get inspirational quotes | None |
97
+
98
+ > **Note**: More applications are coming soon! Stay tuned for updates to our application catalog.
99
+
100
+ ## 🔐 Integration Types
101
+ AgentR supports two primary integration types:
102
+
103
+ ### 1. API Key Integration
104
+ For services that authenticate via API keys:
105
+ ```python
106
+ {
107
+ "name": "service_name",
108
+ "integration": {
109
+ "name": "service_api_key",
110
+ "type": "api_key",
111
+ "store": {
112
+ "type": "environment", # or "memory"
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ ### 2. OAuth Integration (via AgentR)
119
+ For services requiring OAuth flow:
120
+ ```python
121
+ {
122
+ "name": "service_name",
123
+ "integration": {
124
+ "name": "service_name",
125
+ "type": "agentr"
126
+ }
127
+ }
128
+ ```
129
+ When using OAuth integrations, users will be directed to authenticate with the service provider through a secure flow managed by AgentR.
130
+
131
+ ## 🤖 CLI Usage
132
+ AgentR includes a command-line interface for common operations:
133
+
134
+ ```bash
135
+ # Get version information
136
+ agentr version
137
+
138
+ # Generate API client from OpenAPI schema
139
+ agentr generate --schema path/to/openapi.yaml
140
+
141
+ # Run the test server
142
+ agentr run
143
+
144
+ # Install AgentR for specific applications
145
+ agentr install claude
146
+ ```
147
+
148
+ ## 📋 Requirements
149
+
150
+ - Python 3.11+
151
+ - Dependencies (automatically installed):
152
+ - loguru >= 0.7.3
153
+ - mcp >= 1.5.0
154
+ - pyyaml >= 6.0.2
155
+ - typer >= 0.15.2
156
+
157
+
158
+ ## 📝 License
159
+
160
+ This project is licensed under the MIT License.
agentr-0.1.5/README.md ADDED
@@ -0,0 +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,23 +1,23 @@
1
- [project]
2
- name = "agentr"
3
- version = "0.1.3"
4
- description = "Add your description here"
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.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"
@@ -0,0 +1,2 @@
1
+ def main():
2
+ print("hello")
@@ -1,57 +1,57 @@
1
- from abc import ABC, abstractmethod
2
- from agentr.integration import Integration
3
- import httpx
4
-
5
- class Application(ABC):
6
- """
7
- Application is collection of tools that can be used by an agent.
8
- """
9
- def __init__(self, name: str, **kwargs):
10
- self.name = name
11
-
12
- @abstractmethod
13
- def list_tools(self):
14
- pass
15
-
16
-
17
- class APIApplication(Application):
18
- """
19
- APIApplication is an application that uses an API to interact with the world.
20
- """
21
- def __init__(self, name: str, integration: Integration = None, **kwargs):
22
- super().__init__(name, **kwargs)
23
- self.integration = integration
24
-
25
- def _get_headers(self):
26
- return {}
27
-
28
- def _get(self, url, params=None):
29
- headers = self._get_headers()
30
- response = httpx.get(url, headers=headers, params=params)
31
- response.raise_for_status()
32
- return response
33
-
34
- def _post(self, url, data):
35
- headers = self._get_headers()
36
- response = httpx.post(url, headers=headers, json=data)
37
- response.raise_for_status()
38
- return response
39
-
40
- def _put(self, url, data):
41
- headers = self._get_headers()
42
- response = httpx.put(url, headers=headers, json=data)
43
- response.raise_for_status()
44
- return response
45
-
46
- def _delete(self, url):
47
- headers = self._get_headers()
48
- response = httpx.delete(url, headers=headers)
49
- response.raise_for_status()
50
- return response
51
-
52
- def validate(self):
53
- pass
54
-
55
- @abstractmethod
56
- def list_tools(self):
1
+ from abc import ABC, abstractmethod
2
+ from agentr.integration import Integration
3
+ import httpx
4
+
5
+ class Application(ABC):
6
+ """
7
+ Application is collection of tools that can be used by an agent.
8
+ """
9
+ def __init__(self, name: str, **kwargs):
10
+ self.name = name
11
+
12
+ @abstractmethod
13
+ def list_tools(self):
14
+ pass
15
+
16
+
17
+ class APIApplication(Application):
18
+ """
19
+ APIApplication is an application that uses an API to interact with the world.
20
+ """
21
+ def __init__(self, name: str, integration: Integration = None, **kwargs):
22
+ super().__init__(name, **kwargs)
23
+ self.integration = integration
24
+
25
+ def _get_headers(self):
26
+ return {}
27
+
28
+ def _get(self, url, params=None):
29
+ headers = self._get_headers()
30
+ response = httpx.get(url, headers=headers, params=params)
31
+ response.raise_for_status()
32
+ return response
33
+
34
+ def _post(self, url, data):
35
+ headers = self._get_headers()
36
+ response = httpx.post(url, headers=headers, json=data)
37
+ response.raise_for_status()
38
+ return response
39
+
40
+ def _put(self, url, data):
41
+ headers = self._get_headers()
42
+ response = httpx.put(url, headers=headers, json=data)
43
+ response.raise_for_status()
44
+ return response
45
+
46
+ def _delete(self, url):
47
+ headers = self._get_headers()
48
+ response = httpx.delete(url, headers=headers)
49
+ response.raise_for_status()
50
+ return response
51
+
52
+ def validate(self):
53
+ pass
54
+
55
+ @abstractmethod
56
+ def list_tools(self):
57
57
  pass
@@ -1,52 +1,56 @@
1
- from agentr.integration import Integration
2
- from agentr.application import APIApplication
3
- from loguru import logger
4
-
5
-
6
- class GithubApp(APIApplication):
7
- def __init__(self, integration: Integration) -> None:
8
- super().__init__(name="github", integration=integration)
9
-
10
- def _get_headers(self):
11
- if not self.integration:
12
- raise ValueError("Integration not configured")
13
- credentials = self.integration.get_credentials()
14
- if not credentials:
15
- logger.warning("No credentials found")
16
- return self.integration.authorize()
17
- if "headers" in credentials:
18
- return credentials["headers"]
19
- return {
20
- "Authorization": f"Bearer {credentials['access_token']}",
21
- "Accept": "application/vnd.github.v3+json"
22
- }
23
-
24
-
25
- def star_repository(self, repo_full_name: str) -> str:
26
- """Star a GitHub repository
27
-
28
- Args:
29
- repo_full_name: The full name of the repository (e.g. 'owner/repo')
30
-
31
- Returns:
32
-
33
- A confirmation message
34
- """
35
- try:
36
- url = f"https://api.github.com/user/starred/{repo_full_name}"
37
- response = self._put(url, data={})
38
-
39
- if response.status_code == 204:
40
- return f"Successfully starred repository {repo_full_name}"
41
- elif response.status_code == 404:
42
- return f"Repository {repo_full_name} not found"
43
- else:
44
- logger.error(response.text)
45
- return f"Error starring repository: {response.text}"
46
- except Exception as e:
47
- logger.error(e)
48
- return f"Error starring repository: {e}"
49
-
50
-
51
- def list_tools(self):
1
+ from agentr.integration import Integration
2
+ from agentr.application import APIApplication
3
+ from loguru import logger
4
+ from agentr.exceptions import NotAuthorizedError
5
+
6
+ class GithubApp(APIApplication):
7
+ def __init__(self, integration: Integration) -> None:
8
+ super().__init__(name="github", integration=integration)
9
+
10
+ def _get_headers(self):
11
+ if not self.integration:
12
+ raise ValueError("Integration not configured")
13
+ credentials = self.integration.get_credentials()
14
+ if not credentials:
15
+ logger.warning("No credentials found")
16
+ action = self.integration.authorize()
17
+ raise NotAuthorizedError(action)
18
+ if "headers" in credentials:
19
+ return credentials["headers"]
20
+ return {
21
+ "Authorization": f"Bearer {credentials['access_token']}",
22
+ "Accept": "application/vnd.github.v3+json"
23
+ }
24
+
25
+
26
+ def star_repository(self, repo_full_name: str) -> str:
27
+ """Star a GitHub repository
28
+
29
+ Args:
30
+ repo_full_name: The full name of the repository (e.g. 'owner/repo')
31
+
32
+ Returns:
33
+
34
+ A confirmation message
35
+ """
36
+ try:
37
+ url = f"https://api.github.com/user/starred/{repo_full_name}"
38
+ response = self._put(url, data={})
39
+
40
+ if response.status_code == 204:
41
+ return f"Successfully starred repository {repo_full_name}"
42
+ elif response.status_code == 404:
43
+ return f"Repository {repo_full_name} not found"
44
+ else:
45
+ logger.error(response.text)
46
+ return f"Error starring repository: {response.text}"
47
+ except NotAuthorizedError as e:
48
+ return e.message
49
+ except Exception as e:
50
+ logger.error(e)
51
+ raise e
52
+
53
+
54
+
55
+ def list_tools(self):
52
56
  return [self.star_repository]