Metadata-Version: 2.4
Name: myelin-sdk
Version: 0.1.0
Summary: Procedural memory for AI agents — agents that have done a task 100 times shouldn't fumble on attempt 101.
Project-URL: Homepage, https://myelin.sh
Project-URL: Repository, https://github.com/yahnyshc/myelin-sdk
Project-URL: Issues, https://github.com/yahnyshc/myelin-sdk/issues
Author: Maksym Yahnyshchak
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,langchain,memory,procedures,workflows
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
Description-Content-Type: text/markdown

# Myelin SDK

Procedural memory for AI agents. Agents that have done a task 100 times shouldn't fumble on attempt 101.

## Claude Code

Zero-code integration via PostToolUse hooks.

### 1. Install the SDK

```bash
pip install myelin-sdk
```

### 2. Add the MCP server

```bash
claude mcp add --scope project --transport http myelin https://myelin.fly.dev/mcp \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### 3. Add the PostToolUse hook

Add this to `.claude/settings.json`:

```json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "python3 -m myelin_sdk.claude_code"
          }
        ]
      }
    ]
  }
}
```

### 4. Update `.gitignore`

Add `.mcp.json` to your `.gitignore` (it contains your API key).

The hook captures every tool call automatically. Use `memory.recall` and `memory.finish` MCP tools to start and end sessions.

## Python SDK / LangChain

Explicit integration for LangChain and LangGraph agents.

```bash
pip install myelin-sdk[langchain]
```

```python
from myelin_sdk import MyelinSession

async with MyelinSession.start("handle support ticket", api_key="my_...") as session:
    handler = session.langchain_handler()

    # Pass handler to your LangChain agent
    result = await agent.ainvoke(
        {"messages": [{"role": "user", "content": "..."}]},
        config={"callbacks": [handler]},
    )
# session.finish() called automatically on exit
```

## Adding an Integration

The `integrations/langchain/` directory is the template for new integrations. To add support for another framework (e.g., CrewAI, AutoGen):

1. Create `src/myelin_sdk/integrations/<framework>/`
2. Add `__init__.py` and a handler module
3. Use `MyelinClient.capture()` to record tool calls
4. Add an optional dependency group in `pyproject.toml`
5. Add a convenience method on `MyelinSession`

See `integrations/langchain/handler.py` for a complete reference implementation.
