Download the PHP package mage-os/module-claude-consumer-agent without Composer

On this page you can find all versions of the php package mage-os/module-claude-consumer-agent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package module-claude-consumer-agent

MageOS_ClaudeConsumerAgent

A shopping assistant for Hyvä and Luma storefronts on Magento 2 and Mage-OS. It ports Anthropic's open-source shopping agent to a Magento module. The assistant searches the catalog, explains products, adds them to the cart, checks orders and answers policy questions from the store's own data. Replies stream from the Claude Messages API into a side panel on every page.

The module names no store. Every backend call goes through Api\StorefrontBackendInterface, so a store layer can replace or extend any part without a change to the base module.

What the customer gets

Start screen Configurable product Added to cart
Category page context Store fact answer Phone
Luma Luma phone

Requirements

Installation

For development, clone the repository into app/code/MageOS/ClaudeConsumerAgent instead of the composer require.

setup:upgrade creates the tables aiagent_session, aiagent_message and aiagent_turn.

Hyvä

Then rebuild the theme CSS. hyva:config:generate registers the module in app/etc/hyva-themes.json, so the theme build picks up the module templates and its Tailwind source:

Finish with bin/magento cache:flush. In production mode also run bin/magento setup:static-content:deploy.

Luma

In production mode also run bin/magento setup:static-content:deploy. Luma needs no Tailwind build and no hyva:config:generate.

Configuration

Stores > Configuration > Services > AI Integration > Shopping Assistant. Every field has default, website and store view scope. Config paths start with ai_integration/aiagent/.

General

Model

API key (stored encrypted, never sent to the browser), model id, max tokens, thinking effort, request timeout and connect timeout.

Voice

Content

Product Cards

Yes/No for each part of a product card: image, price, short description, stock status, Add to cart and the assistant's reason.

Limits

Caps on load and cost: concurrent turns per store view, turns per session and per IP, tool rounds per turn, cart quantities and lines, message length, search results, fenced characters and the prompt size that triggers compaction. Turn Wall Clock is the number of seconds one reply may keep calling tools. When it runs out, the assistant answers with what it has.

A running turn holds one PHP-FPM worker. Size pm.max_children above concurrent_turns per store view on the pool, plus normal traffic.

Privacy

Hidden settings

These paths have defaults in etc/config.xml and no admin field. Set them with bin/magento config:set.

Path Default Meaning
ai_integration/aiagent/runtime/first_byte_threshold 4 Seconds the browser waits for the first streamed byte before it switches the session to JSON replies
ai_integration/aiagent/runtime/heartbeat_seconds 10 Interval of : ping comments while a model call runs
ai_integration/aiagent/lexicon/policy_intent_terms word list Words that force the policy tool
ai_integration/aiagent/lexicon/order_intent_terms word list Words that force the order lookup

How a turn works

  1. The browser posts session, message, page and stream to POST /aiagent/turn/index with the form key in the X-Form-Key header.
  2. Grounding rules run before the model. A store fact keyword answers from the fact. A policy or order phrase forces that tool. A token that matches an existing SKU forces a product read. A first message on a product page reads that product.
  3. The orchestrator calls the model with the static system prompt (voice, catalog map, store facts, tool list) and the session context (cart, customer, page). Tool calls run against the store through Api\StorefrontBackendInterface:
    • catalog: search_products, search_categories, get_product_details
    • cart: get_cart, add_to_cart, update_cart_item, remove_from_cart
    • orders and store: get_orders, get_order_status, search_policies, get_fulfillment_options
    • memory and skills: get_preferences, save_memory, recall_memories, load_skill
    • cards: present_products, present_comparison, present_order_status, checkout, present_suggestions
  4. Gates check every cart write. A configurable product needs every option named by the customer in the conversation. Required custom options must be set. Quantities and line counts stay under the limits. A refused write goes back to the model as a held outcome, so it asks instead of guessing.
  5. Events stream to the browser: text deltas, tool status lines, cards, suggestion chips, then turn_complete with the token usage. The session, the messages and a turn log row are saved.

Page context

Every request carries a page object: page_type (home, search, product, category, cart, orders or other), product_id, product_name, query, category_id and category_name. The server detects the page from the full action name (Model\Surface\PageDetector). When the page changes between turns, a hidden [Page: ...] note is prepended to the customer message.

Catalog map

Model\Agent\Prompt\CatalogMap prints the category tree with ids into the static prompt, so the model can pass a category_id to search_products. search_categories finds deeper categories by keyword. The map is rebuilt when a category is saved, deleted or moved.

search_products accepts a query, a category_id, or both. filters.sort takes price_asc, price_desc or best_sellers. Best sellers rank by units sold over the last two years (Api\Backend\BestsellerRankInterface).

Sale pricing

A product record carries price, what the customer pays now, and an optional original_price when the item is marked down: the regular price, present only when it is at least 0.01 higher than price. A record without original_price is not on sale.

