everstack 0.1.0__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 (38) hide show
  1. everstack-0.1.0/.gitignore +90 -0
  2. everstack-0.1.0/PKG-INFO +52 -0
  3. everstack-0.1.0/PLAN.md +269 -0
  4. everstack-0.1.0/README.md +21 -0
  5. everstack-0.1.0/examples/agents_basic.py +26 -0
  6. everstack-0.1.0/examples/async_client.py +29 -0
  7. everstack-0.1.0/examples/chat_basic.py +22 -0
  8. everstack-0.1.0/examples/responses_api.py +32 -0
  9. everstack-0.1.0/examples/test_all.py +264 -0
  10. everstack-0.1.0/pyproject.toml +61 -0
  11. everstack-0.1.0/scripts/generate_models.py +195 -0
  12. everstack-0.1.0/src/everstack/__init__.py +122 -0
  13. everstack-0.1.0/src/everstack/_client.py +167 -0
  14. everstack-0.1.0/src/everstack/_errors.py +136 -0
  15. everstack-0.1.0/src/everstack/_transport.py +254 -0
  16. everstack-0.1.0/src/everstack/_types.py +305 -0
  17. everstack-0.1.0/src/everstack/_version.py +1 -0
  18. everstack-0.1.0/src/everstack/generated/__init__.py +1 -0
  19. everstack-0.1.0/src/everstack/generated/models.py +2851 -0
  20. everstack-0.1.0/src/everstack/py.typed +0 -0
  21. everstack-0.1.0/src/everstack/resources/__init__.py +1 -0
  22. everstack-0.1.0/src/everstack/resources/agents.py +489 -0
  23. everstack-0.1.0/src/everstack/resources/audio.py +156 -0
  24. everstack-0.1.0/src/everstack/resources/chat.py +160 -0
  25. everstack-0.1.0/src/everstack/resources/datasets.py +114 -0
  26. everstack-0.1.0/src/everstack/resources/embeddings.py +70 -0
  27. everstack-0.1.0/src/everstack/resources/evaluations.py +99 -0
  28. everstack-0.1.0/src/everstack/resources/images.py +120 -0
  29. everstack-0.1.0/src/everstack/resources/models.py +30 -0
  30. everstack-0.1.0/src/everstack/resources/moderations.py +53 -0
  31. everstack-0.1.0/src/everstack/resources/observability.py +105 -0
  32. everstack-0.1.0/src/everstack/resources/rerank.py +69 -0
  33. everstack-0.1.0/src/everstack/resources/responses.py +153 -0
  34. everstack-0.1.0/tests/__init__.py +0 -0
  35. everstack-0.1.0/tests/test_client.py +58 -0
  36. everstack-0.1.0/tests/test_errors.py +109 -0
  37. everstack-0.1.0/tests/test_transport.py +159 -0
  38. everstack-0.1.0/tests/test_types.py +138 -0
