Skip to main content

Brown Octopus

Brown Octopus is a Python library for dynamic capability-context management for tool-using AI agents. It determines which capability definitions should be available to an agent on each interaction. It does not execute tools, manage credentials, or replace the host agent framework.

Install

pip install brown-octopus
brown-octopus setup-models

setup-models explicitly prepares en_core_web_trf and Qwen/Qwen3-Embedding-0.6B in Brown Octopus-managed persistent storage. Normal initialization does not download models.

Quick start

from brown_octopus import Octopus


async def main():
    octopus = Octopus()
    await octopus.initialize()

    result = octopus.retrieve_result(
        "Reply to Tom's email",
        session_id="conversation-123",
    )

    # Final active capability context for the host agent.
    for capability in result.tools:
        print(capability["name"])

Use await octopus.update() when the host deliberately wants to discover capabilities and build an updated index. initialize() loads existing local models and index state; it does not discover or download implicitly.

Frozen V3 pipeline

user request
    -> deterministic spaCy operational-intent analysis
    -> capability-oriented retrieval text
    -> Qwen dense retrieval
    -> Min-4 + Bounded Max Gap selection
    -> merge and deduplicate
    -> session capability state
    -> final active capability context
    -> host agent
Embedding:        Qwen/Qwen3-Embedding-0.6B
Analyzer:         en_core_web_trf
Representation:   capability name + description
MIN_TOOLS:        4 per intent
MAX_TOOLS:        16 per intent
MIN_GAP_PERCENT:  2.0
TTL:              8 turns
Active cap:       30 capabilities

Brown Octopus is intentionally recall-oriented for its first production version. It prefers a bounded set of plausible capabilities over aggressively pruning and risking a missing required capability. It does not guarantee perfect recall.

Results and sessions

result = octopus.retrieve_result(query, session_id="conversation-123")
result.retrieved_tools  capabilities selected on this turn
result.tools            final active context after TTL/session management
result.tool_ids         IDs in result.tools
result.session_id       session identifier
result.turn             session turn number

Expose result.tools to the agent. Brown Octopus returns definitions and metadata only; the host binds and executes tools.

One engine can serve many isolated conversations. Models, indexes, and retrievers are shared; turn counters, TTL state, and active capabilities are session-specific.

octopus.reset_session("conversation-123")
octopus.delete_session("conversation-123")
snapshot = octopus.get_session("conversation-123")

The default InMemorySessionStore keeps serializable capability state in process. Applications needing persistence can inject a custom store:

octopus = Octopus(session_store=my_store)

Custom stores must make session mutation atomic across workers/processes. Brown Octopus stores capability state, not conversation history.

Capability sources and updates

The default source reads the local MCP catalog, but the source abstraction is provider-neutral. Use a custom source without changing the retrieval engine:

octopus = Octopus(capability_source=my_source)
report = await octopus.update()

Capability identity fields are:

capability_id  stable globally unique capability identity
source_id      discovery provenance
mcp_url        execution endpoint when applicable

Failed or non-authoritative discovery does not silently delete capabilities from unavailable sources. New index snapshots are validated and published atomically.

Model storage and diagnostics

Override the managed model directory for containers or shared volumes with BROWN_OCTOPUS_MODEL_DIR. Model setup remains explicit:

brown-octopus setup-models
brown-octopus doctor
brown-octopus inspect
brown-octopus inspect --json

doctor checks package, model, and index readiness. inspect reports the active index and frozen configuration without exposing credentials.

Architecture boundary

Brown Octopus owns intent analysis, capability retrieval/selection, index construction, active capability context, session capability state, and explicit capability updates.

The host owns the LLM, conversation history, tool binding/execution, credentials, authentication, authorization, user identity, refresh timing, and session lifecycle policy.

Brown Octopus is harness-agnostic. A LangGraph integration example is available at examples/langgraph_app; LangGraph is not a runtime dependency.

Development

uv sync
brown-octopus setup-models
uv run pytest -m "not external"
uv build

Historical evaluation infrastructure remains under evals/, benchmark data under data/evals/, and research outputs under results/. These are separate from the installable brown_octopus package.

See LICENSE for licensing information.

Metadata

Release files for brown-octopus 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brown-octopus 0.4.4
File Size Uploaded
brown_octopus-0.4.4.tar.gz 30.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brown-octopus 0.4.4
File Interpreter ABI Platform
brown_octopus-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 68.5 kB

Release files / brown_octopus-0.4.4.tar.gz

Download URL brown_octopus-0.4.4.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ba7eaded0e82b4b843479d229e0292eaef0ae85f55f185c97521eb52944ed280
BLAKE2b-256 checksum
How to use checksums
4ee0c7f994f18b4de3019fa506dfe359452f4e84f0d6896d057c35b086af269f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / brown_octopus-0.4.4-py3-none-any.whl

Download URL brown_octopus-0.4.4-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
714067e9ba3dedd25e45832b635bc4cc37f83b0f32f0b1e77527a67a1f3dc8bc
BLAKE2b-256 checksum
How to use checksums
db6096d8b1221cd957e6cfd5f61b7fb46b1d5f87c979b0a40374e1fee8e3a6d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

This release

0.4.4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page