# Elsai Prebuilt Tools — Claude Code Skill

This file teaches Claude Code how to help developers use **`elsai-agents-tools`** — the companion package of ready-made agent tools for the Elsai Agent SDK.

## Installation

```bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ elsai-agents-tools==0.1.0
```

Optional extras:

```bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ \
  "elsai-agents-tools[mem0-memory,local-chromium-browser,agent-core-code-interpreter]==0.1.0"
```

Requires Python **3.10+** and `elsai-agents>=0.2.0`. Import namespace: **`elsai_tools`**.

---

## Core Concepts

### 1. Register prebuilt tools

```python
from elsai import Agent
from elsai_tools.shell import shell
from elsai_tools.file_read import file_read
from elsai_tools.file_write import file_write
from elsai_tools.http_request import http_request

agent = Agent(tools=[shell, file_read, file_write, http_request])
result = agent("Read README.md and list the project files")
```

**Rules:**
- Import from `elsai_tools.<module>` — one function per module
- Pass tool functions to `Agent(tools=[...])`
- Do **not** redefine `file_read`, `shell`, etc. with `@tool` when prebuilt tools apply

### 2. Direct tool invocation

```python
agent.tool.shell(command="git status", work_dir=".")
agent.tool.file_read(path="./README.md")
agent.tool.http_request(method="GET", url="https://api.example.com/health")
```

### 3. Class-based tool providers

Some tools require instantiating a class first:

```python
from elsai_tools.code_interpreter import AgentCoreCodeInterpreter
from elsai_tools.browser import LocalChromiumBrowser
from elsai_tools.agent_core_memory import AgentCoreMemoryToolProvider
from elsai_tools.a2a_client import A2AClientToolProvider

interpreter = AgentCoreCodeInterpreter(region="us-west-2")
browser = LocalChromiumBrowser()
memory = AgentCoreMemoryToolProvider(
    memory_id="memory-123",
    actor_id="user-456",
    session_id="session-789",
    namespace="default",
)
a2a = A2AClientToolProvider(known_agent_urls=["http://agent.example.com"])

agent = Agent(tools=[
    interpreter.code_interpreter,
    browser.browser,
    *memory.tools,
    *a2a.tools,
])
```

---

## Tool Categories

| Category | Example import |
|---|---|
| File I/O | `from elsai_tools.file_read import file_read` |
| Shell | `from elsai_tools.shell import shell` |
| Web / HTTP | `from elsai_tools.http_request import http_request` |
| Search | `from elsai_tools.tavily import tavily_search` |
| RAG | `from elsai_tools.retrieve import retrieve` |
| Memory | `from elsai_tools.memory import memory` |
| Multi-agent | `from elsai_tools.swarm import swarm` |
| AWS | `from elsai_tools.use_aws import use_aws` |

---

## Optional Extras

| Extra | Enables |
|---|---|
| `mem0-memory` | `mem0_memory` |
| `elasticsearch-memory` | `elasticsearch_memory` |
| `mongodb-memory` | `mongodb_memory` |
| `local-chromium-browser` | `LocalChromiumBrowser` |
| `agent-core-code-interpreter` | `AgentCoreCodeInterpreter` |
| `diagram` | `diagram` |
| `rss` | `rss` |
| `a2a-client` | A2A client tools |

Install an extra:

```bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ "elsai-agents-tools[EXTRA]==0.1.0"
```

---

## Plugins

Plugins do **not** include execution tools. Register prebuilt tools separately:

```python
from elsai import Agent
from elsai.agent import AgentConfig
from elsai.plugins.skills import AgentSkills
from elsai_tools.file_read import file_read
from elsai_tools.shell import shell

plugin = AgentSkills(skills="./skills/")
agent = Agent(tools=[file_read, shell], config=AgentConfig(plugins=[plugin]))
```

---

## Key Rules When Writing Elsai Prebuilt Tools Code

1. **`elsai-agents-tools` is a separate package** from `elsai-agents` — always install both when needed.
2. **Never stub tools with `@tool`** when `elsai_tools` provides them.
3. **Class-based tools** — register `.code_interpreter`, `.browser`, or `*provider.tools`.
4. **Check pip extras** before browser, Mem0, diagram, RSS, or AgentCore tools.
5. **Plugins need tools explicitly** — `AgentSkills`, steering handlers, etc. do not ship `file_read` or `shell`.
6. **Use `agent.tool.<name>`** for direct calls when the tool and arguments are already known.
7. **Import path** — `from elsai_tools.shell import shell`, not `from elsai_tools import shell`.