@@ -0,0 +1,90 @@
1
+ node_modules
2
+ .DS_Store
3
+ *.idea
4
+ dist
5
+ bin
6
+ bin/**
7
+ .air.toml
8
+
9
+ # Local environment variables
10
+ .env
11
+ .env.local
12
+ .env.development.local
13
+ .env.test.local
14
+ .env.production.local
15
+
16
+ # Binaries
17
+ cmd/midfusion/midfusion
18
+ **/statik/statik.go
19
+ /midfusion
20
+ /midfusionctl
21
+ /mf
22
+ /mfctl
23
+ /browser-streamer
24
+
25
+ # Generated files and build directories
26
+ tmp/
27
+ console/src/app/proto/generated/
28
+ **.pb.go
29
+ !pkg/grpc/protoc/v2/options.pb.go
30
+ **.proto.mock.go
31
+ **.pb.*.go
32
+ **.gen.go
33
+ !*key.proto
34
+ openapi/**
35
+ openapi/**/*.json
36
+ **/*/key.json
37
+ **/*-key.json
38
+ local_scripts/
39
+ /results/
40
+ /compare/
41
+ /results/**
42
+ /compare/**
43
+ /local_scripts/**
44
+
45
+ # gRPC artifacts
46
+ /.artifacts/*
47
+ !/.artifacts/midfusion
48
+
49
+
50
+ **certs
51
+
52
+ # frontend
53
+ .DS_Store
54
+ node_modules
55
+ .turbo
56
+ *.log
57
+ dist-ssr
58
+ *.local
59
+ .env
60
+ .cache
61
+ server/dist
62
+ public/dist
63
+ .next
64
+ out/
65
+ dist/
66
+ .next/
67
+ .turbo/
68
+ .env.local
69
+ .env.development.local
70
+ .env.test.local
71
+ .env.production.local
72
+ .env.development
73
+ .env.test
74
+ .env.production
75
+
76
+ # Catalog cache (runtime generated, but tracked for SDK codegen)
77
+ # data/catalog/
78
+
79
+ # Local config overrides (for dev)
80
+ cmd/config/local.yaml
81
+
82
+ .venv/
83
+ qdrant_storage
84
+
85
+ .terraform
86
+ *.tfstate*
87
+
88
+ # ewt
89
+ .env.worktree
90
+ .everstack/
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.4
2
+ Name: everstack
3
+ Version: 0.1.0
4
+ Summary: The official Python SDK for the Everstack AI platform
5
+ Project-URL: Homepage, https://everstack.ai
6
+ Project-URL: Documentation, https://docs.everstack.ai/sdks/python
7
+ Project-URL: Repository, https://github.com/everstacklabs/everstack-python
8
+ Author: Everstack Labs
9
+ License-Expression: MIT
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.9
21
+ Requires-Dist: httpx<1.0,>=0.25.0
22
+ Requires-Dist: pydantic<3.0,>=2.0.0
23
+ Requires-Dist: typing-extensions>=4.7.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.5; extra == 'dev'
26
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
27
+ Requires-Dist: pytest-httpx>=0.30; extra == 'dev'
28
+ Requires-Dist: pytest>=7.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.1; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # Everstack Python SDK
33
+
34
+ The official Python SDK for the [Everstack](https://everstack.ai) AI platform.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install everstack
40
+ ```
41
+
42
+ ## Quick Start
43
+
44
+ ```python
45
+ from everstack import Everstack
46
+
47
+ client = Everstack(api_key="your-api-key")
48
+ ```
49
+
50
+ ## Documentation
51
+
52
+ See the full documentation at [docs.everstack.ai/sdks/python](https://docs.everstack.ai/sdks/python).
@@ -0,0 +1,269 @@
1
+ # Everstack Python SDK — Implementation Plan
2
+
3
+ ## Overview
4
+
5
+ `everstack-python` — A Pythonic SDK mirroring the Node SDK's API surface, using gRPC/Connect for transport and providing both sync and async interfaces.
6
+
7
+ **Package name:** `everstack` (PyPI)
8
+ **Min Python:** 3.9+
9
+
10
+ ---
11
+
12
+ ## Project Structure
13
+
14
+ ```
15
+ everstack-python/
16
+ ├── src/
17
+ │ └── everstack/
18
+ │ ├── __init__.py # Public API exports, Everstack class
19
+ │ ├── _client.py # Everstack client (sync + async)
20
+ │ ├── _transport.py # gRPC/Connect transport setup
21
+ │ ├── _compat.py # OpenAI SDK compatibility helpers
22
+ │ ├── _errors.py # Error hierarchy
23
+ │ ├── _types.py # Shared type aliases, TypedDicts
24
+ │ ├── _version.py # Version string
25
+ │ ├── resources/
26
+ │ │ ├── __init__.py
27
+ │ │ ├── chat.py # Chat + Completions
28
+ │ │ ├── embeddings.py # Embeddings
29
+ │ │ ├── models.py # Model listing
30
+ │ │ ├── agents.py # Full agent lifecycle
31
+ │ │ ├── datasets.py # Datasets + Evaluations
32
+ │ │ ├── memory.py # Vector memory (REST-based)
33
+ │ │ ├── audio.py # Speech, Transcriptions, Translations
34
+ │ │ ├── images.py # Generation, Edit, Variation
35
+ │ │ ├── moderations.py # Content moderation
36
+ │ │ ├── rerank.py # Document reranking
37
+ │ │ ├── responses.py # Responses API (agentic)
38
+ │ │ └── observability.py # Metrics, sessions, users, outcomes
39
+ │ └── generated/
40
+ │ └── models.py # Auto-generated model catalog types
41
+ ├── tests/
42
+ │ ├── conftest.py
43
+ │ ├── test_chat.py
44
+ │ ├── test_agents.py
45
+ │ ├── test_datasets.py
46
+ │ └── ...
47
+ ├── examples/
48
+ │ ├── chat_basic.py
49
+ │ ├── chat_streaming.py
50
+ │ ├── agents_basic.py
51
+ │ ├── datasets_eval.py
52
+ │ ├── audio_tts.py
53
+ │ ├── images_generate.py
54
+ │ └── responses_agentic.py
55
+ ├── scripts/
56
+ │ └── generate_models.py # Model catalog codegen
57
+ ├── pyproject.toml # Build config (hatch/setuptools)
58
+ ├── README.md
59
+ └── py.typed # PEP 561 marker
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Dependencies
65
+
66
+ | Package | Purpose |
67
+ |---------|---------|
68
+ | `grpcio` + `grpcio-tools` | gRPC transport |
69
+ | `protobuf` | Proto message runtime |
70
+ | `httpx` | Async HTTP (memory REST, fallback) |
71
+ | `pydantic` >= 2.0 | Response models, validation |
72
+ | `typing-extensions` | Backport typing features |
73
+
74
+ **Optional:**
75
+ - `grpcio-status` — rich gRPC error details
76
+ - `openai` — compatibility layer re-export
77
+
78
+ **Dev:**
79
+ - `pytest` + `pytest-asyncio` — testing
80
+ - `mypy` — type checking
81
+ - `ruff` — linting/formatting
82
+ - `hatch` — build backend
83
+
84
+ ---
85
+
86
+ ## Proto Codegen Strategy
87
+
88
+ Use `grpcio-tools` (or `buf generate` with `protoc-gen-python-grpc`) to generate Python stubs from the same `proto/` definitions.
89
+
90
+ ```bash
91
+ # In monorepo root
92
+ buf generate --template buf.gen.python.yaml
93
+ ```
94
+
95
+ Output into `src/everstack/_proto/` (private, not re-exported). The SDK resources wrap these with Pythonic interfaces.
96
+
97
+ ---
98
+
99
+ ## API Design
100
+
101
+ ### Client Instantiation
102
+
103
+ ```python
104
+ from everstack import Everstack
105
+
106
+ # Sync client (default)
107
+ client = Everstack(api_key="pk_...")
108
+
109
+ # Async client
110
+ client = Everstack(api_key="pk_...", async_mode=True)
111
+ # or
112
+ from everstack import AsyncEverstack
113
+ client = AsyncEverstack(api_key="pk_...")
114
+ ```
115
+
116
+ ### Resource Pattern
117
+
118
+ ```python
119
+ # Chat completions
120
+ response = client.chat.completions.create(
121
+ model="@openai/gpt-4o",
122
+ messages=[{"role": "user", "content": "Hello!"}],
123
+ )
124
+ print(response.choices[0].message.content)
125
+
126
+ # Streaming
127
+ stream = client.chat.completions.create(
128
+ model="@openai/gpt-4o",
129
+ messages=[{"role": "user", "content": "Hello!"}],
130
+ stream=True,
131
+ )
132
+ for chunk in stream:
133
+ print(chunk.choices[0].delta.content, end="")
134
+
135
+ # Async streaming
136
+ async for chunk in await async_client.chat.completions.create(
137
+ model="@openai/gpt-4o",
138
+ messages=[...],
139
+ stream=True,
140
+ ):
141
+ print(chunk.choices[0].delta.content, end="")
142
+ ```
143
+
144
+ ### Full Resource Surface
145
+
146
+ ```python
147
+ client.chat.completions.create(...)
148
+
149
+ client.embeddings.create(...)
150
+
151
+ client.models.list()
152
+
153
+ client.audio.speech.create(...)
154
+ client.audio.transcriptions.create(...)
155
+ client.audio.translations.create(...)
156
+
157
+ client.images.generate(...)
158
+ client.images.edit(...)
159
+ client.images.create_variation(...)
160
+
161
+ client.moderations.create(...)
162
+
163
+ client.rerank.create(...)
164
+
165
+ client.responses.create(...)
166
+ client.responses.get(response_id)
167
+ client.responses.cancel(response_id)
168
+ client.responses.delete(response_id)
169
+ client.responses.list(...)
170
+
171
+ client.agents.create(...)
172
+ client.agents.get(...)
173
+ client.agents.list(...)
174
+ client.agents.update(...)
175
+ client.agents.delete(...)
176
+ client.agents.sessions.create(...)
177
+ client.agents.sessions.run_turn(...)
178
+ client.agents.sessions.run_turn_stream(...)
179
+ client.agents.lifecycle.provision(...)
180
+ client.agents.lifecycle.sleep(...)
181
+ client.agents.lifecycle.wake(...)
182
+ # ... etc (mirrors Node SDK)
183
+
184
+ client.datasets.create(...)
185
+ client.datasets.items.create_batch(...)
186
+ client.evaluations.runs.create(...)
187
+ client.evaluations.schedules.create(...)
188
+
189
+ client.observability.metrics.get_dashboard(...)
190
+ client.observability.sessions.list(...)
191
+ client.observability.outcomes.get_dashboard(...)
192
+
193
+ client.memory.collections.create(...)
194
+ client.memory.collections.query(...)
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Type Safety
200
+
201
+ - All request params are `TypedDict` or `@dataclass` with full type annotations
202
+ - All responses are Pydantic `BaseModel` subclasses (frozen, validated)
203
+ - Model IDs are `Literal` unions for autocomplete
204
+ - `overload` decorators for stream vs non-stream return types
205
+ - Full `py.typed` PEP 561 compliance
206
+
207
+ ---
208
+
209
+ ## Error Hierarchy
210
+
211
+ ```python
212
+ EverstackError
213
+ ├── APIError(status_code, code, message)
214
+ │ ├── AuthenticationError # 401
215
+ │ ├── PermissionDeniedError # 403
216
+ │ ├── NotFoundError # 404
217
+ │ ├── RateLimitError # 429 (retry_after property)
218
+ │ ├── InternalServerError # 500
219
+ │ └── ServiceUnavailableError # 503
220
+ ├── TimeoutError
221
+ ├── ConnectionError
222
+ └── InvalidModelError
223
+ ```
224
+
225
+ ---
226
+
227
+ ## Streaming
228
+
229
+ - Sync: return a generator/iterator wrapping gRPC stream
230
+ - Async: return an async generator/iterator
231
+ - Both support context manager (`with` / `async with`) for cleanup
232
+ - Response accumulator helper: `stream.get_final_response()`
233
+
234
+ ---
235
+
236
+ ## OpenAI Compatibility
237
+
238
+ ```python
239
+ from everstack.compat import create_openai_config
240
+ import openai
241
+
242
+ config = create_openai_config(api_key="pk_...", provider="@openai")
243
+ openai_client = openai.OpenAI(**config)
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Build & Publish
249
+
250
+ - `pyproject.toml` with `hatch` backend
251
+ - CI: `ruff check`, `mypy --strict`, `pytest`
252
+ - Publish to PyPI as `everstack`
253
+
254
+ ---
255
+
256
+ ## Implementation Order
257
+
258
+ 1. Transport layer + error handling
259
+ 2. Chat completions (sync + async, streaming)
260
+ 3. Embeddings + Models
261
+ 4. Audio, Images, Moderations, Rerank
262
+ 5. Responses API
263
+ 6. Agents (largest resource)
264
+ 7. Datasets + Evaluations
265
+ 8. Observability
266
+ 9. Memory (REST-based)
267
+ 10. Model catalog codegen
268
+ 11. OpenAI compat layer
269
+ 12. Examples + tests
@@ -0,0 +1,21 @@
1
+ # Everstack Python SDK
2
+
3
+ The official Python SDK for the [Everstack](https://everstack.ai) AI platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install everstack
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from everstack import Everstack
15
+
16
+ client = Everstack(api_key="your-api-key")
17
+ ```
18
+
19
+ ## Documentation
20
+
21
+ See the full documentation at [docs.everstack.ai/sdks/python](https://docs.everstack.ai/sdks/python).
@@ -0,0 +1,26 @@
1
+ """Agents resource example."""
2
+
3
+ from everstack import Everstack
4
+
5
+ client = Everstack(api_key="pk_...")
6
+
7
+ # List agents
8
+ agents = client.agents.list()
9
+ for agent in agents.get("agents", []):
10
+ print(f" {agent['name']} ({agent['id']})")
11
+
12
+ # Create a session
13
+ session = client.agents.sessions.create(agent_id="agent_abc123")
14
+ print(f"Session: {session['id']}")
15
+
16
+ # Send a message
17
+ response = client.agents.sessions.send_message(
18
+ session_id=session["id"],
19
+ message="Hello, agent!",
20
+ )
21
+ print(f"Response: {response}")
22
+
23
+ # List memories
24
+ memories = client.agents.memories.list(agent_id="agent_abc123")
25
+ for mem in memories.get("memories", []):
26
+ print(f" Memory: {mem['content'][:80]}...")
@@ -0,0 +1,29 @@
1
+ """Async client example."""
2
+
3
+ import asyncio
4
+
5
+ from everstack import AsyncEverstack
6
+
7
+
8
+ async def main() -> None:
9
+ async with AsyncEverstack(api_key="pk_...") as client:
10
+ # Chat completion
11
+ response = await client.chat.completions.create(
12
+ model="@openai/gpt-4o",
13
+ messages=[{"role": "user", "content": "Hello!"}],
14
+ )
15
+ print(response.choices[0].message.content)
16
+
17
+ # Embeddings
18
+ embeddings = await client.embeddings.create(
19
+ model="@openai/text-embedding-3-small",
20
+ input=["Hello world", "How are you?"],
21
+ )
22
+ print(f"Got {len(embeddings['data'])} embeddings")
23
+
24
+ # List models
25
+ models = await client.models.list()
26
+ print(f"Available models: {len(models['data'])}")
27
+
28
+
29
+ asyncio.run(main())
@@ -0,0 +1,22 @@
1
+ """Basic chat completion example."""
2
+
3
+ from everstack import Everstack
4
+
5
+ client = Everstack(api_key="pk_...")
6
+
7
+ # Simple chat completion
8
+ response = client.chat.completions.create(
9
+ model="@openai/gpt-4o",
10
+ messages=[{"role": "user", "content": "What is the capital of France?"}],
11
+ )
12
+ print(response.choices[0].message.content)
13
+
14
+ # Streaming
15
+ for chunk in client.chat.completions.create(
16
+ model="@anthropic/claude-3-5-sonnet-20241022",
17
+ messages=[{"role": "user", "content": "Tell me a short joke"}],
18
+ stream=True,
19
+ ):
20
+ if chunk.choices and chunk.choices[0].delta.content:
21
+ print(chunk.choices[0].delta.content, end="", flush=True)
22
+ print()
@@ -0,0 +1,32 @@
1
+ """Responses API example — agentic orchestration."""
2
+
3
+ from everstack import Everstack
4
+
5
+ client = Everstack(api_key="pk_...")
6
+
7
+ # Non-streaming response
8
+ response = client.responses.create(
9
+ model="@openai/gpt-4o",
10
+ input=[{"role": "user", "content": "Summarize the latest AI news"}],
11
+ tools=[
12
+ {
13
+ "type": "function",
14
+ "function": {
15
+ "name": "web_search",
16
+ "description": "Search the web",
17
+ "parameters": {"type": "object", "properties": {"query": {"type": "string"}}},
18
+ },
19
+ }
20
+ ],
21
+ )
22
+ print(f"Status: {response.status}")
23
+ for item in response.output:
24
+ print(f" [{item.type}] {item.content}")
25
+
26
+ # Streaming response
27
+ for event in client.responses.create(
28
+ model="@anthropic/claude-3-5-sonnet-20241022",
29
+ input=[{"role": "user", "content": "Hello!"}],
30
+ stream=True,
31
+ ):
32
+ print(event)