cortex-agent-sdk 0.0.1__tar.gz → 0.0.2__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 (42) hide show
  1. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/PKG-INFO +31 -19
  2. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/README.md +26 -16
  3. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/pyproject.toml +6 -2
  4. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/gateway.py +6 -7
  5. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/openai/engine.py +5 -6
  6. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/.gitignore +0 -0
  7. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/LICENSE +0 -0
  8. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/__init__.py +0 -0
  9. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/agent.py +0 -0
  10. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/engine.py +0 -0
  11. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/errores/__init__.py +0 -0
  12. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/errores/catalogo.py +0 -0
  13. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/errores/excepcion.py +0 -0
  14. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/google/__init__.py +0 -0
  15. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/history/__init__.py +0 -0
  16. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/history/models.py +0 -0
  17. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/history/pipeline.py +0 -0
  18. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/history/transform.py +0 -0
  19. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/hooks.py +0 -0
  20. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/immutable.py +0 -0
  21. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/lifecycle.py +0 -0
  22. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/openai/__init__.py +0 -0
  23. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/openai/options.py +0 -0
  24. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/postgres/__init__.py +0 -0
  25. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/postgres/store.py +0 -0
  26. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/py.typed +0 -0
  27. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/redis/__init__.py +0 -0
  28. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/redis/scripts.py +0 -0
  29. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/redis/store.py +0 -0
  30. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/results.py +0 -0
  31. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/runtime.py +0 -0
  32. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/sessions/__init__.py +0 -0
  33. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/sessions/codec.py +0 -0
  34. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/sessions/lease.py +0 -0
  35. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/sessions/memory.py +0 -0
  36. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/sessions/models.py +0 -0
  37. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/sessions/store.py +0 -0
  38. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/tools/__init__.py +0 -0
  39. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/tools/contracts.py +0 -0
  40. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/tools/decorators.py +0 -0
  41. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/tools/execution.py +0 -0
  42. {cortex_agent_sdk-0.0.1 → cortex_agent_sdk-0.0.2}/src/cortex_agent_sdk/tools/models.py +0 -0
@@ -1,7 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cortex-agent-sdk
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: SDK async y multiproveedor para construir agentes con control explícito
5
+ Project-URL: Repository, https://github.com/epok200/cortex_agent_sdk
6
+ Project-URL: Issues, https://github.com/epok200/cortex_agent_sdk/issues
5
7
  Author: EPOK
6
8
  License-Expression: Apache-2.0
7
9
  License-File: LICENSE
@@ -20,14 +22,14 @@ Provides-Extra: all
20
22
  Requires-Dist: asyncpg>=0.31.0; extra == 'all'
21
23
  Requires-Dist: openai<3,>=2.52; extra == 'all'
22
24
  Requires-Dist: redis>=8.1.0; extra == 'all'
25
+ Provides-Extra: gateway
26
+ Requires-Dist: openai<3,>=2.52; extra == 'gateway'
23
27
  Provides-Extra: openai
24
28
  Requires-Dist: openai<3,>=2.52; extra == 'openai'
25
29
  Provides-Extra: postgres
26
30
  Requires-Dist: asyncpg>=0.31.0; extra == 'postgres'
27
31
  Provides-Extra: redis
28
32
  Requires-Dist: redis>=8.1.0; extra == 'redis'
29
- Provides-Extra: talos
30
- Requires-Dist: openai<3,>=2.52; extra == 'talos'
31
33
  Description-Content-Type: text/markdown
32
34
 
33
35
  # Cortex Agent SDK
@@ -60,7 +62,7 @@ El core instala únicamente Pydantic y JSON Schema. Los providers y transportes
60
62
  extras opcionales:
61
63
 
62
64
  - `openai`: engine de OpenAI Responses.
63
- - `talos`: conexión de OpenAI mediante Talos.
65
+ - `gateway`: conexión mediante un endpoint compatible con OpenAI Responses.
64
66
  - `redis`: sesiones persistentes en Redis.
