Metadata-Version: 2.5
Name: composio-companystack
Version: 0.1.0
Summary: A Composio local toolkit for the CompanyStack API: search UK companies and read company profiles, officers and persons with significant control from the Companies House register.
Project-URL: Homepage, https://companystack.co.uk/developers
Project-URL: Repository, https://github.com/CompanyStackLtd/composio-companystack
Project-URL: Issues, https://github.com/CompanyStackLtd/composio-companystack/issues
Project-URL: Documentation, https://companystack.co.uk/docs
Project-URL: Free API key, https://companystack.co.uk/signup
Author-email: CompanyStack Limited <support@companystack.co.uk>
License-Expression: MIT
License-File: LICENSE
Keywords: companies-house,company-data,companystack,composio,tools,uk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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 :: Financial
Classifier: Typing :: Typed
Requires-Python: <3.15,>=3.10
Requires-Dist: composio<1,>=0.22
Requires-Dist: httpx<1,>=0.25
Requires-Dist: pydantic<3,>=2.7
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

# composio-companystack

A [Composio](https://docs.composio.dev) local toolkit for the [CompanyStack API](https://companystack.co.uk/docs). Agents in a Composio session can search UK companies by name and read a company's register profile, officers and persons with significant control (PSC).

CompanyStack's data is a copy of public registers, mainly the Companies House register. It may be incomplete or out of date. Check anything important against the company's entry at Companies House. CompanyStack is not affiliated with or endorsed by Companies House. Contains public sector information licensed under the Open Government Licence v3.0.

CompanyStack is not in Composio's hosted toolkit catalogue. This package uses Composio's local toolkits, which Composio marks as experimental: the tools run in your own process, with your own CompanyStack key, and Composio passes them to the model alongside its hosted tools.

## Install

```bash
pip install -U composio-companystack
```

## API keys

You need a Composio API key and a CompanyStack API key. Create a CompanyStack account at <https://companystack.co.uk/signup> to get a free key, then set it:

```bash
export COMPANYSTACK_API_KEY="cs_your_key"
export COMPOSIO_API_KEY="your_composio_key"
```

## Use

```python
from composio import Composio
from composio_companystack import build_toolkit

composio = Composio()
companystack = build_toolkit(composio)  # or build_toolkit(composio, api_key="cs_your_key")

session = composio.create(
    user_id="user_1",
    experimental={"local_toolkits": [companystack]},
)
tools = session.tools()
```

Pass `tools` to your agent framework as for any Composio session. The model sees four tools:

| Tool | API call | Plans |
|---|---|---|
| `LOCAL_COMPANYSTACK_SEARCH_COMPANIES` | `GET /company/search` | Free (first 10 results) and above |
| `LOCAL_COMPANYSTACK_GET_COMPANY` | `GET /company/{number}` | Free and above |
| `LOCAL_COMPANYSTACK_GET_OFFICERS` | `GET /officers/company/{number}` | Starter and above, or pay-as-you-go credits |
| `LOCAL_COMPANYSTACK_GET_PERSONS_WITH_SIGNIFICANT_CONTROL` | `GET /psc/company/{number}` | Starter and above, or pay-as-you-go credits |

Each tool returns the API's JSON. If a call fails it returns `{"error": ...}` with a message that says what to do: the upgrade link (also in `upgrade_url`) when the call is not on the key's plan, or where to get a free key when none is set.

The calls also work without Composio:

```python
from composio_companystack import CompanyNumberInput, CompanyStackOperations

ops = CompanyStackOperations()  # reads COMPANYSTACK_API_KEY
print(ops.get_company(CompanyNumberInput(company_number="00445790")))
```

## Plans and limits

From <https://companystack.co.uk/llms.txt>, where current prices and limits are kept:

- **Free:** £0. 1,000 requests a day, 30 a minute. Search companies (top 10 results) and pull a full company profile by number.
- **Starter:** £29/month or £288/year. 10,000 requests a day, 60 a minute. Adds officers, owners (PSC) and filing history, among other things.
- **Pay as you go:** prepaid credits, from £10 for 1,000 credits, for calls your plan does not include. A standard lookup costs 1 credit.

Full details: <https://companystack.co.uk/pricing?product=api>.

## Development

```bash
pip install -e ".[test]"
pytest
```

The tests use a mocked HTTP transport and make no network calls.

## Licence

MIT. See [LICENSE](LICENSE).
