Connect Shelfforce to AI agents, LLMs, and automated pipelines using OpenAPI, llms.txt, and webhooks.
Shelfforce is designed for machine-to-machine integration. Whether you are building an AI agent with Claude, GPT, or an open-source model, Shelfforce provides everything needed for automatic tool discovery, reliable execution, and event-driven workflows.
The full OpenAPI 3.1 specification is available at:
Copy
https://docs.shelfforce.ai/openapi.json
Use this spec for automatic tool generation in frameworks like LangChain, CrewAI, AutoGen, or the OpenAI/Anthropic function calling APIs. The spec includes all endpoints, request/response schemas, authentication requirements, and example values.
For LLM context injection, Shelfforce publishes an llms.txt file:
Copy
https://shelfforce.ai/llms.txt
This file describes Shelfforce capabilities, endpoints, and usage patterns in natural language — optimized for LLM comprehension. Include it in your agent’s system prompt or retrieval context to help the model understand how to use the API.A more detailed version is available at:
Here is an example tool definition for Claude or GPT function calling that covers the core analysis workflow:
Claude (Anthropic)
OpenAI (GPT)
Copy
{ "name": "analyze_shelf", "description": "Submit a retail shelf image for analysis. Returns detected products with brand, name, facings, price, and share-of-shelf data. Costs 1 credit per image. Results take 10-30 seconds.", "input_schema": { "type": "object", "properties": { "imageUrl": { "type": "string", "description": "Publicly accessible URL of a retail shelf image (JPEG, PNG, or WebP)." }, "metadata": { "type": "object", "description": "Optional key-value pairs to attach to the analysis (e.g., store name, aisle).", "additionalProperties": { "type": "string" } } }, "required": ["imageUrl"] }}
Copy
{ "type": "function", "function": { "name": "analyze_shelf", "description": "Submit a retail shelf image for analysis. Returns detected products with brand, name, facings, price, and share-of-shelf data. Costs 1 credit per image. Results take 10-30 seconds.", "parameters": { "type": "object", "properties": { "imageUrl": { "type": "string", "description": "Publicly accessible URL of a retail shelf image (JPEG, PNG, or WebP)." }, "metadata": { "type": "object", "description": "Optional key-value pairs to attach to the analysis (e.g., store name, aisle).", "additionalProperties": { "type": "string" } } }, "required": ["imageUrl"] } }}
Additional tool definitions your agent may need:
Copy
[ { "name": "get_analysis", "description": "Get the status and results of a shelf analysis by ID. Returns products array when status is 'completed'.", "input_schema": { "type": "object", "properties": { "analysisId": { "type": "string", "description": "The analysis ID returned from analyze_shelf." } }, "required": ["analysisId"] } }, { "name": "get_share_of_shelf", "description": "Get aggregated share-of-shelf report for a date range. Returns brand-level facing percentages.", "input_schema": { "type": "object", "properties": { "from": { "type": "string", "description": "Start date in ISO 8601 format." }, "to": { "type": "string", "description": "End date in ISO 8601 format." } }, "required": ["from", "to"] } }, { "name": "create_task", "description": "Create a field task for a store visit. Assign to a place with optional due date and instructions.", "input_schema": { "type": "object", "properties": { "title": { "type": "string", "description": "Task title." }, "placeId": { "type": "string", "description": "Store/place ID." }, "dueDate": { "type": "string", "description": "ISO 8601 due date." }, "instructions": { "type": "string", "description": "Instructions for the field rep." } }, "required": ["title", "placeId"] } }]
Idempotency is critical for AI agents, which may retry requests due to timeouts, network errors, or reasoning loops. Always include an idempotency key with analysis requests:
If the same idempotency key is sent again within 24 hours, Shelfforce returns the existing analysis rather than creating a duplicate. This prevents wasted credits and duplicate data.
Without idempotency keys, agent retries will create duplicate analyses and consume additional credits. Always include them in automated pipelines.
Agent → POST /analyses → get ID → loop GET /analyses/{id} until completed → process results
Polling is straightforward and works well for agents that maintain a single execution thread. Poll every 3-5 seconds. Analyses typically complete in 10-30 seconds.
Webhook-driven (more efficient, better for production)
Copy
Agent → POST /analyses → return to other work → webhook fires → agent resumes with results
Webhooks are more efficient for production systems that process many images. Register a webhook for analysis.completed, and your system receives the results as soon as they are ready — no wasted requests.
For agents that need to wait for results inline (e.g., in a tool call), polling is simpler. For background pipelines or multi-step workflows, webhooks are recommended.
A Model Context Protocol (MCP) server for Shelfforce is on the roadmap. This will allow Claude Desktop, Cursor, and other MCP-compatible clients to discover and use Shelfforce tools automatically.