Metadata-Version: 2.5
Name: coco-framework
Version: 0.1.0
Summary: The agent runtime for Coco: core messages, tools, runnables, stateful agent graphs, checkpointers, and model integrations.
Project-URL: Homepage, https://trustcoco.ai
Project-URL: Repository, https://github.com/coco-ai-au/coco-framework
License: MIT License
        
        Copyright (c) LangChain, Inc.
        Copyright (c) 2024 LangChain, Inc.
        Copyright (c) 2026 Coco AI Pty Ltd
        
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
License-File: NOTICE
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 :: 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: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <4.0.0,>=3.10.0
Requires-Dist: aiosqlite>=0.20.0
Requires-Dist: anthropic<2.0.0,>=0.120.0
Requires-Dist: jsonpatch<2.0.0,>=1.33.0
Requires-Dist: openai<4.0.0,>=2.26.0
Requires-Dist: ormsgpack>=1.12.0
Requires-Dist: packaging<27.0.0,>=23.2.0
Requires-Dist: pydantic<3.0.0,>=2.7.4
Requires-Dist: pyyaml<7.0.0,>=5.3.0
Requires-Dist: sqlite-vec>=0.1.6
Requires-Dist: tenacity!=8.4.0,<10.0.0,>=8.1.0
Requires-Dist: tiktoken<1.0.0,>=0.7.0
Requires-Dist: typing-extensions<5.0.0,>=4.7.0
Requires-Dist: uuid-utils<1.0,>=0.12.0
Requires-Dist: xxhash>=3.5.0
Provides-Extra: all
Requires-Dist: aiosqlite>=0.20.0; extra == 'all'
Requires-Dist: anthropic<2.0.0,>=0.120.0; extra == 'all'
Requires-Dist: azure-identity<2.0.0,>=1.15.0; extra == 'all'
Requires-Dist: fastmcp<4.0.0,>=3.1.1; extra == 'all'
Requires-Dist: openai<4.0.0,>=2.26.0; extra == 'all'
Requires-Dist: ormsgpack>=1.12.0; extra == 'all'
Requires-Dist: psycopg-pool>=3.2.0; extra == 'all'
Requires-Dist: psycopg>=3.2.0; extra == 'all'
Requires-Dist: sqlite-vec>=0.1.6; extra == 'all'
Requires-Dist: tiktoken<1.0.0,>=0.7.0; extra == 'all'
Provides-Extra: anthropic
Requires-Dist: anthropic<2.0.0,>=0.120.0; extra == 'anthropic'
Provides-Extra: azure-identity
Requires-Dist: azure-identity<2.0.0,>=1.15.0; extra == 'azure-identity'
Provides-Extra: mcp
Requires-Dist: fastmcp<4.0.0,>=3.1.1; extra == 'mcp'
Provides-Extra: openai
Requires-Dist: openai<4.0.0,>=2.26.0; extra == 'openai'
Requires-Dist: tiktoken<1.0.0,>=0.7.0; extra == 'openai'
Provides-Extra: postgres
Requires-Dist: ormsgpack>=1.12.0; extra == 'postgres'
Requires-Dist: psycopg-pool>=3.2.0; extra == 'postgres'
Requires-Dist: psycopg>=3.2.0; extra == 'postgres'
Provides-Extra: sqlite
Requires-Dist: aiosqlite>=0.20.0; extra == 'sqlite'
Requires-Dist: sqlite-vec>=0.1.6; extra == 'sqlite'
Description-Content-Type: text/markdown

# coco-framework

The agent runtime for Coco: LangChain and LangGraph, forked at pinned commits and
renamed to Coco by one script. Agents built on it get Coco's check on every tool
call from `../coco-sdk`.

```python
from coco.agents import create_agent
from coco_core.tools import tool
from coco_graph.checkpoint.memory import InMemorySaver
from coco_openai import ChatOpenAI
```

## Install

Install the full framework directly with `pip`:

```bash
pip install .                                                   # from a local checkout
pip install -e .                                                # editable development install
pip install "git+https://github.com/coco-ai-au/coco-framework.git"
```

Or use the coco-sdk environment, which installs every library here:

```bash
cd ../coco-sdk && uv sync && source .venv/bin/activate
```

To work on the fork itself or build and publish the distributions:

```bash
python3 scripts/sync_upstream.py --report   # rebuild libs/ from the pins, list leftover upstream names
scripts/dev.sh setup                        # .venv with every library and its test/build tools
scripts/dev.sh test                         # each library's upstream unit tests, renamed
python3 scripts/build.py --clean            # build and verify all 9 trustcoco-* wheels + sdists in dist/
python3 scripts/build.py --include-root     # also build the bundled coco-framework distribution
python3 scripts/build.py --publish          # upload built distributions with twine/uv
```

`sync_upstream.py` needs the upstream clones at the pinned commits in
`build_reference/` above this folder (or `COCO_UPSTREAM_DIR`).

## What is here

| Layer | Distribution | Import | From upstream |
|---|---|---|---|
| Core | `trustcoco-core` | `coco_core` | `langchain-core` 1.6.5 |
| Graph | `trustcoco-graph`, `-prebuilt`, `-checkpoint`, `-checkpoint-sqlite`, `-checkpoint-postgres` | `coco_graph` | `langgraph` 1.2.12 and its libraries |
| Agents | `trustcoco` | `coco` | `langchain` 1.4.2 |
| Models | `trustcoco-openai`, `trustcoco-anthropic` | `coco_openai`, `coco_anthropic` | the two partner packages |

Messages, tools, runnables and prompts; `StateGraph`, the runtime, `interrupt()`
and checkpointers; `create_agent` and its middleware; an OpenAI-compatible and an
Anthropic chat model.

Left out: upstream's hosted-platform clients (`langgraph-sdk`, the CLI,
`RemoteGraph`), its tracing client (`langsmith`, replaced by a local `CocoTracer`
that sends nothing), text splitters, community integrations and JavaScript.

## How the fork is made

`scripts/sync_upstream.py` copies the pinned upstream libraries into `libs/`,
renames modules, distributions, classes and environment variables, removes the
hosted-platform paths, copies Coco's own files from `overlay/`, and applies
`patches/`. It runs again on every upstream bump, and a bump lands only when the
renamed upstream tests pass. Nobody edits `libs/` by hand.

[`UPSTREAM.md`](UPSTREAM.md) lists the pins, every name mapping, every removed
path, overlay file and patch with its reason, and the test results.

## Where Coco attaches

`create_agent` runs every tool call through `wrap_tool_call`. `CocoGuard` from
coco-sdk is that middleware: it runs the call, denies it with a reason, or pauses
the graph with `interrupt()` until a person decides. The session a contract reads
is the graph's thread id. The framework carries no Coco enforcement code, which
keeps the fork mechanical.

## Decisions

| Question | Decided |
|---|---|
| Compatibility with upstream integrations | A clean rename. Upstream partner packages import `langchain_core` and do not load here; we fork a provider when a design partner needs one |
| Package names | `trustcoco-*` distributions, `coco*` imports. PyPI on the day we open source |
| Guard on by default | Yes, once the SDK is stable: `create_agent` installs `CocoGuard` in Monitor, with a logged opt out. Not built yet |
| Upstream cadence | Pinned. Bump for a fix we need; review the gap each quarter |

Publishes as wheels to Coco's private package index by `scripts/build.py --publish`
(or `coco-sdk/scripts/publish.sh`); the install is in coco-sdk's README. PyPI on the
day we open source.

## Licence

MIT. `LICENSE` keeps "Copyright (c) LangChain, Inc." beside ours, and `NOTICE`
names what derives from upstream. The Coco name replaces theirs everywhere else.