65
67
  - `postgres`: sesiones persistentes en PostgreSQL.
66
68
  - `all`: todas las integraciones disponibles.
@@ -86,6 +88,24 @@ async def main() -> None:
86
88
  asyncio.run(main())
87
89
  ```
88
90
 
91
+ ## Gateway compatible
92
+
93
+ `OpenAIEngine` también acepta un endpoint que conserve el protocolo de OpenAI Responses:
94
+
95
+ ```python
96
+ import os
97
+
98
+ from cortex_agent_sdk.gateway import OpenAICompatibleGateway
99
+ from cortex_agent_sdk.openai import OpenAIEngine
100
+
101
+
102
+ gateway = OpenAICompatibleGateway(
103
+ url=os.environ["CORTEX_GATEWAY_URL"],
104
+ api_key=os.environ["CORTEX_GATEWAY_API_KEY"],
105
+ )
106
+ engine = OpenAIEngine("your-model", gateway=gateway)
107
+ ```
108
+
89
109
  ## Tools
90
110
 
91
111
  Una función async decorada puede exponerse al modelo como respuesta final:
@@ -125,7 +145,7 @@ asyncio.run(main())
125
145
  - Hooks locales.
126
146
  - Timeouts para providers y tools.
127
147
  - Respuesta tipada con texto, usage, razón de salida y respuesta raw.
128
- - OpenAI Responses directo o mediante Talos.
148
+ - OpenAI Responses directo o mediante un gateway compatible.
129
149
 
130
150
  Google conserva un namespace estable para la evolución multiproveedor, pero todavía no incluye un
131
151
  engine funcional. Anthropic y streaming están fuera de este alfa.
@@ -139,12 +159,14 @@ renovable, fencing token y compare-and-swap.
139
159
  Redis no requiere inicialización de schema:
140
160
 
141
161
  ```python
162
+ import os
163
+
142
164
  from cortex_agent_sdk import Agent
143
165
  from cortex_agent_sdk.openai import OpenAIEngine
144
166
  from cortex_agent_sdk.redis import RedisSessionStore
145
167
 
146
168
 