Custom options

Core Magento custom options are part of every product record (custom_options). The model sets them through add_to_cart as options {"<option title>": "<value title>"}. Drop-down, radio, checkbox, multi-select, text and textarea options work in the panel. File, date and time options hand the customer to the product page. The card then shows Choose options instead of Add to cart.

Streaming and the JSON fallback

POST /aiagent/turn/index streams Server-Sent Events by default: a : open comment first, one frame per event (event: <type>\ndata: <json>\n\n), : ping heartbeats, then event: turn_complete. A client can send {"stream": 0} and receive the same events as one JSON body after the turn.

A buffering proxy defeats SSE. Checks and fixes:

The browser switches a session to JSON replies on its own when the first byte takes longer than first_byte_threshold seconds. If the proxy cannot be fixed, set Streaming Replies to Off.

Health check through the proxy:

Expect : open within 200 ms, then event frames, then event: turn_complete. A body that arrives all at once after several seconds means a buffering proxy.

Commands

Logging and privacy

var/log/aiagent.log gets one INFO line per model call (round, model, stop reason, token counts, elapsed time), INFO lines on limits and WARNING lines on tool failures, version conflicts and retries.

The transcript tables hold full conversation content. Retention Days bounds their life, and aiagent:session:purge is the manual escape hatch. aiagent_turn keeps one row per turn with the four usage fields the API reports, duration and stop reason. No dollar amounts are computed anywhere.

Lazy loading

On Hyvä every page carries the config store (js/store.phtml), the launcher and, where enabled, the product and cart ask buttons. The panel, the drawer and every card sit inside <template data-ai-agent-shell> elements. Alpine.store('aiAgent').mount() loads view/frontend/web/js/aiagent.js once and clones the shells into the document the first time the assistant opens.

On Luma every page carries a small config init (js/luma/init), the launcher and an empty scope: 'aiAgentPanel' element. The first open loads js/luma/view/panel.js, registers it through uiLayout and fetches its Knockout templates.

Extension points

A store layer adds behaviour through interfaces and DI pools, never through a preference on a base concrete class.

  1. Backend swap per method group. Model\Backend\MagentoStorefront delegates to one interface per method group. Replace one with a preference:

    The same works for CatalogMapProviderInterface, CategorySearchProviderInterface, BestsellerRankInterface, ProductOptionsProviderInterface, SkuMatcherInterface, PolicySourceInterface, FulfillmentProviderInterface and OrderStatusMapperInterface.

  2. Tools. Api\Tool\ToolProviderInterface items pool on Model\Agent\Tool\Registry:

  3. Cards. Api\Presentation\PresentationExtensionInterface items pool on Model\Agent\Presentation\Registry under <argument name="extensions">. The extension registers its own Alpine component the same way aiagent.js registers the built-in ones. Custom card components render on Hyvä only. Luma skips unknown components.

  4. Core facts. Api\Prompt\CoreFactProviderInterface items pool on Model\Agent\Prompt\CoreFacts under <argument name="providers">.

  5. Lexicon and skills. Model\Agent\Lexicon takes additionalPolicyTerms and additionalOrderTerms arrays. Model\Agent\Skill\Loader takes directories items (module, path, sortOrder) for extra skill folders.

  6. Cart writes. Api\Cart\BuyRequestBuilderInterface builds the DataObject that Quote::addProduct() receives. Replace it or decorate it with a plugin.

  7. Templates. Every surface and card template resolves through the theme fallback. Override by path in a child theme under MageOS_ClaudeConsumerAgent/templates/. Luma Knockout templates live under MageOS_ClaudeConsumerAgent/web/template/luma/.

  8. Product image URLs. Api\Backend\ProductImageUrlInterface::forProduct() resolves the image URL for a product card or cart item. The default Model\Backend\Provider\HelperImageUrl calls the core image helper; replace it with a preference to source URLs from elsewhere (a CDN, a partial media mirror). Returning null falls back to the helper result:

  9. Config. Model\Config\StoreConfig::agent() resolves every field at store view scope. A store layer adds fields under its own section and reads them itself.

Tests

License

Open Software License (OSL) 3.0, see LICENSE.


All versions of module-claude-consumer-agent with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
ext-intl Version *
ext-json Version *
magento/framework Version *
magento/module-store Version *
magento/module-checkout Version *
magento/module-catalog Version *
magento/module-configurable-product Version *
magento/module-quote Version *
magento/module-customer Version *
magento/module-sales Version *
magento/module-cms Version *
magento/module-config Version *
magento/module-offline-shipping Version *
magento/module-search Version *
magento/module-payment Version *
magento/module-shipping Version *
guzzlehttp/guzzle Version ^7.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mage-os/module-claude-consumer-agent contains the following files

Loading the files please wait ...