Skip to content

feat(p1-11): add ebbmem-openai-agents package and ChatGPT MCP recipe - #8

Merged
sbharatjoshi merged 1 commit into
mainfrom
feat/p1-11-openai-agents
Nov 22, 2026
Merged

sbharatjoshi merged 1 commit into
mainfrom
feat/p1-11-openai-agents

Conversation

@sbharatjoshi

Copy link
Copy Markdown
Member

Summary

Adds the ebbmem-openai-agents Python adapter package (packages/openai-agents-python/) for the OpenAI Agents SDK (openai-agents) and the ChatGPT Developer Mode / custom MCP connector recipe (docs/recipes/chatgpt.md):

  • EbbmemSession (ebbmem_openai_agents/session.py): Implements the OpenAI Agents SDK Session protocol (get_items, add_items, pop_item, clear_session, SessionSettings, cancellation-safe await_session_mutation) with pluggable RestEpisodicBackend (using ebbmem-integration-core's AsyncIntegrationClient / IntegrationClient with hex-encoded envelopes safe under IC-1 redaction) and McpEpisodicBackend (backed by memory_episodic_remember / memory_episodic_tail over Streamable HTTP or a user-provided MCP caller).
  • ebbmem_tools / EbbmemToolkit / EbbmemRunHooks (ebbmem_openai_agents/tools.py): Strict-schema @function_tool wrappers (ebbmem_recall, ebbmem_remember, ebbmem_reinforce, optional ebbmem_forget) enforcing read-only recall, <ebbmem_untrusted_memory_context> framing, secret redaction before persistence, injected=False default, and recall_id-correlated post-use reinforcement (via explicit ebbmem_reinforce tool calls or EbbmemRunHooks.on_agent_end).
  • ebbmem_mcp_server / ebbmem_mcp_stdio_server (ebbmem_openai_agents/mcp.py): Configured MCPServerStreamableHttp and MCPServerStdio helpers with IC-1 header-only credential validation, /mcp/{profile} targeting, X-Ebb-Namespace / X-Ebb-MCP-Profile headers, and static tool filtering.
  • docs/recipes/chatgpt.md: Step-by-step guide for registering an EbbMem HTTPS /mcp endpoint in ChatGPT Developer Mode / Connectors, clearly marked as not live-tested.

Nothing published.

Acceptance & Test Summary

Executed in Python 3.12.16 (openai-agents 0.25.0; all LLM calls mocked via agents.models.interface.Model subclasses against local mock servers — zero OpenAI API calls):

  • ruff format --check packages/openai-agents-python: 7 files already formatted (exit 0)
  • ruff check packages/openai-agents-python: All checks passed! (exit 0)
  • pytest -v packages/openai-agents-python/tests conformance/tests/test_public_compliance.py: 12 passed, 0 failed (5.70s):
    • tests/test_session_semantics.py (6 passed): Session protocol semantics against MockEbbmemServer (REST), McpEpisodicBackend (in-memory stub + Streamable HTTP /mcp/full), /api/v1/memory cursor pagination + SessionSettings, Runner.run multi-turn session persistence with mocked Model, sync IntegrationClient wrapping, and validation errors.
    • tests/test_tools_and_mcp.py (4 passed): read-only recall, EbbmemRunHooks cited-only reinforcement (injected=False), explicit ebbmem_reinforce recall_id correlation without double-counting, secret redaction, <ebbmem_untrusted_memory_context> closing-tag escaping, fail-open on 503, soft-tombstone ebbmem_forget, and MCPServerStreamableHttp / MCPServerStdio attachment + URL/dual-auth rejection.
    • conformance/tests/test_public_compliance.py (2 passed): public repository hygiene and README link/semantics checks.

Architecture Review Note (Verifier PASS)

  • Cleanly scoped PR off fresh origin/main (8b7aaf43) adding packages/openai-agents-python/ (ebbmem-openai-agents) and docs/recipes/chatgpt.md (10 files, max 758 lines, zero edits to packages/python/, DCO sign-off).
  • EbbmemSession implements the OpenAI Agents SDK Session protocol (get_items, add_items, pop_item, clear_session, SessionSettings, cancellation-safe await_session_mutation) with pluggable RestEpisodicBackend (hex-encoded envelopes safe under IC-1 redaction) and McpEpisodicBackend (using EbbMem's memory_episodic_remember / memory_episodic_tail schemas).
  • ebbmem_tools / EbbmemToolkit / EbbmemRunHooks preserve read-only recall with <ebbmem_untrusted_memory_context> framing, secret redaction, injected=False default, and recall_id-correlated post-use reinforcement; ebbmem_mcp_server / ebbmem_mcp_stdio_server wrap MCPServerStreamableHttp / MCPServerStdio with header-only credential validation.
  • Verification: ruff check and ruff format --check clean, pytest -v 12/12 passed (all mocked Model + local mock servers, zero OpenAI API calls), test_public_compliance.py 2/2 passed, and docs/recipes/chatgpt.md is clearly marked not live-tested. Nothing published.

Signed-off-by: Bharat Joshi <200157101+sbharatjoshi@users.noreply.github.com>
@sbharatjoshi
sbharatjoshi merged commit b717f9a into main Nov 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant