Metadata-Version: 2.4
Name: talocode-calclane
Version: 0.3.0
Summary: CalcLane — open calculator engine for agents. Local evaluate + hosted Talocode API SDK/CLI.
Author: Talocode
License: MIT
Project-URL: Homepage, https://github.com/talocode/calclane
Project-URL: Documentation, https://docs.talocode.site
Project-URL: Repository, https://github.com/talocode/calclane
Project-URL: Issues, https://github.com/talocode/calclane/issues
Project-URL: PyPI, https://pypi.org/project/talocode-calclane/
Keywords: calculator,calclane,scientific-calculator,talocode,agents,mcp,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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 :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# CalcLane (Python)

**Open calculator for agents** — local expression evaluation plus hosted Talocode API client.

Part of **[Talocode](https://talocode.site)** — open tools people trust; hosted power under [docs.talocode.site](https://docs.talocode.site).

| | |
|--|--|
| **Cloud API** | `https://api.talocode.site` → `/v1/calclane/*` |
| **Python** | `pip install talocode-calclane` (this package) |
| **Node** | `npm install @talocode/calclane` |
| **Repo** | [github.com/talocode/calclane](https://github.com/talocode/calclane) |
| **License** | MIT |

---

## Why CalcLane?

Agents need **deterministic math** as a tool, not a free-form LLM guess:

- **Structured JSON** — `ok`, `result`, `display`, `mode`, `error`
- **Local free path** — stdlib evaluator, no network
- **Hosted path** — same contract on Talocode Cloud (**1 credit** per evaluate)
- **CLI** — `calclane eval "2+3*4"`

---

## Install

```bash
pip install talocode-calclane
```

Requires **Python 3.10+**. Stdlib only (no extra runtime deps).

---

## Quickstart

```python
import os
from calclane import CalcLaneClient

client = CalcLaneClient()

# Local (free)
print(client.evaluate("2 + 3 * 4"))
print(client.evaluate("sin(90)", angle="deg"))
print(client.evaluate("5!"))

# Hosted API (1 credit) — needs TALOCODE_API_KEY
cloud = CalcLaneClient(
    api_key=os.environ["TALOCODE_API_KEY"],
    prefer_local=False,
)
print(cloud.evaluate_remote("sqrt(144)"))
```

### Environment

| Variable | Default | Purpose |
|----------|---------|---------|
| `TALOCODE_API_KEY` | — | Bearer token for hosted routes |
| `TALOCODE_BASE_URL` | `https://api.talocode.site` | API host |

---

## CLI

```bash
calclane eval "2^10"
calclane eval "sin(90)" --angle deg
calclane health
calclane pricing
calclane eval "pi*2" --remote   # hosted, 1 credit
```

Or: `python -m calclane eval "..."`.

---

## API surface

| Method | Path | Credits |
|--------|------|---------|
| GET | `/v1/calclane/health` | free* |
| GET | `/v1/calclane/pricing` | free* |
| GET | `/v1/calclane/capabilities` | free* |
| POST | `/v1/calclane/evaluate` | **1** |
| POST | `/v1/calclane/dispatch` | **1** |

\*Valid API key required; no credit charge.

Auth: `Authorization: Bearer $TALOCODE_API_KEY` or `X-Api-Key`.

---

## Related packages

| Package | Install |
|---------|---------|
| This package | `pip install talocode-calclane` |
| Node SDK / CLI | `npm i @talocode/calclane` |
| SearchLane | `pip install talocode-searchlane` |
| StackLane | `pip install talocode` |
| Tera | `pip install talocode-tera` |

---

## Talocode ecosystem

| Project | What it is |
|---------|------------|
| [Codra](https://github.com/talocode/codra) | Local-first agentic coding · `pip install talocode-codra` |
| [Tera](https://github.com/talocode/tera) | AI learning companion · `pip install talocode-tera` |
| [Stacklane](https://github.com/talocode/stacklane) | Cloud control plane · `pip install talocode` |
| [SearchLane](https://github.com/talocode/searchlane) | Agent web search · `pip install talocode-searchlane` |
| [DocuLane](https://github.com/talocode/doculane) | Office documents · `pip install talocode-doculane` |
| [ContextLane](https://github.com/talocode/contextlane) | Context tooling · `pip install contextlane` |
| [Tradia](https://github.com/talocode/tradia) | Trading agents · `pip install tradia` |
| **[CalcLane](https://github.com/talocode/calclane)** (this package) | Open calculator · `pip install talocode-calclane` |

More: [github.com/talocode](https://github.com/talocode) · [talocode.site](https://talocode.site) · [docs.talocode.site](https://docs.talocode.site)

---

## License

MIT © Talocode
