From AI prototype to credible information system.Explore Go Live Fintech
OpenAI-compatible agents integration

Shared memory for
OpenAI-compatible agents.

Any agent loop that supports function calling can use a Priostack space as durable, shared memory: expose two functions and back them with the Python SDK.

Connect once

Install the SDK and your client:

Shell
pip install priostack openai

Register once, then reconnect with the saved token on every later run.

Python · connect
import os
from priostack import ACNClient

# First run: no ACN_TOKEN yet, so register once and save the token it prints
# (it is shown once). Later runs: set ACN_TOKEN and ACN_SPACE and the same
# agent finds the same memory.
acn = ACNClient(token=os.environ.get("ACN_TOKEN"))
if not acn.token:
    print("ACN_TOKEN =", acn.register(display_name="openai-agent").token)
acn.connect()
SPACE_ID = os.environ.get("ACN_SPACE") or acn.create_space("agent-memory").space_id
print("ACN_SPACE =", SPACE_ID)

Two functions the model can call

Declare remember and recall as function tools and dispatch them to the SDK. The schema below is the standard function-calling shape.

Python · functions and dispatcher
FUNCTIONS = [
  {"type": "function", "function": {"name": "remember", "description": "Persist a fact for future sessions.",
   "parameters": {"type": "object", "properties": {"fact": {"type": "string"}}, "required": ["fact"]}}},
  {"type": "function", "function": {"name": "recall", "description": "Recall stored facts that contain a word (case-insensitive substring match). Pass one word, not a question.",
   "parameters": {"type": "object", "properties": {"topic": {"type": "string"}}, "required": ["topic"]}}},
]

def call_function(acn, space_id, name, args):
    if name == "remember":
        acn.store(space_id, objects=[{"content": args["fact"], "type": "declaration"}])
        return "stored"
    if name == "recall":
        return "\n".join(acn.fetch(space_id, query=args.get("topic", ""), limit=5).contents()) or "nothing yet"
    return f"unknown function {name}"

Then run the usual tool-calling loop: send the functions, run each call the model asks for, and return the result.

Python · Chat Completions loop
import json
from openai import OpenAI

client = OpenAI()  # or OpenAI(base_url=...) for another OpenAI-compatible endpoint
MODEL = "your-model"  # any model your endpoint serves with tool calling
messages = [{"role": "user", "content": "Remember that releases ship on Thursdays."}]

while True:
    msg = client.chat.completions.create(model=MODEL, messages=messages, tools=FUNCTIONS).choices[0].message
    messages.append(msg)
    if not msg.tool_calls:
        print(msg.content)
        break
    for call in msg.tool_calls:
        out = call_function(acn, SPACE_ID, call.function.name, json.loads(call.function.arguments))
        messages.append({"role": "tool", "tool_call_id": call.id, "content": out})

Or use the Agents SDK over MCP

The OpenAI Agents SDK can connect to the endpoint itself with MCPServerStreamableHttp (pip install openai-agents). The model then makes the calls: it must call noetic.connect with the saved token first and pass the returned sessionId to every other tool.

This route does not work with OpenAI's own models. OpenAI's API accepts a tool name only if it is made of letters, digits, underscores and hyphens, and every tool the network serves has a dot in its name, such as noetic.fetch. The request is refused before any tool runs. Use it with a model endpoint that accepts dotted tool names. With an OpenAI model, use the two functions above.

Python · Agents SDK
import asyncio, os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main():
    async with MCPServerStreamableHttp(name="priostack-acn", params={"url": "https://priostack.com/mcp"}) as acn:
        agent = Agent(
            name="Assistant",
            instructions="Call noetic.connect with the token " + os.environ["ACN_TOKEN"]
                         + " first, then pass the returned sessionId to every other noetic tool.",
            mcp_servers=[acn],
        )
        result = await Runner.run(agent, "What do we know about refunds?")
        print(result.final_output)

asyncio.run(main())
Over MCP the model makes every call, noetic.connect included, so the agent token is in the instructions and in the tool call. The model provider receives it with every request and may keep it in its request logs. The function route above keeps the token in your code: the model only sees the two functions and never the token.

Share it with another agent

Register the second agent separately, so each one has its own token and its own permissions. As the owner, grant it rights on the space. The grant applies at once: noetic.fetch checks it on every call, so the second agent does not need to reconnect. Revoking stops future reads; it cannot take back what was already returned.

Python · share and revoke
# owner: share one space with another agent (its agent id from register)
grant = owner.grant_access(space_id, worker_agent_id, rights=["read", "quote"])

# fetch checks the grant on every call, so the grantee can read at once
print(worker.fetch(space_id, query="refund").contents())

# immediate, forward-only
owner.revoke_access(grant.capability_ref)
Understand grants and revocation

Questions

Which model is the memory tied to?

None. The space lives on the network, and any MCP client or SDK reads it within its grants.

How do I test it without a model?

Call the SDK directly: register, connect, create a space, store, fetch. The quickstart in the SDK repository does exactly that.

Inspect the MCP tool schemas

Let your next agent start with context.

Try the memory demo, then connect the tools you already use.

Try the demo

The endpoint is live. Example ids, keys and outputs on this page are samples.