AI Agents & MCP¶
pjkm provides standardized project scaffolding that AI coding agents can rely on.
Why Agents Need pjkm¶
AI agents work best with predictable, standardized project structures:
Need |
pjkm Provides |
|---|---|
Where does code go? |
Always |
How to start the app? |
Always |
How to read config? |
Always |
How to check if it’s running? |
Always |
How to run tests? |
Always |
How to add dependencies? |
Always |
Agent Recipes¶
pjkm init my-agent --recipe ai-agent # LangGraph agent
pjkm init my-rag --recipe rag-service # RAG API service
pjkm init my-platform --recipe agent-platform # multi-agent platform
What ai-agent Generates¶
src/my_agent/
├── agent/
│ ├── __init__.py # from .graph import create_agent, run_agent
│ ├── graph.py # LangGraph StateGraph + tool calling + routing
│ ├── state.py # TypedDict with message history + context
│ ├── tools.py # @tool functions + get_all_tools()
│ └── prompts.py # ChatPromptTemplate collection
├── core/
│ ├── logging/config.py # structlog setup
│ └── redis.py # async client for caching
└── ...
graph.py features:
StateGraphwith agent → tools → agent loopConfigurable LLM via
LLM_PROVIDERenv var (Anthropic or OpenAI)Max tool calls limit (prevents infinite loops)
Async
run_agent(query, context)entry point
tools.py is group-aware:
Always includes
get_current_timeandcalculateAdds
web_search(DuckDuckGo) whensearch_toolsgroup is selectedAdd your own tools with
@tooldecorator
29 AI/ML Groups¶
pjkm list groups # see all
pjkm info agents # detailed view
Agent frameworks: agents, langchain, langgraph, llm_providers, claude_sdk, openai_sdk
Retrieval: rag, vector_stores, embeddings, search_tools, doc_parsing
Protocols: mcp_tools, agent_protocols
Quality: eval, langsmith, guardrails
ML/DL: ml, hf, torch, dataviz, image, video, audio, ocr
MCP Server¶
pip install pjkm[mcp]
python -m pjkm.mcp
Tools¶
Tool |
What it does |
|---|---|
|
Create a project from recipe or groups |
|
Add groups to existing project |
|
Preview without creating files |
|
Browse 22 recipes |
|
Browse 105 groups by category |
|
Detailed group info |
|
Search community packs |
|
Scan existing project |
|
Show applied groups + drift |
|
Save custom recipe |
Resources¶
URI |
Description |
|---|---|
|
All recipes |
|
All groups by category |
|
Group details |
|
Community packs |
|
Available archetypes |
|
Workspace blueprints + service templates |
|
Group categories with counts |
Prompts¶
Prompt |
Input |
Purpose |
|---|---|---|
|
Project description |
Recommend recipe + groups |
|
System requirements |
Design workspace layout |
|
Agent type |
Step-by-step agent setup |
Claude Desktop¶
{
"mcpServers": {
"pjkm": {
"command": "python",
"args": ["-m", "pjkm.mcp"]
}
}
}
LangChain Integration¶
from langchain_mcp_adapters import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic
model = ChatAnthropic(model="claude-sonnet-4-20250514")
async with MultiServerMCPClient({
"pjkm": {"command": "python", "args": ["-m", "pjkm.mcp"]}
}) as client:
agent = create_react_agent(model, client.get_tools())
result = await agent.ainvoke({
"messages": [{"role": "user",
"content": "Create a RAG service with vector store and auth"}]
})
Sandbox Bootstrapping¶
An orchestrator can use pjkm to create isolated environments:
# Orchestrator creates sandbox for each task
result = init_project(name="task-123", recipe="ai-agent", directory="/sandboxes/")
# Task agent operates in /sandboxes/task-123/ with known structure
Every sandbox has:
python -m task_123starts the appGET /healthconfirms it’s runningpdm run testvalidates it workssrc/task_123/core/settings.pyfor configuration