Skip to main content

Copass context-engineering primitives (retrieval tools, ingest tool, Context Window turn recorder) for copass-core-agents

Project description

copass-context-agents

Copass context-engineering primitives for copass-core-agents.

Three provider-neutral pieces every Copass-aware agent uses:

  • copass_retrieval_tools(...) — returns discover / interpret / search as AgentTool instances, window-aware when a ContextWindow is passed.
  • copass_ingest_tool(...) — returns ingest as an AgentTool so agents can promote content into durable sandbox storage.
  • CopassTurnRecorder — mirrors user / assistant turns into a ContextWindow with fire-and-forget pushes and typed speaker / participants metadata.

These are the primitives the provider adapter packages — copass-anthropic-agents, copass-google-agents — compose into their run() / stream() loops. The descriptions come from copass_config so every Copass surface (TS adapters, MCP server, CLI) shows the LLM identical tool semantics.

Install

pip install copass-context-agents

Usually a transitive dep — pip install copass-anthropic-agents / copass-google-agents pulls it in.

Usage

from copass_core import CopassClient
from copass_context_agents import (
    copass_retrieval_tools,
    copass_ingest_tool,
    CopassTurnRecorder,
)

client = CopassClient(...)
window = await client.context_window.create(sandbox_id=sandbox_id)

tools = [
    *copass_retrieval_tools(client=client, sandbox_id=sandbox_id, window=window),
    copass_ingest_tool(
        client=client,
        sandbox_id=sandbox_id,
        data_source_id=my_source_id,
        default_source_type="decision",
        author="agent:support-bot",
    ),
]

recorder = CopassTurnRecorder(window=window, author="agent:support-bot")
# ...wire into your provider's stream loop; see copass-anthropic-agents or
# copass-google-agents for the full wiring.

See the provider adapter packages for the full CopassManagedAgent / CopassGoogleAgent integrations that wire these primitives into discover-as-step-1 + auto-record flows.

Speaker, participants, and provenance

CopassTurnRecorder populates the typed envelope fields on every turn it pushes through the underlying ContextWindow:

Constructor arg Default Effect
author None Forwarded as the envelope's speaker field on assistant turns (and as ChatMessage.name on the recorded turn). When unset, assistant turns get speaker="Assistant" from the role-derived fallback.
user_speaker "User" Speaker label on user turns. Set to a richer identity when you have one (e.g. logged-in user's display name).
participants ["User", author or "Assistant"] Conversation roster forwarded as the envelope's participants field on every turn. Pass an explicit list to override; pass [] to opt out entirely.
include_author_prefix False Legacy — when True, also embeds [author=…]\n in the body string. The typed envelope path is the supported way to carry provenance now; this flag exists for backward compat with body-reading consumers and is off by default.
# Typical setup — typed speaker + auto-derived roster
recorder = CopassTurnRecorder(
    window=window,
    author="agent:support-bot",
    # participants defaults to ["User", "agent:support-bot"]
)

# Multi-party — set the roster explicitly
recorder = CopassTurnRecorder(
    window=window,
    author="agent:support-bot",
    user_speaker="Alice",
    participants=["Alice", "agent:support-bot", "system"],
)

# Opt out of participants entirely
recorder = CopassTurnRecorder(
    window=window,
    author="agent:support-bot",
    participants=[],
)

The same author flows through copass_ingest_tool as the envelope's speaker on every tool-driven ingestion. No body-prefix munging — the caller's content is sent verbatim.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

copass_context_agents-1.2.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

copass_context_agents-1.2.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file copass_context_agents-1.2.1.tar.gz.

File metadata

  • Download URL: copass_context_agents-1.2.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for copass_context_agents-1.2.1.tar.gz
Algorithm Hash digest
SHA256 389636d5a0b527fa725d58d1231c7f8865e3d7475f482f42af99893dfba7868a
MD5 822219c99ab89089d549f3d8e5627d97
BLAKE2b-256 6e696f5fb2db7f5f11c67e08aace3179e792f27d3b57ab7e0d71ece2c9a18196

See more details on using hashes here.

Provenance

The following attestation bundles were made for copass_context_agents-1.2.1.tar.gz:

Publisher: release-python.yml on olane-labs/copass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file copass_context_agents-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for copass_context_agents-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36998de0a1f5db9a312dbfac745c9d99ad280f5d816c6062863a2dda65eef7dc
MD5 a9fe5f15b79031753db3eb1104af6163
BLAKE2b-256 cedc5761cce138f7aef25ad32ea25005a2c309018916fff57b4c7d85dacee025

See more details on using hashes here.

Provenance

The following attestation bundles were made for copass_context_agents-1.2.1-py3-none-any.whl:

Publisher: release-python.yml on olane-labs/copass

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page