coactra
Component-based composition library for agentic systems. Coactra is Team-first: Team owns agent registration, policy, and model resolution, while Agent remains a thin runtime shell over pydantic-ai.
pip install "coactra[agent]"
Common extras:
pip install "coactra[agent-gateway,oauth]" # MCP gateway and OAuth
pip install "coactra[graphiti]"
pip install "coactra[mem0]"
Small Surface
from coactra import Team, Scope, Policy, Skill
Submodule helpers when wiring backends:
from coactra.agent import MCPServer
Use the root surface for application code. Use lower-level modules only for backends and host runtime wiring:
coactra.agentfor event/runtime types and outbound A2A transport (coactra.agent.backends)coactra.team.directoryfor org/member/seat persistencecoactra.memoryandcoactra.workspacefor backend integration
Threads
A Thread is one conversation: a Scope-keyed message log that any agent in the
same tenant can continue. Pass it to send()/run() — each finished run replaces
the thread's messages with the full history, so handoffs keep context.
from coactra import InMemoryThreadStore, Scope, Thread
store = InMemoryThreadStore()
scope = Scope(tenant_id="local", session_id="chat-42")
thread = await store.load(scope) or Thread(scope=scope)
await agent.run("Where did we leave off?", thread=thread)
await reviewer.run("Continue the plan.", thread=thread) # same history, other agent
await store.save(thread) # persistence is explicit; hosts implement ThreadStore
Thread messages are opaque runtime objects. For JSON persistence with the default
pydantic-ai runtime, use dump_messages / load_messages from
coactra.agent.runtime. Threads are the verbatim conversation log; memory stays
the long-term extracted store — the two are independent.
Governance
Gate dangerous tools behind human approval, cap usage per run, and cancel runs:
from coactra import AgentSpec, Limits, Scope, Thread
spec = AgentSpec(
name="coder",
model="openai:gpt-5",
tools=[shell, read_file],
require_approval=("shell",), # these tools pause for a human
limits=Limits(total_tokens=200_000), # per-run cap; send(limits=...) overrides
)
thread = Thread(scope=Scope(tenant_id="local", session_id="job-7"))
result = await (await agent.send("fix the build", thread=thread)).wait()
if result.status == "paused":
# show result.pending (tool name + args) to a human, then:
approvals = {p.id: True for p in result.pending} # False denies
result = await (await agent.resume(approvals, thread=thread)).wait()
run = await agent.send("long job", thread=thread)
run.cancel() # interrupts wait(); streams stop at the next event boundary
A Policy also governs tools: when policy.check returns requires_approval
for action="tool:call", that tool is gated; deny removes it from the agent.
The pause lives entirely in the thread's messages, so any same-tenant agent can
resume it — even after a process restart, via your ThreadStore.
Bring Existing Pieces
import asyncio
import os
from coactra import Team
from coactra.agent import MCPServer
async def main() -> None:
team = Team.local(
tenant_id="local",
namespace="default",
capability="existing-stack",
model="openai/qwen3.6-plus",
api_base="https://opencode.ai/zen/go/v1",
api_key=os.environ["OC_KEY"],
)
agent = await team.add_agent(
name="existing-stack-agent",
tools=[MCPServer(url="https://tools.example/mcp", name="tools")],
memory="inprocess",
workspace="./desk",
)
try:
print(await agent.run("Use my existing stack"))
finally:
await agent.aclose()
asyncio.run(main())
See examples/acceptance/ for the checked examples that define the alpha acceptance path.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coactra-0.6.0.tar.gz.
File metadata
- Download URL: coactra-0.6.0.tar.gz
- Upload date:
- Size: 140.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98a143cd3d7062ec9898591306e6dc69ea54c7ff2ba9bf96d2d547d683568309
|
|
| MD5 |
cc92f99077cc5ed339c93950e5740612
|
|
| BLAKE2b-256 |
83681c9a862ba8862b45b79bacce8491ce57f86b784c98cfbc951bcd21f2feef
|
Provenance
The following attestation bundles were made for coactra-0.6.0.tar.gz:
Publisher:
release.yml on DataOpsFusion/coactra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coactra-0.6.0.tar.gz -
Subject digest:
98a143cd3d7062ec9898591306e6dc69ea54c7ff2ba9bf96d2d547d683568309 - Sigstore transparency entry: 2584648282
- Sigstore integration time:
-
Permalink:
DataOpsFusion/coactra@b4dd46131a0bac6010c45a38d0ac83a33a5bfa2c -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/DataOpsFusion
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b4dd46131a0bac6010c45a38d0ac83a33a5bfa2c -
Trigger Event:
push
-
Statement type:
File details
Details for the file coactra-0.6.0-py3-none-any.whl.
File metadata
- Download URL: coactra-0.6.0-py3-none-any.whl
- Upload date:
- Size: 123.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c07332971a2039866807338b4daac6f3590e125cb1658139fee9d4900c8a714f
|
|
| MD5 |
bd568ce6b16630067944ced82f91cfa6
|
|
| BLAKE2b-256 |
667da839a7425a02a9959b96c1b69ccd15fd0accdc3a6c52fe78be2106949fac
|
Provenance
The following attestation bundles were made for coactra-0.6.0-py3-none-any.whl:
Publisher:
release.yml on DataOpsFusion/coactra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
coactra-0.6.0-py3-none-any.whl -
Subject digest:
c07332971a2039866807338b4daac6f3590e125cb1658139fee9d4900c8a714f - Sigstore transparency entry: 2584648495
- Sigstore integration time:
-
Permalink:
DataOpsFusion/coactra@b4dd46131a0bac6010c45a38d0ac83a33a5bfa2c -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/DataOpsFusion
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b4dd46131a0bac6010c45a38d0ac83a33a5bfa2c -
Trigger Event:
push
-
Statement type: