Agentfy integration
The runtime boundary and delegated context below are implementation requirements. Availability notes reflect the inspection on 2 October 2026, not a live status check. For module transport and writes, use only Module Protocol 1.
Agent profiles and updates
STOR-59 sends the Admin Agent's name, instructions, skill and MCP settings inline when creating it. Store Deputy owns this content; Agentfy approves the organization's policy for models, MCP hosts, trusted context and worker permissions. There are no template selectors. Optional worker tools and destinations come from server configuration.
On the store page, an owner or admin can choose Update agent to apply the latest versioned instructions while keeping the agent and all conversations. Matching revisions cause no remote write. Updates require a ready agent and an active store and team. If connection settings change, the card waits for Agentfy to recheck MCP. A failed update remains visible after refresh; a policy refusal names its field. A lost response is not proof of success: refresh and explicitly update again. Delete agent still removes the agent and chat history to create a replacement.
This is local integration work, not deployment or merchant-store acceptance. Fake mode accepts the same profiles and updates but its chat is scripted.
The connection in Settings
Since STOR-71 (15 October 2026) the Agentfy connection is not deployment configuration: platform admins set it in the admin console under Settings → Agentfy, on the contract every sibling product (Bonsite, Securify, Shiffty) shares. Seven fields, in this order: mode (off, fake, organization), apiUrl, organizationId, environment (test, production), provisioningKey (shown as Organization key), mcpUrl, modelId. The key is sealed with a key that lives outside the database and is shown only as set or not set; every change is audited by field name. Changing the mode, the API origin, the organization or the environment is a different Agentfy and needs an explicit reconnect, which discards the bindings (teams, agents, conversations) of the previous one.
In code there is one place that knows the connection, api/src/slices/setup/agentfy/connection.ts, and everything — provisioning, server chat, the MCP grant audience, the agent profile's model — reads it from there. The environment variables (AGENTFY_INTEGRATION_MODE, AGENTFY_URL, AGENTFY_ORG_ID, AGENTFY_ORG_ENVIRONMENT, AGENTFY_ORG_KEY, MCP_PUBLIC_URL, AGENTFY_MODEL_ID) are read only in development while nothing is saved, and are what "Import from environment" brings in. The earlier prototype mode (legacy) and its separate chat switch no longer exist. The mail server is the second group of the same registry (service/mail); picture generation (fake or live FlashBoards, its key and limits) is another (service/flashboards), and what is saved there replaces the FLASHBOARDS_* variables. Details: api/SETTINGS.md.
This is local integration work: the form has been exercised against the fake Agentfy and a local Agentfy on this machine, not against a deployed one.
One organization key
Since 27 November 2026 one Agentfy organization key (orgk_…) does both provisioning and chat. Until then the settings held a second, separate server chat key that had to differ from the first; Agentfy does not need that, because one key can carry both permission sets. The field keeps its stored name provisioningKey, since a secret is sealed bound to its field's name. A row saved earlier that still holds the old chat key keeps working: that value is not read, and the next save drops it. The key needs provision:create and provision:read for provisioning, and chat:membership, chat:create, chat:read, chat:run and chat:context for chat. Test connection asks both routes with it and is green only when the API, provisioning, chat and MCP checks all pass; a refusal names the missing permissions. Checked only locally, against fakes and mocked answers; not yet against a real Agentfy organization.
What to know before switching, true today:
- Changing the API URL, organization, environment or mode unbinds every agent: they are created again and chat history is lost. Switch environments once and deliberately.
- The agent profile asks for trusted context (
mcp.trustedContext: true), so the organization's policy must allow it, together with the models and the MCP host. Worker tools and egress are not needed. An Agentfy platform admin approves policy changes. - The local Agentfy's seed key has only the provisioning permissions, so local chat answers 403 until Agentfy's seed adds the chat permissions.
- A key works only in its own organization and in the deployment's environment; anywhere else Agentfy answers 401
CREDENTIAL_REJECTED. A separate Agentfy change proposes removing the environment check; it is not merged. - Rollout order: issue one key with both permission sets in the right organization, deploy, paste it into Organization key, then press Test connection and expect all four checks green.
Three authority boundaries
Agentfy runtime ──(1) agent credential + (2) conversation grant──▶ Store Deputy MCP
│ policy, audit
│
(3) connection signature, never (1) or (2) ────┘
▼
OpenCart module REST API| Boundary | Proof | Issued by, held by | Valid only at | Never |
|---|---|---|---|---|
| Agent → Store Deputy | Authorization: Bearer sdak_…, one per provisioned agent | Store Deputy; Agentfy keeps it as a team secret | Store Deputy MCP | Forwarded to a shop, shown to the model, accepted as a person's authority |
| Person or shopper | X-SD-Context: sdcg_…, one per conversation | Store Deputy; Agentfy carries it per conversation | Store Deputy MCP, for that agent and thread | Holds permissions of its own; survives a revoked membership |
| Store Deputy → shop | HMAC with the connection secret, both directions | Store Deputy and the module, at pairing | That one shop's module | Leaves Store Deputy's servers or the shop |
The shopper's storefront session is a fourth secret, and it never leaves the shop. The module verifies it and hands Store Deputy only an opaque reference (not in Module Protocol 1 yet; see out of scope).
Store Deputy MCP
Transport. One endpoint, {STORE_DEPUTY_API}/mcp, Streamable HTTP, protocol version 2025-06-18 (the version Agentfy's client sends today). It is stateless: Agentfy opens a new MCP session for every call, so initialize must be cheap and no state may hang on Mcp-Session-Id. tools/list returns every tool in one page, because Agentfy does not follow nextCursor.
Tools for the Admin Agent (Stage A). The first six served by the API since 12 October 2026 (iteration 6, step B3); the fourteen reads of the other resources the module serves since 21 October 2026 (STOR-85). Since STOR-67 every tool is tested against the OpenCart 3 module on the local test shops only; nothing has run against a real store. The catalog tools need the catalog.read scope; customers and orders need customers.read and orders.read, which the admin profile grants only to a person of the team in a conversation (the agent alone holds catalog.read); addresses need addresses.read as well. The price change tools also need the team's price.base.propose. None writes to the store: an approved change is applied by the API worker. Since 2 November 2026 every write the OpenCart 3 module can already apply has its proposal tool (the table below); they need catalog.change.propose (products, variants, categories; behind the agent's catalog.write), orders.status.propose or coupons.status.propose (behind sales.write), each only where the store declares the matching <resource>.write.<field> capability. Creating, deleting, texts, specials and reviews are not built. Variants exist only where the platform has them: the OpenCart 3 module declares no variant capability, so the variant tools answer capability_unavailable there.
| Tool | Does |
|---|---|
store_describe | The store's name, platform, storefronts, currency, whether prices include tax, its capabilities, and whether the owner paused Store Deputy |
catalog_find_products | Find by product code, SKU, barcode, MPN or id, read live; returns every match, never picks one |
catalog_get_products | Current details by product id, read live; missing ids are listed |
catalog_query_products | Filters, sort and totals over a live scan of the store's product list, with when it was read and whether the scan was partial (decision 007). A category filter includes the products of its subcategories unless told otherwise, and a word search lists the categories whose name matches (decision 012) |
catalog_find_by_kind | A kind of product ("all phones") in one call: the categories whose name matches, then their products with every subcategory, once each; it falls back to a word search on product names and says so. Checked only against fakes, never on a real store |
price_change_propose, price_change_status | Record a base price proposal for the owner to approve on the site, and follow it to the applied result |
product_stock_change_propose, product_status_change_propose, product_storefronts_change_propose | Proposals for stock quantities, enabling or disabling products, and the storefronts a product is on; same approval, conditional write, read-back and receipt as a price change |
product_texts_change_propose | A proposal of new names, descriptions (HTML) and meta tags (title, description, keywords) for up to 20 products, per language of the store (BCP 47 codes from store_describe). Same approval, conditional write per language and field, read-back and receipt. The API refuses a description with a script, iframe, object, embed or style element, an on… attribute or a javascript: / data: link before anything is proposed; a store whose module does not declare product.write.texts answers capability_unavailable (update the module). Tags are not covered. Scope catalog.change.propose (behind catalog.write). Proven only against an in-memory store: the OpenCart 3 module does not support texts yet (STOR-98) |
variant_price_change_propose, variant_stock_change_propose, variant_status_change_propose | The same for product variants (only where the platform has variants) |
category_status_change_propose, category_parent_change_propose | Enable or disable a category; move it under another parent or to the top level (never under itself) |
order_status_change_propose | Proposes a new order status. When applied the shop's own status handling runs (its notifications and the order history fire), so the shop may email the customer; the approval card says so. Scope orders.status.propose |
product_create_propose, category_create_propose, manufacturer_create_propose, coupon_create_propose | Decision 008, accepted 9 November 2026; not run against any store. Propose a new record: always created disabled (a manufacturer has no status); publishing is a separate approved change (product_status_change_propose and the like). Scopes catalog.create.propose and sales.create.propose, behind the agent permissions catalog.create and sales.create, which are off until a platform admin switches them on and count only while the store has changes on. The store's module must declare <resource>.create; no module does yet, so today they answer capability_unavailable |
product_identifiers_change_propose, product_placement_change_propose, product_shipping_change_propose, product_terms_change_propose, product_seo_change_propose, product_specials_change_propose, product_discounts_change_propose, category_details_change_propose, manufacturer_details_change_propose | Proposals for the further editable fields of products, categories and manufacturers (codes, categories and manufacturer, weight and dimensions, tax class, minimum quantity and availability date, SEO keywords, the whole specials and discounts lists, category texts and sort order). Grouped by capability family, one approval card per group. Scope catalog.change.propose; capability_unavailable until the module declares the fields |
coupon_details_change_propose, customer_details_change_propose, order_history_propose | Proposals for coupon fields, customer status, group, name, telephone and email, and a history entry on an order (notify: true makes the shop email the customer; the card says so). Scope sales.change.propose |
coupon_status_change_propose | Enable or disable a coupon. Scope coupons.status.propose |
change_status | Follow any proposal (old and new values per item, the decision, and once approved what the store did to each item); price_change_status remains for price changes |
variant_find, variant_get | Variants by identifier or id, read live. Scope catalog.read |
coupon_find, coupon_get, coupon_query | Coupons by id or code; listed by name, code, status, discount kind, free shipping, validity and dates. Scope coupons.read (with the agent's sales.read) |
category_get, category_query | Categories by id, or listed by words of the name, status, parent (or top level), storefront and dates, one numbered page with the count; manufacturer_get, manufacturer_query the same for manufacturers. Scope catalog.read |
customer_find, customer_get, customer_query, customer_group_list | Customers by id, exact email or telephone; by id; listed by name, email, telephone, group, status and sign-up date; the customer groups. A customer carries the ids of its addresses, never the addresses. Scope customers.read |
order_find, order_get, order_query, order_status_list | Orders by id, number or the buyer's email (summaries); in full by id (status, lines, total lines, methods, buyer); listed by buyer, status, total and dates (abandoned checkouts only when asked, status id "0"); the order statuses. Scope orders.read |
customer_address_get, order_address_get | A customer's addresses by address id; an order's payment and shipping addresses by order id. Scope addresses.read: only while the agent's "Customer addresses" permission is on (an owner or admin sets it on the store page; the module always declares the address capabilities), and only for the team's owner and admins; otherwise refused with permission_denied (agent_permission_off or role_required) |
The contract is contracts/mcp/tools.yaml; an API test fails when a served tool differs from it.
Tools for the Frontend Agent (Stage B): cart_get, cart_add_item, cart_update_item, cart_remove_item. They are reserved, not built.
Rules every tool follows:
- No argument names a store, team, person, customer, conversation, price authority or permission. Every object schema forbids extra properties. Passing
store_idis refused withinvalid_arguments; it never selects anything. The check script enforces both. - Names use letters, digits and underscores only. Model providers behind Agentfy reject dots, and Agentfy silently drops names a provider cannot accept.
- A tool is listed only if the agent's profile includes it, the shop's manifest declares its capability, and the team's entitlement allows it. Calling a tool that is not listed is refused on the server, not only hidden.
- Results. Success returns
structuredContentand the same JSON as text. Failure setsisErrorand returns{ "error": { "code", "message", "retryable", "details" } }. Agentfy does not readisErrortoday, so the message must make sense to the model on its own. - Shop text is data. Product names and option labels are returned as fields, never merged into instructions. A product called "ignore previous instructions" changes nothing.
- IDs are text (
"42") so the schema stays the same on every platform; money is a decimal string with four places.
Trusted context
What Agentfy sends
| Header | Set by | Store Deputy checks |
|---|---|---|
Authorization: Bearer sdak_… | Agentfy, from the team secret storedeputy:Authorization (works today) | Known, not revoked; gives team, store and profile |
X-Agentfy-Agent-Id | Agentfy runtime | Equals the agent the credential was issued to |
X-SD-Context: sdcg_… | Agentfy runtime, per conversation | Exists, not expired or revoked, issued for this agent and this thread |
X-Agentfy-Thread-Id | Agentfy runtime | Equals the thread the grant was issued for |
X-Agentfy-Turn-Id | Agentfy runtime | Audit only |
X-Agentfy-Tool-Call-Id | Agentfy runtime | Becomes the stable operation key of a change |
X-Agentfy-Initiated-By | Agentfy runtime | human, heartbeat or agent; only human turns may carry a person's grant |
The model sets none of these. The headers ride on the same TLS request as the agent credential, so they are as trustworthy as Agentfy itself; a signed context token is not needed unless a relay is ever placed between Agentfy and Store Deputy.
What Store Deputy derives
On every tool call, before any shop request, Store Deputy turns the headers into one resolved context: team, store, profile, actor and effective scopes. Tool code sees only that result.
| Actor | When | May do |
|---|---|---|
employee | A person opened the conversation in the app; grant names a Store Deputy user | The intersection of the grant, their live team role, the agent's profile, the entitlement and the shop's capabilities |
agent | A scheduled or agent-to-agent turn, no grant | Reads the owner allowed for the agent; never a change that needs a person's approval |
shopper | A visitor opened the storefront chat; grant names a shopper binding | Their own cart only, while the module still confirms the binding |
Changing a role, removing a member, disconnecting the store or revoking a grant takes effect on the next call, because nothing is cached in the grant. A grant from one conversation is refused in another, so two parallel conversations of one agent cannot mix.
What Agentfy does not do yet
These come from reading Agentfy's main on 2 October 2026. They are requirements for STOR-22 and related tasks, to agree with the Agentfy team, not changes to make here.
| Today in Agentfy | Needed |
|---|---|
| MCP calls carry only team-shared static headers; by policy no agent, user or conversation context is sent | Opt-in, per MCP server, the headers listed above, set by the runtime |
| No per-conversation secret | Store a Store Deputy grant per thread, outside the prompt, and send it on that thread's calls |
| Visitor turns get no MCP tools at all | Allow them for a server that is marked as frontend (Stage B) |
isError is not inspected | Treat it as a failed tool step (recommended) |
| Cabinet threads are keyed by Agentfy user | A separate thread per Store Deputy person, so their grants never meet |
| No service credential; creating agents and MCP servers needs a user session | A service-to-service way to provision an agent (STOR-23) |
How Agentfy receives a grant when a conversation starts depends on who opens the conversation, which is still open (see open points). The proposal is that Store Deputy opens it, because the app is where the person signed in.
Existing dev environment audit · 4 October
Dmitriy selected the existing dev.agentfy.ai environment. That is the website. The API base is https://api.dev.agentfy.ai: health returned HTTP 200 with the database up, and OpenAPI published the routes below. This does not prove authenticated provisioning or model execution. Code findings below refer to the inspected Agentfy checkout at 76c4e7ad, not a verified deployed commit.
Already available in the published API: login/registration; teams and members; agent creation; team skills and agent attachment; team MCP server registration, credentials, refresh and attachment; streamed agent runs and private chat history; usage totals by team/agent. There is no reason to rebuild these for the pilot. Existing Store Deputy request fields match the published required fields. Actual permissions and response behavior still need an authenticated integration test.
Pilot setup, before new code
- Create a dedicated Store Deputy service user in the existing Agentfy, with ownership/admin rights only to the integration's teams. A platform administrator is not required for routine provisioning. Use the existing JWT login for this pilot; scoped machine credentials are a separate follow-up.
- Set Store Deputy
AGENTFY_URL=https://api.dev.agentfy.aiand the service login/password as runtime secrets in DO.MCP_PUBLIC_URL=https://api.storedeputy.ai/mcpis already configured. No secrets belong in DOCS or redirects. - Check Agentfy's operator egress ceiling (
RUNTIME_WORKER_EGRESS_ALLOWLIST) and the MCP registration's granted destination: permitapi.storedeputy.ai, without opening unrestricted egress. Register an independent credential per store/agent; team-wide secret storage must not reuse one credential slot across shops. - Check the pilot teams' model tier, an active compatible model credential, quotas and runtime execution. Agentfy already has a model-key pool and settings; do not assume adding one environment key is enough. Health proves database access, not a working model. These operator settings were not visible to this audit.
- Install a release module on a publicly reachable HTTPS test shop, with the matching production pairing public key. Do not expose a development module/key as the pilot integration.
Work required inside Agentfy
| Priority | Deliverable | Acceptance |
|---|---|---|
| Before owner-authorized writes: STOR-22 | Opt-in trusted MCP context per integration/server. Carry an opaque Store Deputy grant outside the prompt, scoped to the authenticated agent and conversation; inject agent/thread/turn/tool-call IDs and initiation type at dispatch. RunAgentDto currently accepts message/timezone/attachmentIds, not such a grant. McpTool.execute explicitly ignores its tool context. Agree the conversation-start/grant binding contract before implementing it. | Concurrent users/stores cannot swap grants; revoked/expired grants fail; the model cannot forge identity headers; heartbeat/agent turns do not inherit human approval; runtime identifiers remain suitable for audit and retry deduplication. |
| Before accepting write results | Preserve MCP isError as a failed invocation in both streaming and non-streaming runs, chat events and audit. The inspected gateway returns raw MCP results, while the tool loop marks a returned result successful if execution did not throw. | A signed module refusal or MCP isError: true never becomes a successful tool step or successful price change; structured evidence reaches Store Deputy. |
| Pilot release gate | Authenticated Store Deputy integration test against this deployed environment; exercise provisioning, tools/list, a real model catalog call, two-user history isolation and retry/recovery. | A team/agent/skill/MCP exists once after retries; correct shop data returns; access removal works; errors are not represented as success. Record deployed versions and evidence. |
| After pilot | Scoped service credentials and an explicit external-user/conversation provisioning API, replacing invited shadow accounts/passwords. | Store Deputy can manage only its tenants, with key rotation/revocation and no platform-admin dependency. |
| Stage B only | Opt-in Frontend Agent MCP access with shopper binding and cart isolation. The current toolset deliberately returns no MCP tools for external turns. | A shopper can access only their own bound cart; unrelated MCP servers remain inaccessible to visitors. Do not remove the global guard without scoped policy. |
Current cabinet conversations are keyed by agent and Agentfy user. Store Deputy uses invited shadow users to keep histories apart; never run every owner's chat under the shared service user. Per-conversation grants must be separate from the server's static team secret.
Usage reporting already exposes tokens/units and per-agent totals. Reconcile it before choosing Store Deputy pricing counters; a complete usage/billing integration is outside the two-week pilot.
Ownership: Yevhen coordinates STOR-22 and the Agentfy-side work; Artem owns the module. Existing Agentfy code and deployments were not modified during this audit. No Jira tickets/statuses were changed or tasks assigned to the Agentfy team by implication.
Worker tools and public internet
13 October 2026: profile revision 2 requests all ten current Agentfy worker tools from code, with internet:unrestricted egress. AGENTFY_WORKER_TOOLS and AGENTFY_WORKER_EGRESS are no longer used. This removes per-domain configuration from Store Deputy. In Agentfy, approve the worker tools (its policy accepts *) and internet:unrestricted in worker destinations; the platform ceiling must also permit it. MCP host approval is separate and unchanged. Private-address protections and store-write approvals remain. A grant does not guarantee every executor or ICMP is available in the deployed worker image.
Existing agents need Update agent after the policy is approved. An update refusal leaves the old revision in place and reports the error; it does not silently broaden platform policy. This is the requested profile, not evidence of a successful dev/production worker run.