147
- store = RedisSessionStore("redis://127.0.0.1:6379/0")
169
+ store = RedisSessionStore(os.environ["REDIS_URL"])
148
170
  agent = Agent(
149
171
  OpenAIEngine("gpt-5.6-luna"),
150
172
  session_store=store,
@@ -157,10 +179,12 @@ await agent.aclose()
157
179
  PostgreSQL exige crear su tabla de forma explícita una vez:
158
180
 
159
181
  ```python
182
+ import os
183
+
160
184
  from cortex_agent_sdk.postgres import PostgresSessionStore
161
185
 
162
186
 
163
- store = PostgresSessionStore("postgresql://user:password@localhost/app")
187
+ store = PostgresSessionStore(os.environ["POSTGRES_URL"])
164
188
  await store.setup()
165
189
  ```
166
190
 
@@ -175,18 +199,6 @@ regresa `RUNTIME_CIERRE_TIMEOUT` para que la aplicación pueda reintentar el cie
175
199
  Una sesión dañada o deliberadamente descartada se elimina mediante
176
200
  `await agent.reset_session(session_id)`.
177
201
 
178
- ## Desarrollo
179
-
180
- ```bash
181
- uv sync --all-extras
182
- uv run ruff check .
183
- uv run pyright
184
- uv run pytest
185
- uv build --no-sources
186
- ```
187
-
188
- Las pruebas que requieren red son opt-in y no forman parte de la suite normal.
189
-
190
202
  ## Licencia
191
203
 
192
204
  Apache License 2.0.
@@ -28,7 +28,7 @@ El core instala únicamente Pydantic y JSON Schema. Los providers y transportes
28
28
  extras opcionales:
29
29
 
30
30
  - `openai`: engine de OpenAI Responses.
31
- - `talos`: conexión de OpenAI mediante Talos.
31
+ - `gateway`: conexión mediante un endpoint compatible con OpenAI Responses.
32
32
  - `redis`: sesiones persistentes en Redis.
33
33
  - `postgres`: sesiones persistentes en PostgreSQL.
34
34
  - `all`: todas las integraciones disponibles.
@@ -54,6 +54,24 @@ async def main() -> None:
54
54
  asyncio.run(main())
55
55
  ```
56
56
 
57
+ ## Gateway compatible
58
+
59
+ `OpenAIEngine` también acepta un endpoint que conserve el protocolo de OpenAI Responses:
60
+
61
+ ```python
62
+ import os
63
+
64
+ from cortex_agent_sdk.gateway import OpenAICompatibleGateway
65
+ from cortex_agent_sdk.openai import OpenAIEngine
66
+
67
+
68
+ gateway = OpenAICompatibleGateway(
69
+ url=os.environ["CORTEX_GATEWAY_URL"],
70
+ api_key=os.environ["CORTEX_GATEWAY_API_KEY"],
71
+ )
72
+ engine = OpenAIEngine("your-model", gateway=gateway)
73
+ ```
74
+
57
75
  ## Tools
58
76
 
59
77
  Una función async decorada puede exponerse al modelo como respuesta final:
@@ -93,7 +111,7 @@ asyncio.run(main())
93
111
  - Hooks locales.
94
112
  - Timeouts para providers y tools.
95
113
  - Respuesta tipada con texto, usage, razón de salida y respuesta raw.
96
- - OpenAI Responses directo o mediante Talos.
114
+ - OpenAI Responses directo o mediante un gateway compatible.
97
115
 
98
116
  Google conserva un namespace estable para la evolución multiproveedor, pero todavía no incluye un
99
117
  engine funcional. Anthropic y streaming están fuera de este alfa.
@@ -107,12 +125,14 @@ renovable, fencing token y compare-and-swap.
107
125
  Redis no requiere inicialización de schema:
108
126
 
109
127
  ```python
128
+ import os
129
+
110
130
  from cortex_agent_sdk import Agent
111
131
  from cortex_agent_sdk.openai import OpenAIEngine
112
132
  from cortex_agent_sdk.redis import RedisSessionStore
113
133
 
114
134
 
115
- store = RedisSessionStore("redis://127.0.0.1:6379/0")
135
+ store = RedisSessionStore(os.environ["REDIS_URL"])
116
136
  agent = Agent(
117
137
  OpenAIEngine("gpt-5.6-luna"),
118
138
  session_store=store,
@@ -125,10 +145,12 @@ await agent.aclose()
125
145
  PostgreSQL exige crear su tabla de forma explícita una vez:
126
146
 
127
147
  ```python
148
+ import os
149
+
128
150
  from cortex_agent_sdk.postgres import PostgresSessionStore
129
151
 
130
152
 
131
- store = PostgresSessionStore("postgresql://user:password@localhost/app")
153
+ store = PostgresSessionStore(os.environ["POSTGRES_URL"])
132
154
  await store.setup()
133
155
  ```
134
156
 
@@ -143,18 +165,6 @@ regresa `RUNTIME_CIERRE_TIMEOUT` para que la aplicación pueda reintentar el cie
143
165
  Una sesión dañada o deliberadamente descartada se elimina mediante
144
166
  `await agent.reset_session(session_id)`.
145
167
 
146
- ## Desarrollo
147
-
148
- ```bash
149
- uv sync --all-extras
150
- uv run ruff check .
151
- uv run pyright
152
- uv run pytest
153
- uv build --no-sources
154
- ```
155
-
156
- Las pruebas que requieren red son opt-in y no forman parte de la suite normal.
157
-
158
168
  ## Licencia
159
169
 
160
170
  Apache License 2.0.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cortex-agent-sdk"
3
- version = "0.0.1"
3
+ version = "0.0.2"
4
4
  description = "SDK async y multiproveedor para construir agentes con control explícito"
5
5
  readme = "README.md"
6
6
  license = "Apache-2.0"
@@ -21,11 +21,15 @@ dependencies = [
21
21
  "pydantic>=2.13,<3",
22
22
  ]
23
23
 
24
+ [project.urls]
25
+ Repository = "https://github.com/epok200/cortex_agent_sdk"
26
+ Issues = "https://github.com/epok200/cortex_agent_sdk/issues"
27
+
24
28
  [project.optional-dependencies]
25
29
  openai = [
26
30
  "openai>=2.52,<3",
27
31
  ]
28
- talos = [
32
+ gateway = [
29
33
  "openai>=2.52,<3",
30
34
  ]
31
35
  all = [
@@ -1,23 +1,22 @@
1
1
  from pydantic import AnyHttpUrl, BaseModel, ConfigDict, Field, SecretStr
2
2
 
3
3
 
4
- class TalosGateway(BaseModel):
5
- """Conexión interna a Talos para un engine nativo."""
4
+ class OpenAICompatibleGateway(BaseModel):
5
+ """Conexión autenticada a un endpoint compatible con OpenAI Responses."""
6
6
 
7
7
  model_config = ConfigDict(extra="forbid", frozen=True)
8
8
 
9
9
  url: AnyHttpUrl
10
- project_token: SecretStr = Field(min_length=32)
10
+ api_key: SecretStr = Field(min_length=32)
11
11
 
12
12
  def __init__(
13
13
  self,
14
14
  *,
15
15
  url: str | AnyHttpUrl,
16
- project_token: str | SecretStr,
16
+ api_key: str | SecretStr,
17
17
  ) -> None:
18
- super().__init__(url=url, project_token=project_token)
18
+ super().__init__(url=url, api_key=api_key)
19
19
 
20
20
  @property
21
- def openai_base_url(self) -> str:
21
+ def base_url(self) -> str:
22
22
  return f"{str(self.url).rstrip('/')}/v1"
23
-
@@ -9,7 +9,7 @@ from pydantic import BaseModel, JsonValue, TypeAdapter, ValidationError
9
9
 
10
10
  from cortex_agent_sdk.engine import EngineRequest, EngineResult, ToolCall, Usage
11
11
  from cortex_agent_sdk.errores import AppError, CodigoError
12
- from cortex_agent_sdk.gateway import TalosGateway
12
+ from cortex_agent_sdk.gateway import OpenAICompatibleGateway
13
13
  from cortex_agent_sdk.history.models import (
14
14
  ProviderState,
15
15
  ProviderValue,
@@ -39,7 +39,7 @@ class OpenAIEngine:
39
39
  model: str,
40
40
  *,
41
41
  api_key: str | None = None,
42
- gateway: TalosGateway | None = None,
42
+ gateway: OpenAICompatibleGateway | None = None,
43
43
  options: OpenAIOptions | None = None,
44
44
  client: AsyncOpenAI | None = None,
45
45
  ) -> None:
@@ -133,12 +133,12 @@ class OpenAIEngine:
133
133
  def _create_client(
134
134
  self,
135
135
  api_key: str | None,
136
- gateway: TalosGateway | None,
136
+ gateway: OpenAICompatibleGateway | None,
137
137
  ) -> AsyncOpenAI:
138
138
  if gateway is not None:
139
139
  return AsyncOpenAI(
140
- api_key=gateway.project_token.get_secret_value(),
141
- base_url=gateway.openai_base_url,
140
+ api_key=gateway.api_key.get_secret_value(),
141
+ base_url=gateway.base_url,
142
142
  max_retries=0,
143
143
  timeout=self._options.timeout_seconds,
144
144
  )
@@ -301,4 +301,3 @@ def _stop_reason(response) -> str | None:
301
301
  if incomplete is not None:
302
302
  return incomplete.reason
303
303
  return response.status
304
-