agentics-you 1.2.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.
@@ -0,0 +1,235 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentics-you
3
+ Version: 1.2.0
4
+ Summary: Agentics SDK for Python: shared memory for AI agents, receipts and the gateway.
5
+ Author-email: Agentics Technologies LLC <hello@agentics.you>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://agentics.you
8
+ Project-URL: Documentation, https://agentics.you/developers/
9
+ Project-URL: Source, https://github.com/agenticstechnologies/agentics.you/tree/master/sdks/python
10
+ Keywords: agentics,memory,agents,mcp,llm
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ Provides-Extra: openai
21
+ Requires-Dist: openai-agents>=0.0.3; extra == "openai"
22
+ Provides-Extra: litellm
23
+ Requires-Dist: litellm>=1.40; extra == "litellm"
24
+
25
+ # agentics-you — Python SDK
26
+
27
+ The Python SDK for **[Agentics](https://agentics.you)**: shared memory for AI agents, with a receipt for every write. The same package carries the receipt helpers, the gateway client and the `agentics` CLI.
28
+
29
+ ## Install
30
+
31
+ > **Not yet published.** `agentics-you` is not on PyPI, so these installs fail. Install from a checkout of this repo with `pip install ./sdks/python`. To call the memory API today without it, use the [REST API](https://agentics.you/docs/api/) or the hosted MCP server at `https://agentics.you/mcp`.
32
+
33
+ ```bash
34
+ pip install agentics-you
35
+ pip install "agentics-you[openai]" # + OpenAI Agents SDK trace processor (agentics_you.openai_agents)
36
+ pip install "agentics-you[litellm]" # + LiteLLM callback (agentics_you.litellm_callback)
37
+ ```
38
+
39
+ The import name is `agentics_you`. `agentics` on PyPI belongs to another publisher.
40
+
41
+ ## Quickstart
42
+
43
+ ```python
44
+ from agentics_you import AgenticsClient
45
+ client = AgenticsClient() # AGENTICS_API_KEY=ak_...
46
+ client.memories.add("Dana prefers aisle seats.", wait=True)
47
+ hits = client.memories.search("Which seat does Dana want?")["hits"]
48
+ ```
49
+
50
+ ## Memory in more detail
51
+
52
+ Create an org API key (`ak_...`) in the console under API Keys.
53
+
54
+ ```bash
55
+ export AGENTICS_API_KEY=ak_...
56
+ export AGENTICS_AGENT=... # optional: agent identity token, so writes are attributed to that agent
57
+ ```
58
+
59
+ ```python
60
+ from agentics_you import AgenticsClient
61
+
62
+ client = AgenticsClient()
63
+
64
+ # Write. The API queues an ingest job; wait=True returns once the memory is indexed.
65
+ r = client.memories.add("Dana prefers aisle seats on flights over two hours.",
66
+ metadata={"topic": "travel"}, wait=True)
67
+
68
+ # Recall. Each hit carries score, why and receipt_hash.
69
+ hits = client.memories.search("Which seat does Dana want?", k=5)["hits"]
70
+
71
+ client.memories.get(r["memory_id"])
72
+ client.memories.list(limit=20)
73
+ client.memories.delete(r["memory_id"])
74
+ ```
75
+
76
+ | Resource | Methods | Route |
77
+ |---|---|---|
78
+ | `client.memories` | `add`, `search`, `list`, `get`, `delete`, `export` | `/v1/memories`, `/v1/memories/search`, `/v1/memories/export` |
79
+ | `client.namespaces` | `list`, `create`, `get`, `rename`, `delete` | `/v1/namespaces` |
80
+ | `client.ingest` | `get`, `list`, `retry`, `wait` | `/v1/ingest`, `/v1/ingest/{job_id}` |
81
+
82
+ `AsyncAgenticsClient` has the same methods as coroutines. Errors are typed by status: `ValidationError` (400/413/422), `AuthenticationError` (401), `PermissionDeniedError` (403), `NotFoundError` (404), `ConflictError` (409), `RateLimitError` (429), `ServerError` (5xx), all subclasses of `AgenticsError` with `code`, `status` and `details`. Network errors, timeouts, 429, 502, 503 and 504 are retried with backoff (`max_retries`, default 2), honouring `Retry-After`. `AGENTICS_BASE_URL` points the client at another deployment. Stdlib only, Python 3.9+.
83
+
84
+ ## Receipts (decorator)
85
+
86
+ ```python
87
+ from agentics_you import Network
88
+
89
+ net = Network(api_key="ak_...")
90
+
91
+ @net.task(
92
+ agent_id="support-bot",
93
+ foundation_model="anthropic/claude-opus-4-6",
94
+ scope=["read:tickets", "write:reply"],
95
+ )
96
+ def handle_ticket(ticket_id: str) -> str:
97
+ # your agent logic
98
+ return "Thanks for reaching out!"
99
+
100
+ reply = handle_ticket("abc-123")
101
+ # A receipt was recorded.
102
+ ```
103
+
104
+ ## Receipts (context manager)
105
+
106
+ ```python
107
+ from agentics_you import Agentics
108
+
109
+ agentics = Agentics(api_key="ak_...")
110
+
111
+ with agentics.track(
112
+ agent_id="support-bot",
113
+ foundation_model="anthropic/claude-opus-4-6",
114
+ model_version="2026-04-22",
115
+ scope=["read:tickets", "write:reply"],
116
+ ) as task:
117
+ reply = run_my_agent(...)
118
+ task.set_outputs(reply)
119
+ task.set_outcome("success")
120
+ ```
121
+
122
+ ## Gateway — drop-in OpenAI-compatible client
123
+
124
+ Change **one** `base_url` and keep your existing OpenAI/Anthropic SDK. Every call
125
+ is routed, budgeted, guardrailed, and lands a cryptographically verifiable
126
+ receipt on the trust-ledger — written **server-side** by Proof Mesh (the SDK
127
+ never hashes, signs, or sets `billable`).
128
+
129
+ ```python
130
+ from openai import OpenAI # your existing SDK, unchanged
131
+ from agentics_you import createHeaders
132
+
133
+ client = OpenAI(
134
+ base_url="https://agentics.you/api/v1", # the only change
135
+ api_key="ak_...", # your Agentics gateway key
136
+ default_headers=createHeaders(user="alice@acme.com",
137
+ metadata={"cost_center": "support"}),
138
+ )
139
+ resp = client.chat.completions.create(
140
+ model="@anthropic/claude-opus-4-8",
141
+ messages=[{"role": "user", "content": "hi"}],
142
+ )
143
+ ```
144
+
145
+ Or use the self-contained client (stdlib only, no `openai` needed):
146
+
147
+ ```python
148
+ from agentics_you import AgenticsGateway
149
+
150
+ gw = AgenticsGateway(base_url="https://agentics.you/api/v1", api_key="ak_...")
151
+ resp = gw.with_options(user="alice@acme.com").chat.completions.create(
152
+ model="@anthropic/claude-opus-4-8",
153
+ messages=[{"role": "user", "content": "hi"}],
154
+ )
155
+
156
+ # Auto-instrument CrewAI / LangGraph, or attach LangChain/LlamaIndex handlers:
157
+ from agentics_you import LangchainCallbackHandler
158
+ chain.invoke(x, config={"callbacks": [LangchainCallbackHandler(user="alice@acme.com")]})
159
+
160
+ # Browse the Model Garden catalog:
161
+ gw.list_models(provider="anthropic")
162
+ ```
163
+
164
+ `createHeaders()` emits the frozen `x-agentics-{trace-id,span-id,user,meta,debug}`
165
+ header set; these become the parent receipt's identity fields, so per-user
166
+ attribution and provable savings start at your call site. Full quickstart:
167
+ <https://agentics.you/docs/sdk/python.html>.
168
+
169
+ ## Authentication
170
+
171
+ The SDK looks for an API key in this order:
172
+
173
+ 1. `api_key=` constructor argument
174
+ 2. `AGENTICS_API_KEY` environment variable
175
+ 3. `~/.agentics/credentials` (set by `agentics login --api-key ak_...`)
176
+
177
+ Issue API keys from the dashboard at <https://agentics.you/dashboard/api-keys>.
178
+
179
+ ## CLI
180
+
181
+ ```bash
182
+ # Save credentials
183
+ agentics login --api-key ak_...
184
+
185
+ # Register / update an agent from a manifest
186
+ cat > agentics.json <<EOF
187
+ {
188
+ "display_name": "Support Bot",
189
+ "handle": "support-bot",
190
+ "foundation_model": "anthropic/claude-opus-4-6",
191
+ "scope_array": ["read:tickets", "write:reply"],
192
+ "description": "Handles tier-1 support tickets"
193
+ }
194
+ EOF
195
+ agentics deploy
196
+
197
+ # Or override fields inline
198
+ agentics deploy --name "Support Bot" --model anthropic/claude-opus-4-6 \\
199
+ --scope "read:tickets,write:reply"
200
+
201
+ # Inspect your account
202
+ agentics whoami
203
+ agentics agents
204
+
205
+ # Gateway devex verbs
206
+ agentics gateway test --url https://agentics.you/api/v1 --user alice@acme.com
207
+ agentics config validate gateway-config.json
208
+ agentics config publish gateway-config.json --name default
209
+ agentics prompt push support-greeting.json
210
+ agentics log tail --limit 5 # gateway receipts with their trace_id
211
+ agentics proof verify <receipt_hash> # 4-step end-to-end verify
212
+ agentics proof bundle <receipt_hash> # offline-verifiable evidence bundle
213
+ agentics models --provider anthropic
214
+ ```
215
+
216
+ ## Publishing (for maintainers)
217
+
218
+ Published from `sdks/python/` to PyPI as `agentics-you` by `.github/workflows/pypi-publish.yml`, with PyPI Trusted Publishing (OIDC, no token on this repo):
219
+
220
+ ```bash
221
+ # Bump version in pyproject.toml and agentics_you/version.py, then tag sdk-py-v<semver>.
222
+ git tag sdk-py-v1.2.0
223
+ git push origin sdk-py-v1.2.0
224
+ ```
225
+
226
+ The action runs the unit tests, writes the tag's version into both version files, builds the sdist and wheel, runs `twine check`, and publishes. One-time: add this repo as a trusted publisher for `agentics-you` at <https://pypi.org/manage/account/publishing/> (workflow `pypi-publish.yml`, environment `pypi`).
227
+
228
+ ## Links
229
+
230
+ - Marketing site & docs: <https://agentics.you>
231
+ - Status & dashboards: <https://agentics.you/intelligence/>
232
+ - Live public ledger: <https://agentics.you/ledger/>
233
+ - File a bug: <https://github.com/agenticstechnologies/agentics.you/issues>
234
+
235
+ Apache-2.0
@@ -0,0 +1,211 @@
1
+ # agentics-you — Python SDK
2
+
3
+ The Python SDK for **[Agentics](https://agentics.you)**: shared memory for AI agents, with a receipt for every write. The same package carries the receipt helpers, the gateway client and the `agentics` CLI.
4
+
5
+ ## Install
6
+
7
+ > **Not yet published.** `agentics-you` is not on PyPI, so these installs fail. Install from a checkout of this repo with `pip install ./sdks/python`. To call the memory API today without it, use the [REST API](https://agentics.you/docs/api/) or the hosted MCP server at `https://agentics.you/mcp`.
8
+
9
+ ```bash
10
+ pip install agentics-you
11
+ pip install "agentics-you[openai]" # + OpenAI Agents SDK trace processor (agentics_you.openai_agents)
12
+ pip install "agentics-you[litellm]" # + LiteLLM callback (agentics_you.litellm_callback)
13
+ ```
14
+
15
+ The import name is `agentics_you`. `agentics` on PyPI belongs to another publisher.
16
+
17
+ ## Quickstart
18
+
19
+ ```python
20
+ from agentics_you import AgenticsClient
21
+ client = AgenticsClient() # AGENTICS_API_KEY=ak_...
22
+ client.memories.add("Dana prefers aisle seats.", wait=True)
23
+ hits = client.memories.search("Which seat does Dana want?")["hits"]
24
+ ```
25
+
26
+ ## Memory in more detail
27
+
28
+ Create an org API key (`ak_...`) in the console under API Keys.
29
+
30
+ ```bash
31
+ export AGENTICS_API_KEY=ak_...
32
+ export AGENTICS_AGENT=... # optional: agent identity token, so writes are attributed to that agent
33
+ ```
34
+
35
+ ```python
36
+ from agentics_you import AgenticsClient
37
+
38
+ client = AgenticsClient()
39
+
40
+ # Write. The API queues an ingest job; wait=True returns once the memory is indexed.
41
+ r = client.memories.add("Dana prefers aisle seats on flights over two hours.",
42
+ metadata={"topic": "travel"}, wait=True)
43
+
44
+ # Recall. Each hit carries score, why and receipt_hash.
45
+ hits = client.memories.search("Which seat does Dana want?", k=5)["hits"]
46
+
47
+ client.memories.get(r["memory_id"])
48
+ client.memories.list(limit=20)
49
+ client.memories.delete(r["memory_id"])
50
+ ```
51
+
52
+ | Resource | Methods | Route |
53
+ |---|---|---|
54
+ | `client.memories` | `add`, `search`, `list`, `get`, `delete`, `export` | `/v1/memories`, `/v1/memories/search`, `/v1/memories/export` |
55
+ | `client.namespaces` | `list`, `create`, `get`, `rename`, `delete` | `/v1/namespaces` |
56
+ | `client.ingest` | `get`, `list`, `retry`, `wait` | `/v1/ingest`, `/v1/ingest/{job_id}` |
57
+
58
+ `AsyncAgenticsClient` has the same methods as coroutines. Errors are typed by status: `ValidationError` (400/413/422), `AuthenticationError` (401), `PermissionDeniedError` (403), `NotFoundError` (404), `ConflictError` (409), `RateLimitError` (429), `ServerError` (5xx), all subclasses of `AgenticsError` with `code`, `status` and `details`. Network errors, timeouts, 429, 502, 503 and 504 are retried with backoff (`max_retries`, default 2), honouring `Retry-After`. `AGENTICS_BASE_URL` points the client at another deployment. Stdlib only, Python 3.9+.
59
+
60
+ ## Receipts (decorator)
61
+
62
+ ```python
63
+ from agentics_you import Network
64
+
65
+ net = Network(api_key="ak_...")
66
+
67
+ @net.task(
68
+ agent_id="support-bot",
69
+ foundation_model="anthropic/claude-opus-4-6",
70
+ scope=["read:tickets", "write:reply"],
71
+ )
72
+ def handle_ticket(ticket_id: str) -> str:
73
+ # your agent logic
74
+ return "Thanks for reaching out!"
75
+
76
+ reply = handle_ticket("abc-123")
77
+ # A receipt was recorded.
78
+ ```
79
+
80
+ ## Receipts (context manager)
81
+
82
+ ```python
83
+ from agentics_you import Agentics
84
+
85
+ agentics = Agentics(api_key="ak_...")
86
+
87
+ with agentics.track(
88
+ agent_id="support-bot",
89
+ foundation_model="anthropic/claude-opus-4-6",
90
+ model_version="2026-04-22",
91
+ scope=["read:tickets", "write:reply"],
92
+ ) as task:
93
+ reply = run_my_agent(...)
94
+ task.set_outputs(reply)
95
+ task.set_outcome("success")
96
+ ```
97
+
98
+ ## Gateway — drop-in OpenAI-compatible client
99
+
100
+ Change **one** `base_url` and keep your existing OpenAI/Anthropic SDK. Every call
101
+ is routed, budgeted, guardrailed, and lands a cryptographically verifiable
102
+ receipt on the trust-ledger — written **server-side** by Proof Mesh (the SDK
103
+ never hashes, signs, or sets `billable`).
104
+
105
+ ```python
106
+ from openai import OpenAI # your existing SDK, unchanged
107
+ from agentics_you import createHeaders
108
+
109
+ client = OpenAI(
110
+ base_url="https://agentics.you/api/v1", # the only change
111
+ api_key="ak_...", # your Agentics gateway key
112
+ default_headers=createHeaders(user="alice@acme.com",
113
+ metadata={"cost_center": "support"}),
114
+ )
115
+ resp = client.chat.completions.create(
116
+ model="@anthropic/claude-opus-4-8",
117
+ messages=[{"role": "user", "content": "hi"}],
118
+ )
119
+ ```
120
+
121
+ Or use the self-contained client (stdlib only, no `openai` needed):
122
+
123
+ ```python
124
+ from agentics_you import AgenticsGateway
125
+
126
+ gw = AgenticsGateway(base_url="https://agentics.you/api/v1", api_key="ak_...")
127
+ resp = gw.with_options(user="alice@acme.com").chat.completions.create(
128
+ model="@anthropic/claude-opus-4-8",
129
+ messages=[{"role": "user", "content": "hi"}],
130
+ )
131
+
132
+ # Auto-instrument CrewAI / LangGraph, or attach LangChain/LlamaIndex handlers:
133
+ from agentics_you import LangchainCallbackHandler
134
+ chain.invoke(x, config={"callbacks": [LangchainCallbackHandler(user="alice@acme.com")]})
135
+
136
+ # Browse the Model Garden catalog:
137
+ gw.list_models(provider="anthropic")
138
+ ```
139
+
140
+ `createHeaders()` emits the frozen `x-agentics-{trace-id,span-id,user,meta,debug}`
141
+ header set; these become the parent receipt's identity fields, so per-user
142
+ attribution and provable savings start at your call site. Full quickstart:
143
+ <https://agentics.you/docs/sdk/python.html>.
144
+
145
+ ## Authentication
146
+
147
+ The SDK looks for an API key in this order:
148
+
149
+ 1. `api_key=` constructor argument
150
+ 2. `AGENTICS_API_KEY` environment variable
151
+ 3. `~/.agentics/credentials` (set by `agentics login --api-key ak_...`)
152
+
153
+ Issue API keys from the dashboard at <https://agentics.you/dashboard/api-keys>.
154
+
155
+ ## CLI
156
+
157
+ ```bash
158
+ # Save credentials
159
+ agentics login --api-key ak_...
160
+
161
+ # Register / update an agent from a manifest
162
+ cat > agentics.json <<EOF
163
+ {
164
+ "display_name": "Support Bot",
165
+ "handle": "support-bot",
166
+ "foundation_model": "anthropic/claude-opus-4-6",
167
+ "scope_array": ["read:tickets", "write:reply"],
168
+ "description": "Handles tier-1 support tickets"
169
+ }
170
+ EOF
171
+ agentics deploy
172
+
173
+ # Or override fields inline
174
+ agentics deploy --name "Support Bot" --model anthropic/claude-opus-4-6 \\
175
+ --scope "read:tickets,write:reply"
176
+
177
+ # Inspect your account
178
+ agentics whoami
179
+ agentics agents
180
+
181
+ # Gateway devex verbs
182
+ agentics gateway test --url https://agentics.you/api/v1 --user alice@acme.com
183
+ agentics config validate gateway-config.json
184
+ agentics config publish gateway-config.json --name default
185
+ agentics prompt push support-greeting.json
186
+ agentics log tail --limit 5 # gateway receipts with their trace_id
187
+ agentics proof verify <receipt_hash> # 4-step end-to-end verify
188
+ agentics proof bundle <receipt_hash> # offline-verifiable evidence bundle
189
+ agentics models --provider anthropic
190
+ ```
191
+
192
+ ## Publishing (for maintainers)
193
+
194
+ Published from `sdks/python/` to PyPI as `agentics-you` by `.github/workflows/pypi-publish.yml`, with PyPI Trusted Publishing (OIDC, no token on this repo):
195
+
196
+ ```bash
197
+ # Bump version in pyproject.toml and agentics_you/version.py, then tag sdk-py-v<semver>.
198
+ git tag sdk-py-v1.2.0
199
+ git push origin sdk-py-v1.2.0
200
+ ```
201
+
202
+ The action runs the unit tests, writes the tag's version into both version files, builds the sdist and wheel, runs `twine check`, and publishes. One-time: add this repo as a trusted publisher for `agentics-you` at <https://pypi.org/manage/account/publishing/> (workflow `pypi-publish.yml`, environment `pypi`).
203
+
204
+ ## Links
205
+
206
+ - Marketing site & docs: <https://agentics.you>
207
+ - Status & dashboards: <https://agentics.you/intelligence/>
208
+ - Live public ledger: <https://agentics.you/ledger/>
209
+ - File a bug: <https://github.com/agenticstechnologies/agentics.you/issues>
210
+
211
+ Apache-2.0
@@ -0,0 +1,82 @@
1
+ """agentics-you — the Agentics Python SDK: shared memory for AI agents, receipts and the gateway.
2
+
3
+ Memory quickstart:
4
+
5
+ from agentics_you import AgenticsClient
6
+
7
+ client = AgenticsClient() # reads AGENTICS_API_KEY (ak_...), optional AGENTICS_AGENT
8
+ client.memories.add("Dana prefers aisle seats.", wait=True)
9
+ hits = client.memories.search("Which seat does Dana want?", k=5)["hits"]
10
+
11
+ Receipts (decorator style):
12
+
13
+ from agentics_you import Network
14
+
15
+ net = Network(api_key="ak_...")
16
+
17
+ @net.task(scope=["read:tickets", "write:reply"])
18
+ def handle_ticket(ticket_id: str) -> str:
19
+ return reply
20
+
21
+ Extras: ``agentics-you[openai]`` (agentics_you.openai_agents trace processor) and ``agentics-you[litellm]``
22
+ (agentics_you.litellm_callback).
23
+ """
24
+ from .client import Agentics, Task, TaskContext
25
+ from .network import Network
26
+ from .version import __version__
27
+
28
+ # Memory client (namespaces, memories, ingest) with typed errors and retries.
29
+ from .memory import (
30
+ AgenticsClient,
31
+ AsyncAgenticsClient,
32
+ AgenticsError,
33
+ ValidationError,
34
+ AuthenticationError,
35
+ PermissionDeniedError,
36
+ NotFoundError,
37
+ ConflictError,
38
+ RateLimitError,
39
+ ServerError,
40
+ )
41
+
42
+ # Task receipts posted to /v1/receipts (formerly packages/agentics-python).
43
+ from .receipts import client, Client
44
+
45
+ # Gateway client (drop-in OpenAI-compatible base_url swap). Stdlib-only, so this
46
+ # import is always safe even without the `openai` package installed.
47
+ from .gateway import (
48
+ AgenticsGateway,
49
+ GatewayError,
50
+ createHeaders,
51
+ list_models,
52
+ DEFAULT_GATEWAY_BASE_URL,
53
+ )
54
+
55
+ __all__ = [
56
+ # Memory
57
+ "AgenticsClient", "AsyncAgenticsClient", "AgenticsError", "ValidationError", "AuthenticationError",
58
+ "PermissionDeniedError", "NotFoundError", "ConflictError", "RateLimitError", "ServerError",
59
+ # Receipts
60
+ "client", "Client",
61
+ "Agentics", "Task", "TaskContext",
62
+ "Network",
63
+ "AgenticsTasks", "AgenticsTasksError",
64
+ # Gateway (drop-in OpenAI-compatible client + trace/metadata propagation)
65
+ "AgenticsGateway", "GatewayError", "createHeaders", "list_models",
66
+ "DEFAULT_GATEWAY_BASE_URL",
67
+ "__version__",
68
+ ]
69
+
70
+
71
+ def __getattr__(name):
72
+ """Lazily expose the framework callback handlers so importing `agentics`
73
+ never requires LangChain/LlamaIndex/CrewAI to be installed."""
74
+ if name in ("AgenticsTasks", "AgenticsTasksError"): # needs httpx, which is not a dependency
75
+ from . import tasks as _tasks
76
+
77
+ return getattr(_tasks, name)
78
+ if name in ("instrument", "LangchainCallbackHandler", "LlamaIndexCallbackHandler"):
79
+ from . import instrument as _instr
80
+
81
+ return getattr(_instr, name)
82
+ raise AttributeError(f"module 'agentics_you' has no attribute {name!r}")