Five minutes to plug the AgentContextOS gateway into your framework as a
retriever or tool. All adapters live in the Python SDK under
agentcontextos.integrations.<framework> and wrap agentcontextos.Client.
uv run uvicorn rag_gateway.app:app --port 8000pip install "agentcontextos[langchain]" # or [llama-index] / [haystack] / [dspy] /
# [langgraph] / [crewai] / [autogen] /
# [semantic-kernel]pip install agentcontextos alone pulls in no framework — each integration
is an optional extra.
from agentcontextos.integrations.langchain import AgentContextOSRetriever
retriever = AgentContextOSRetriever(
base_url="http://localhost:8000", tenant_id="acme", principal_id="svc", top_k=5
)
docs = retriever.invoke("How do I rotate signing keys?")Drop retriever into any chain (RetrievalQA, LCEL) or agent.
# LlamaIndex
from agentcontextos.integrations.llama_index import AgentContextOSRetriever
nodes = AgentContextOSRetriever(client=rag, top_k=5).retrieve("...")
# Haystack
from agentcontextos.integrations.haystack import AgentContextOSRetriever
docs = AgentContextOSRetriever(client=rag).run(query="...")["documents"]
# DSPy
import dspy
from agentcontextos.integrations.dspy import AgentContextOSRM
dspy.settings.configure(rm=AgentContextOSRM(client=rag, k=5))
passages = dspy.Retrieve(k=5)("...").passagesrag here is a configured agentcontextos.Client (see
guides/sdk-quickstart.md); or pass base_url + identity
kwargs instead of client=.
These expose the gateway as a search tool the agent calls; it returns a numbered passage block.
# CrewAI
from agentcontextos.integrations.crewai import AgentContextOSSearchTool
tool = AgentContextOSSearchTool(client=rag, top_k=5) # Agent(tools=[tool])
# AutoGen
from agentcontextos.integrations.autogen import make_search_function
search = make_search_function(client=rag, top_k=5) # register with an AssistantAgent
# Semantic Kernel
from agentcontextos.integrations.semantic_kernel import AgentContextOSPlugin
kernel.add_plugin(AgentContextOSPlugin(client=rag, top_k=5), plugin_name="agentcontextos")from agentcontextos.integrations.langgraph import make_retrieval_tool, make_retrieval_node
tool = make_retrieval_tool(client=rag, top_k=5) # for a ToolNode
node = make_retrieval_node(client=rag, input_key="question", output_key="docs")
# graph.add_node("retrieve", node)Every adapter accepts the same options: a client= (or base_url + tenant_id
/ principal_id / api_key) plus top_k, corpus_ids, rerank. Retrieval
runs /v1/query with packing + generation off, so you get hydrated, scored
chunks mapped to the framework's document type with consistent metadata
(chunk_id, document_id, score, corpus_id, trust_level, …).
- reference/integrations.md — every adapter's API.
- architecture/framework-adapters.md — design + testing.
- ADR-0017 — why one subpackage with lazy imports.
- guides/sdk-quickstart.md — the SDK the adapters wrap.