Skip to content

OKF quickstart

Terminal window
pip install "astromesh-okf[langchain]"

The tools are plain methods that return strings.

from astromesh_okf import OKFTools
kb = OKFTools("./my-bundle")
print(kb.kb_index("/"))
print(kb.kb_find(type="Policy"))
print(kb.kb_read("policies/refunds"))

No bundle yet? Clone the repository and try astromesh-okf index examples/bundles/support.

create_agent runs on LangGraph underneath, so the same tools work in a hand-built LangGraph graph (ToolNode).

Terminal window
pip install "astromesh-okf[langchain]" langchain langchain-openai
export OPENAI_API_KEY=...
import os
from pathlib import Path
from langchain.agents import create_agent
from astromesh_okf import Bundle
from astromesh_okf.integrations.langchain import okf_tools
QUESTION = "Can I get a refund after 3 weeks on the Team plan?"
BUNDLE = Path(__file__).parent / "bundles" / "support"
SYSTEM = "Answer using the knowledge base tools. Bundle index:\n" + Bundle(BUNDLE).index("/")
if __name__ == "__main__":
agent = create_agent(
os.getenv("OKF_EXAMPLE_MODEL", "openai:gpt-4.1-mini"),
okf_tools(BUNDLE),
system_prompt=SYSTEM,
)
result = agent.invoke({"messages": [("user", QUESTION)]})
print(result["messages"][-1].content)

This is examples/langgraph_agent.py from the repository. The root index goes into the system prompt so the agent does not spend a tool call on it.

Install the mcp extra, then point your client at the bundle with an absolute path.

Terminal window
pip install "astromesh-okf[mcp]"
astromesh-okf mcp /absolute/path/to/bundle

Claude Code

Terminal window
claude mcp add okf-support -- astromesh-okf mcp /absolute/path/to/bundle

Claude Desktop (claude_desktop_config.json) or Cursor (.cursor/mcp.json)

{ "mcpServers": { "okf-support": { "command": "astromesh-okf", "args": ["mcp", "/absolute/path/to/bundle"] } } }