Metadata-Version: 2.5
Name: langchain-crossly
Version: 0.1.0
Summary: LangChain tools for Crossly: search, crosspost and delist listings, manage inventory, ship orders, answer offers and read sales across eBay, Poshmark, Mercari, Depop and more.
Project-URL: Homepage, https://crossly.net
Project-URL: Documentation, https://github.com/crossly-dev/langchain-crossly#readme
Project-URL: Source, https://github.com/crossly-dev/langchain-crossly
Project-URL: Issues, https://github.com/crossly-dev/langchain-crossly/issues
Project-URL: Changelog, https://github.com/crossly-dev/langchain-crossly/blob/main/CHANGELOG.md
Project-URL: API docs, https://crossly.net/docs/api-quickstart
Author-email: Crossly <support@crossly.net>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,crosslisting,crossly,depop,ebay,langchain,mercari,poshmark,reselling,tools
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Office/Business
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1.0.0,>=0.25.0
Requires-Dist: langchain-core<2.0.0,>=1.0.0
Requires-Dist: pydantic<3.0.0,>=2.7.4
Description-Content-Type: text/markdown

# langchain-crossly

[![PyPI](https://img.shields.io/pypi/v/langchain-crossly)](https://pypi.org/project/langchain-crossly/)
[![ci](https://github.com/crossly-dev/langchain-crossly/actions/workflows/ci.yml/badge.svg)](https://github.com/crossly-dev/langchain-crossly/actions/workflows/ci.yml)

LangChain tools for [Crossly](https://crossly.net), the crosslisting platform for resellers. With them an agent
can work a seller's Crossly account: find and price listings, crosspost them to eBay, Poshmark, Mercari, Depop,
Etsy and other marketplaces, delist, keep stock counts right, ship orders, answer offers and read the sales
numbers.

## Installation

```bash
pip install -U langchain-crossly
```

Python 3.10 or newer, `langchain-core` 1.x.

## Credentials

The tools authenticate with a Crossly **Personal Access Token** (it starts with `crossly_pat_`). Create one in
Crossly under **Settings → Developer** ([create a free account](https://crossly.net/register)), then set it as
`CROSSLY_API_KEY`:

```bash
export CROSSLY_API_KEY="crossly_pat_..."
```

or pass it in code: `CrosslyToolkit(api_key="crossly_pat_...")`. The token's scopes limit what the tools can do;
a read-only token is enough for the read-only toolkit below.

`CROSSLY_BASE_URL` (default `https://crossly.net/api`) points the tools at another server, for example the
[Crossly mock API](https://github.com/crossly-dev/crossly-mock) in tests.

## Toolkit

```python
from langchain_crossly import CrosslyToolkit

toolkit = CrosslyToolkit()
tools = toolkit.get_tools()

for tool in tools:
    print(tool.name)
```

| Tool | What it does |
| --- | --- |
| `crossly_search` | Search inventory, listings, orders, sales, customers and offers at once (SKU, order number, URL, title…) |
| `crossly_list_listings` | List listings across marketplaces, filtered by status, marketplace or SKU |
| `crossly_get_listing` | One listing with every marketplace copy, its status, URL and any publish error |
| `crossly_create_draft_listing` | Save an item to inventory as an unlisted draft |
| `crossly_update_listing_price` | Change a price on every marketplace, or only the ones named |
| `crossly_crosspost_listing` | Publish a listing or a draft item to one or more marketplaces |
| `crossly_delist_listing` | **Destructive.** End a listing everywhere, or on the marketplaces named |
| `crossly_list_inventory` | List inventory items with quantities and where each is listed |
| `crossly_adjust_inventory_quantity` | Change available stock by a delta or to a count, with a reason |
| `crossly_list_orders` | List orders with prices, fees, buyer and shipping status |
| `crossly_get_order` | One order with line items, address and tracking |
| `crossly_mark_order_shipped` | Mark an order shipped and upload tracking to the marketplace |
| `crossly_list_offers` | Offers on Crossly Shop listings, or marketplace conversations waiting on a reply |
| `crossly_respond_to_offer` | **Destructive.** Accept, decline or counter an offer |
| `crossly_get_sales_summary` | Sales, units, revenue, fees, net sales and net profit for the last N days |

Every tool returns the API's JSON response as a string. Errors (a missing token, an unknown id, a marketplace
that isn't connected) come back as the tool's output, so the agent can fix its arguments or tell the user.

### Choosing tools

```python
# Only tools that read data: nothing is listed, repriced, shipped or answered.
CrosslyToolkit(read_only=True).get_tools()

# Everything except the destructive tools (delist, respond to offer).
CrosslyToolkit(include_destructive=False).get_tools()

# A hand-picked set.
CrosslyToolkit(selected_tools=["crossly_list_orders", "crossly_mark_order_shipped"]).get_tools()
```

Each tool also has a `destructive` attribute, so you can put the destructive ones behind a human approval step
(for example LangChain's human-in-the-loop middleware).

### Using one tool

```python
from langchain_crossly import CrosslyListListingsTool

tool = CrosslyListListingsTool()
print(tool.invoke({"status": "active", "platform": "ebay", "sort_by": "days_listed", "sort_order": "desc", "limit": 5}))
```

Tools are also async: `await tool.ainvoke({...})`.

## Use within an agent

```python
from langchain.agents import create_agent
from langchain_crossly import CrosslyToolkit

tools = CrosslyToolkit(include_destructive=False).get_tools()

agent = create_agent(
    "anthropic:claude-sonnet-4-5",
    tools,
    system_prompt="You help a reseller run their Crossly store. Prices are in dollars.",
)

result = agent.invoke(
    {"messages": [("user", "Which of my eBay listings have been up longest? Drop the oldest one by 10%.")]}
)
print(result["messages"][-1].content)
```

Any chat model with tool calling works; install its LangChain package (here `langchain-anthropic`) and `langchain`.

### Prefer MCP?

Crossly also runs a hosted MCP server with the full API at `https://crossly.net/mcp`
([crossly-mcp](https://github.com/crossly-dev/crossly-mcp)). Use it with `langchain-mcp-adapters` when you want
every endpoint rather than this focused tool set.

## Development

```bash
uv sync --group test
uv run pytest tests/unit_tests                     # mocked HTTP + langchain-tests standard unit tests
CROSSLY_API_KEY=crossly_pat_... uv run pytest tests/integration_tests   # read-only tools against the live API
```

The integration tests only call read-only tools and are skipped when `CROSSLY_API_KEY` is not set.

## Releases

Pushing a `v*` tag builds, tests and publishes to PyPI with signed build provenance. Check a downloaded file
with:

```bash
gh attestation verify langchain_crossly-0.1.0-py3-none-any.whl --repo crossly-dev/langchain-crossly
```

## Links

- Crossly API quickstart: https://crossly.net/docs/api-quickstart
- Python SDK: https://github.com/crossly-dev/crossly-python
- CrewAI tools: https://github.com/crossly-dev/crewai-crossly
- Issues: https://github.com/crossly-dev/langchain-crossly/issues

MIT licensed.
