OKF integrations
Every adapter has the same entry point, okf_tools(bundle, prefix=""), which returns the framework’s own tool objects. The adapter imports its framework only when you call it. Install an extra with pip install "astromesh-okf[<extra>]".
| Framework | Extra | Adapter import |
|---|---|---|
| LangChain / LangGraph | langchain | from astromesh_okf.integrations.langchain import okf_tools |
| CrewAI | crewai | from astromesh_okf.integrations.crewai import okf_tools |
| Google ADK | adk | from astromesh_okf.integrations.adk import okf_tools |
| OpenAI Agents SDK | openai-agents | from astromesh_okf.integrations.openai_agents import okf_tools |
| PydanticAI (Python 3.11+) | pydantic-ai | from astromesh_okf.integrations.pydantic_ai import okf_tools |
| LlamaIndex | llamaindex | from astromesh_okf.integrations.llamaindex import okf_tools |
| smolagents | smolagents | from astromesh_okf.integrations.smolagents import okf_tools |
| Microsoft Agent Framework | agent-framework | from astromesh_okf.integrations.agent_framework import okf_tools |
| MCP (Claude Desktop, Claude Code, Cursor, any client) | mcp | astromesh-okf mcp ./my-bundle |
Anything that takes plain Python functions needs no extra: OKFTools("./my-bundle").functions() returns kb_index, kb_read and kb_find.
The snippets below assume this system prompt. Model packages are separate installs.
from astromesh_okf import Bundle
SYSTEM = "Answer using the knowledge base tools. Bundle index:\n" + Bundle("./my-bundle").index("/")LangChain / LangGraph
Section titled “LangChain / LangGraph”from langchain.agents import create_agentfrom astromesh_okf.integrations.langchain import okf_tools
agent = create_agent("openai:gpt-4.1-mini", okf_tools("./my-bundle"), system_prompt=SYSTEM)result = agent.invoke({"messages": [("user", "Can I get a refund?")]})CrewAI
Section titled “CrewAI”from crewai import Agentfrom astromesh_okf.integrations.crewai import okf_tools
agent = Agent( role="Support agent", goal="Answer from the bundle", backstory=SYSTEM, tools=okf_tools("./my-bundle"),)Google ADK
Section titled “Google ADK”from google.adk.agents import Agentfrom astromesh_okf.integrations.adk import okf_tools
agent = Agent( name="support", model="gemini-2.5-flash", instruction=SYSTEM, tools=okf_tools("./my-bundle"))OpenAI Agents SDK
Section titled “OpenAI Agents SDK”from agents import Agent, Runnerfrom astromesh_okf.integrations.openai_agents import okf_tools
agent = Agent(name="support", instructions=SYSTEM, tools=okf_tools("./my-bundle"))print(Runner.run_sync(agent, "Can I get a refund?").final_output)PydanticAI
Section titled “PydanticAI”from pydantic_ai import Agentfrom astromesh_okf.integrations.pydantic_ai import okf_tools
agent = Agent("openai:gpt-4.1-mini", tools=okf_tools("./my-bundle"), system_prompt=SYSTEM)print(agent.run_sync("Can I get a refund?").output)LlamaIndex
Section titled “LlamaIndex”from llama_index.core.agent.workflow import FunctionAgentfrom llama_index.llms.openai import OpenAIfrom astromesh_okf.integrations.llamaindex import okf_tools
agent = FunctionAgent( tools=okf_tools("./my-bundle"), llm=OpenAI(model="gpt-4.1-mini"), system_prompt=SYSTEM)
async def main(): print(await agent.run("Can I get a refund?"))smolagents
Section titled “smolagents”from smolagents import OpenAIModel, ToolCallingAgentfrom astromesh_okf.integrations.smolagents import okf_tools
agent = ToolCallingAgent( tools=okf_tools("./my-bundle"), model=OpenAIModel("gpt-4.1-mini"), instructions=SYSTEM)print(agent.run("Can I get a refund?"))Microsoft Agent Framework
Section titled “Microsoft Agent Framework”from agent_framework import Agentfrom agent_framework.openai import OpenAIChatCompletionClientfrom astromesh_okf.integrations.agent_framework import okf_tools
agent = Agent( OpenAIChatCompletionClient(model="gpt-4.1-mini"), SYSTEM, tools=okf_tools("./my-bundle"))See the quickstart for Claude Desktop, Claude Code and Cursor. From Python, build_server returns a FastMCP server you can run or mount:
from astromesh_okf.mcp import build_server
build_server("./my-bundle", prefix="support_", name="support-kb").run()Argument coercion differs by framework
Section titled “Argument coercion differs by framework”Models invent arguments: limit="2", tags="finance" instead of a list, include_deprecated="false" as a string; strict-schema frameworks send null for every optional argument.
- Pass-through (plain functions and
OKFTools, LlamaIndex, smolagents, Google ADK): the tool layer coerces. Numbers are parsed (with a default when they are not), a string tag becomes a list,"true","1"and"yes"mean true and any other string means false, andnullmeans the default. - Schema-validating (LangChain, CrewAI, OpenAI Agents, Agent Framework, PydanticAI and MCP): the framework validates first. It parses
"2"and"false"itself, rejects what does not fit (limit="many",tags="finance") and reports the error to the model so it can retry.
Either way the agent loop does not crash.