hikigai-appsdk 0.0.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.
@@ -0,0 +1,85 @@
1
+ # Dependencies
2
+ node_modules/
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+ .Python
7
+ *.so
8
+ .eggs/
9
+ *.egg-info/
10
+ .venv/
11
+ venv/
12
+ # ENV/
13
+
14
+ # IDE
15
+ .idea/
16
+ .vscode/
17
+ *.swp
18
+ *.swo
19
+ .DS_Store
20
+
21
+ # Build outputs
22
+ .next/
23
+ out/
24
+ dist/
25
+ build/
26
+ *.egg
27
+
28
+ # Environment files
29
+ **/.env*
30
+ !**/.env.example
31
+ SONA/sona_venv/
32
+
33
+ # Credentials and secrets
34
+ # *-key.json
35
+ # gcp-key.json
36
+ /backend/gcp-key.json
37
+
38
+ *.pem
39
+ !backend/global-bundle.pem
40
+ *.key
41
+
42
+ # Database files
43
+ *.sqlite
44
+ *.sqlite3
45
+ *.db
46
+
47
+ # Logs
48
+ *.log
49
+ logs/
50
+ npm-debug.log*
51
+ yarn-debug.log*
52
+ yarn-error.log*
53
+
54
+ # Testing
55
+ .coverage
56
+ htmlcov/
57
+ .pytest_cache/
58
+ .tox/
59
+ .nox/
60
+ coverage.xml
61
+ *.cover
62
+
63
+ # Docker
64
+ .docker/
65
+ docker-compose.yml
66
+
67
+ # Terraform
68
+ *.tfstate
69
+ *.tfstate.*
70
+ .terraform/
71
+ *.tfvars
72
+
73
+ # Misc
74
+ *.bak
75
+ *.tmp
76
+ .cache/
77
+ .claude/
78
+ AWSCLIV2.pkg
79
+
80
+ # Claude Flow AgentDB (MCP runtime artifacts)
81
+ agentdb.rvf
82
+ agentdb.rvf.lock
83
+
84
+ # TypeScript build cache
85
+ tsconfig.tsbuildinfo
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hikigai
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.
@@ -0,0 +1,215 @@
1
+ Metadata-Version: 2.4
2
+ Name: hikigai-appsdk
3
+ Version: 0.0.9
4
+ Summary: Official Python SDK for integrating and invoking HIPAA-compliant AI agents from any application on the Hikigai healthcare platform. Provides session management, streaming invocation, BYOK model keys, MCP connector credentials, and real-time agent response handling for App Developers.
5
+ Project-URL: Homepage, https://hikigai.ai
6
+ Author-email: Sai Daya Shankar <sshankar@hikigai.ai>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 Hikigai
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+ License-File: LICENSE
29
+ Keywords: agents,ai,hikigai,invocation,llm
30
+ Classifier: Development Status :: 3 - Alpha
31
+ Classifier: Intended Audience :: Developers
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
38
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
39
+ Requires-Python: >=3.10
40
+ Requires-Dist: hikigai-core<0.2.0,>=0.1.0
41
+ Requires-Dist: pydantic>=2.0.0
42
+ Provides-Extra: dev
43
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
44
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
45
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
46
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
47
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # hikigai-appsdk
51
+
52
+ Python SDK for invoking AI agents in your applications.
53
+
54
+ ## Installation
55
+
56
+ > **Note:** The Hikigai SDKs are currently published to [Test PyPI](https://test.pypi.org) while in early access.
57
+ > Do **not** run the SDK from the repository source directly — the `hikigai.core` namespace package
58
+ > must be installed to resolve correctly. Always install via the commands below.
59
+
60
+ ```bash
61
+ # Using pip
62
+ pip install \
63
+ --index-url https://test.pypi.org/simple/ \
64
+ --extra-index-url https://pypi.org/simple/ \
65
+ hikigai-appsdk==0.0.1
66
+ ```
67
+
68
+ This will automatically install `hikigai-core` (the shared namespace dependency) alongside
69
+ `hikigai-appsdk`.
70
+
71
+ Once released on the main PyPI index, installation will simplify to:
72
+
73
+ ```bash
74
+ # Future release (main PyPI)
75
+ pip install hikigai-appsdk
76
+ ```
77
+
78
+ ## Quick Start
79
+
80
+ ### Using the SDK (Recommended)
81
+
82
+ ```python
83
+ from hikigai.appsdk import AppClient
84
+
85
+ # Initialize client
86
+ client = AppClient(
87
+ api_key="your-api-key",
88
+ project_id="your-project-id"
89
+ )
90
+
91
+ # Get an agent
92
+ agent = client.agent("medical-coder")
93
+
94
+ # Invoke the agent
95
+ response = agent.invoke("Patient presents with fever and cough...")
96
+ print(response.content)
97
+
98
+ # Stream responses
99
+ for chunk in agent.stream("Tell me a story"):
100
+ print(chunk, end="")
101
+
102
+ # Session-based conversations
103
+ session_agent = agent.with_session("user-123")
104
+ session_agent.invoke("What is diabetes?")
105
+ session_agent.invoke("How is it treated?") # Remembers context
106
+ ```
107
+
108
+ ### Using Direct API (Advanced)
109
+
110
+ For custom integrations or when you need direct HTTP control:
111
+
112
+ **Step 1: Exchange API Key for Session Token**
113
+
114
+ ```bash
115
+ curl --location --request POST 'http://localhost:8000/api/v1/auth/exchange' \
116
+ --header 'X-API-Key: your_api_key_here' \
117
+ --header 'Content-Type: application/json'
118
+ ```
119
+
120
+ **Step 2: Invoke Agent via API**
121
+
122
+ ```python
123
+ import requests
124
+ import os
125
+ from datetime import datetime, timedelta
126
+
127
+ class HikigaiAPIClient:
128
+ def __init__(self, api_key: str, base_url: str = "http://localhost:8000"):
129
+ self.api_key = api_key
130
+ self.base_url = base_url
131
+ self.access_token = None
132
+ self.token_expiry = None
133
+
134
+ def exchange_api_key(self):
135
+ """Exchange API Key for session token."""
136
+ headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
137
+ response = requests.post(
138
+ f"{self.base_url}/api/v1/auth/exchange",
139
+ headers=headers
140
+ )
141
+ response.raise_for_status()
142
+ data = response.json()
143
+
144
+ self.access_token = data["access_token"]
145
+ self.token_expiry = datetime.utcnow() + timedelta(seconds=data["expires_in"] - 300)
146
+ return data
147
+
148
+ def ensure_token_valid(self):
149
+ """Refresh token if needed."""
150
+ if not self.access_token or datetime.utcnow() >= self.token_expiry:
151
+ self.exchange_api_key()
152
+
153
+ def invoke_agent(self, agent_id: str, message: str, session_id: str = None) -> dict:
154
+ """Invoke an agent via API."""
155
+ self.ensure_token_valid()
156
+ headers = {
157
+ "Authorization": f"Bearer {self.access_token}",
158
+ "Content-Type": "application/json"
159
+ }
160
+ payload = {
161
+ "message": message,
162
+ "stream": False,
163
+ }
164
+ if session_id:
165
+ payload["session_id"] = session_id
166
+
167
+ response = requests.post(
168
+ f"{self.base_url}/api/v1/agents/{agent_id}/invoke",
169
+ headers=headers,
170
+ json=payload
171
+ )
172
+ response.raise_for_status()
173
+ return response.json()
174
+
175
+ # Usage with context manager
176
+ class HikigaiAPIClientContext:
177
+ def __init__(self, api_key: str):
178
+ self.client = HikigaiAPIClient(api_key)
179
+
180
+ def __enter__(self):
181
+ self.client.exchange_api_key()
182
+ return self.client
183
+
184
+ def __exit__(self, exc_type, exc_val, exc_tb):
185
+ pass
186
+
187
+ # Invoke agent
188
+ with HikigaiAPIClientContext(api_key=os.environ["HIKIGAI_API_KEY"]) as client:
189
+ result = client.invoke_agent(
190
+ agent_id="medical-coder",
191
+ message="Patient presents with fever and cough...",
192
+ session_id="user-123"
193
+ )
194
+ print(result["content"])
195
+ ```
196
+
197
+ For complete API documentation, see the [Python AppSDK Docs](../docs/sdk/appsdk.md#direct-api-methods).
198
+
199
+ ## Features
200
+
201
+ - 🚀 **Simple Invocation**: Call agents with a single method
202
+ - 📡 **Streaming**: Real-time streaming responses
203
+ - 💬 **Sessions**: Multi-turn conversations with context
204
+ - ⚡ **Async Support**: Built-in async/await support (coming soon)
205
+ - 🔍 **Agent Discovery**: List and search available agents
206
+ - 📊 **Metadata**: Access performance metrics and status
207
+
208
+ ## Documentation
209
+
210
+ Full documentation: https://docs.hikigai.com/appsdk
211
+
212
+ ## License
213
+
214
+ MIT
215
+
@@ -0,0 +1,166 @@
1
+ # hikigai-appsdk
2
+
3
+ Python SDK for invoking AI agents in your applications.
4
+
5
+ ## Installation
6
+
7
+ > **Note:** The Hikigai SDKs are currently published to [Test PyPI](https://test.pypi.org) while in early access.
8
+ > Do **not** run the SDK from the repository source directly — the `hikigai.core` namespace package
9
+ > must be installed to resolve correctly. Always install via the commands below.
10
+
11
+ ```bash
12
+ # Using pip
13
+ pip install \
14
+ --index-url https://test.pypi.org/simple/ \
15
+ --extra-index-url https://pypi.org/simple/ \
16
+ hikigai-appsdk==0.0.1
17
+ ```
18
+
19
+ This will automatically install `hikigai-core` (the shared namespace dependency) alongside
20
+ `hikigai-appsdk`.
21
+
22
+ Once released on the main PyPI index, installation will simplify to:
23
+
24
+ ```bash
25
+ # Future release (main PyPI)
26
+ pip install hikigai-appsdk
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ### Using the SDK (Recommended)
32
+
33
+ ```python
34
+ from hikigai.appsdk import AppClient
35
+
36
+ # Initialize client
37
+ client = AppClient(
38
+ api_key="your-api-key",
39
+ project_id="your-project-id"
40
+ )
41
+
42
+ # Get an agent
43
+ agent = client.agent("medical-coder")
44
+
45
+ # Invoke the agent
46
+ response = agent.invoke("Patient presents with fever and cough...")
47
+ print(response.content)
48
+
49
+ # Stream responses
50
+ for chunk in agent.stream("Tell me a story"):
51
+ print(chunk, end="")
52
+
53
+ # Session-based conversations
54
+ session_agent = agent.with_session("user-123")
55
+ session_agent.invoke("What is diabetes?")
56
+ session_agent.invoke("How is it treated?") # Remembers context
57
+ ```
58
+
59
+ ### Using Direct API (Advanced)
60
+
61
+ For custom integrations or when you need direct HTTP control:
62
+
63
+ **Step 1: Exchange API Key for Session Token**
64
+
65
+ ```bash
66
+ curl --location --request POST 'http://localhost:8000/api/v1/auth/exchange' \
67
+ --header 'X-API-Key: your_api_key_here' \
68
+ --header 'Content-Type: application/json'
69
+ ```
70
+
71
+ **Step 2: Invoke Agent via API**
72
+
73
+ ```python
74
+ import requests
75
+ import os
76
+ from datetime import datetime, timedelta
77
+
78
+ class HikigaiAPIClient:
79
+ def __init__(self, api_key: str, base_url: str = "http://localhost:8000"):
80
+ self.api_key = api_key
81
+ self.base_url = base_url
82
+ self.access_token = None
83
+ self.token_expiry = None
84
+
85
+ def exchange_api_key(self):
86
+ """Exchange API Key for session token."""
87
+ headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
88
+ response = requests.post(
89
+ f"{self.base_url}/api/v1/auth/exchange",
90
+ headers=headers
91
+ )
92
+ response.raise_for_status()
93
+ data = response.json()
94
+
95
+ self.access_token = data["access_token"]
96
+ self.token_expiry = datetime.utcnow() + timedelta(seconds=data["expires_in"] - 300)
97
+ return data
98
+
99
+ def ensure_token_valid(self):
100
+ """Refresh token if needed."""
101
+ if not self.access_token or datetime.utcnow() >= self.token_expiry:
102
+ self.exchange_api_key()
103
+
104
+ def invoke_agent(self, agent_id: str, message: str, session_id: str = None) -> dict:
105
+ """Invoke an agent via API."""
106
+ self.ensure_token_valid()
107
+ headers = {
108
+ "Authorization": f"Bearer {self.access_token}",
109
+ "Content-Type": "application/json"
110
+ }
111
+ payload = {
112
+ "message": message,
113
+ "stream": False,
114
+ }
115
+ if session_id:
116
+ payload["session_id"] = session_id
117
+
118
+ response = requests.post(
119
+ f"{self.base_url}/api/v1/agents/{agent_id}/invoke",
120
+ headers=headers,
121
+ json=payload
122
+ )
123
+ response.raise_for_status()
124
+ return response.json()
125
+
126
+ # Usage with context manager
127
+ class HikigaiAPIClientContext:
128
+ def __init__(self, api_key: str):
129
+ self.client = HikigaiAPIClient(api_key)
130
+
131
+ def __enter__(self):
132
+ self.client.exchange_api_key()
133
+ return self.client
134
+
135
+ def __exit__(self, exc_type, exc_val, exc_tb):
136
+ pass
137
+
138
+ # Invoke agent
139
+ with HikigaiAPIClientContext(api_key=os.environ["HIKIGAI_API_KEY"]) as client:
140
+ result = client.invoke_agent(
141
+ agent_id="medical-coder",
142
+ message="Patient presents with fever and cough...",
143
+ session_id="user-123"
144
+ )
145
+ print(result["content"])
146
+ ```
147
+
148
+ For complete API documentation, see the [Python AppSDK Docs](../docs/sdk/appsdk.md#direct-api-methods).
149
+
150
+ ## Features
151
+
152
+ - 🚀 **Simple Invocation**: Call agents with a single method
153
+ - 📡 **Streaming**: Real-time streaming responses
154
+ - 💬 **Sessions**: Multi-turn conversations with context
155
+ - ⚡ **Async Support**: Built-in async/await support (coming soon)
156
+ - 🔍 **Agent Discovery**: List and search available agents
157
+ - 📊 **Metadata**: Access performance metrics and status
158
+
159
+ ## Documentation
160
+
161
+ Full documentation: https://docs.hikigai.com/appsdk
162
+
163
+ ## License
164
+
165
+ MIT
166
+
@@ -0,0 +1,49 @@
1
+ """
2
+ Example: Invoke agents with AppSDK
3
+ """
4
+
5
+ import os
6
+ from hikigai.appsdk import AppClient
7
+
8
+ # Initialize client
9
+ client = AppClient(
10
+ api_key=os.environ["HIKIGAI_API_KEY"],
11
+ project_id=os.environ["HIKIGAI_PROJECT_ID"],
12
+ )
13
+
14
+ # Get an agent
15
+ agent = client.agent("medical-coder")
16
+
17
+ print(f"📡 Invoking agent: {agent.name}")
18
+
19
+ # Simple invocation
20
+ clinical_note = """
21
+ Patient: John Doe, Age 45
22
+ Chief Complaint: Persistent cough and fever for 3 days
23
+ Vital Signs: Temp 101.2°F, BP 130/80, HR 88
24
+ Diagnosis: Acute bronchitis
25
+ Plan: Prescribed antibiotics, rest, fluids
26
+ """
27
+
28
+ response = agent.invoke(clinical_note)
29
+
30
+ print("\n✅ Response received:")
31
+ print(f" Content: {response.content}")
32
+ print(f" Latency: {response.latency_ms}ms")
33
+ print(f" Tokens: {response.tokens_used}")
34
+
35
+ # Streaming example
36
+ print("\n📡 Streaming response:")
37
+ for chunk in agent.stream("Explain the difference between ICD-10 and CPT codes"):
38
+ print(chunk, end="", flush=True)
39
+ print()
40
+
41
+ # Session-based conversation
42
+ print("\n💬 Session-based conversation:")
43
+ session_agent = agent.with_session("user-123")
44
+
45
+ response1 = session_agent.invoke("What is diabetes?")
46
+ print(f"Q1: {response1.content[:100]}...")
47
+
48
+ response2 = session_agent.invoke("How is it treated?") # Remembers context
49
+ print(f"Q2: {response2.content[:100]}...")
@@ -0,0 +1,40 @@
1
+ import os
2
+
3
+ def main():
4
+ base_dir = r"c:\Users\riyan\Desktop\hikigai-platform\AppSDK"
5
+ appsdk_dir = os.path.join(base_dir, "hikigai", "appsdk")
6
+
7
+ files_to_concat = [
8
+ os.path.join(appsdk_dir, "__init__.py"),
9
+ os.path.join(appsdk_dir, "client.py"),
10
+ os.path.join(appsdk_dir, "models", "agent.py"),
11
+ os.path.join(appsdk_dir, "models", "response.py"),
12
+ os.path.join(appsdk_dir, "sona.py")
13
+ ]
14
+
15
+ output_lines = []
16
+
17
+ for fpath in files_to_concat:
18
+ try:
19
+ with open(fpath, "r", encoding="utf-8") as f:
20
+ content = f.read()
21
+ # Get relative path for cleaner headers
22
+ rel_path = os.path.relpath(fpath, base_dir)
23
+ # Ensure backslashes are converted to forward slashes for cross-platform readability
24
+ rel_path = rel_path.replace("\\", "/")
25
+
26
+ header = f"\n\n{'='*80}\nFile: {rel_path}\n{'='*80}\n\n"
27
+ output_lines.append(header + content)
28
+ except Exception as e:
29
+ print(f"Error reading {fpath}: {e}")
30
+
31
+ out_path = os.path.join(base_dir, "llms-full.txt")
32
+ with open(out_path, "w", encoding="utf-8") as f:
33
+ # Avoid leading newlines on the first file
34
+ full_content = "".join(output_lines).strip()
35
+ f.write(full_content + "\n")
36
+
37
+ print(f"Successfully generated {out_path} with {len(full_content)} characters")
38
+
39
+ if __name__ == "__main__":
40
+ main()
@@ -0,0 +1,2 @@
1
+ # Hikigai namespace package
2
+ __path__ = __import__('pkgutil').extend_path(__path__, __name__)
@@ -0,0 +1,43 @@
1
+ """
2
+ hikigai-appsdk: Python SDK for invoking AI agents.
3
+
4
+ Invoke deployed agents in your applications.
5
+ """
6
+
7
+ __version__ = "0.0.6"
8
+
9
+ from hikigai.appsdk.client import AppClient
10
+ from hikigai.appsdk.models import (
11
+ RuntimeAgent,
12
+ InvokeResponse,
13
+ StreamChunk,
14
+ )
15
+ from hikigai.appsdk.streaming.session import StreamSession
16
+
17
+ # Re-export common exceptions from core
18
+ from hikigai.core.exceptions import (
19
+ HikigaiError,
20
+ AuthenticationError,
21
+ RateLimitError,
22
+ AgentNotFoundError,
23
+ InvocationError,
24
+ ConfigurationError,
25
+ )
26
+
27
+ __all__ = [
28
+ "__version__",
29
+ # Client
30
+ "AppClient",
31
+ # Models
32
+ "RuntimeAgent",
33
+ "InvokeResponse",
34
+ "StreamChunk",
35
+ "StreamSession",
36
+ # Exceptions
37
+ "HikigaiError",
38
+ "AuthenticationError",
39
+ "RateLimitError",
40
+ "AgentNotFoundError",
41
+ "InvocationError",
42
+ "ConfigurationError",
43
+ ]