# Strands Agent Tool

Neon integrates with [Strands Agents](https://strandsagents.com) as a tool, letting any LLM-powered agent control the G1 through natural language.

---

## Usage

```python
from strands import Agent
from neon.tools import neon_tool

agent = Agent(tools=[neon_tool])

# The agent decides when and how to use the robot
agent("Pick up the red cup and place it on the shelf")
```

The agent calls `neon_tool` with the appropriate action — it handles model loading, image capture, and action execution automatically.

---

## Available Actions

### `predict` — Single Prediction

```python
neon_tool(
    action="predict",
    instruction="Pick up the cup",
    image_path="/tmp/camera.jpg",  # Optional: path to camera image
)
```

Returns predicted actions without executing them. Useful for planning and visualization.

### `control` — Closed-Loop Execution

```python
neon_tool(
    action="control",
    instruction="Pick up the cup",
    robot_ip="192.168.123.10",
    control_mode="arms_only",
    max_steps=200,
)
```

Connects to the G1 and runs a full control loop. The agent blocks until execution completes.

### `status` — Model Info

```python
neon_tool(action="status")
```

Returns model info, device, and action space configuration.

### `reset` — Clear State

```python
neon_tool(action="reset")
```

Resets the inference server's temporal smoothing state. Call between episodes.

---

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `NEON_MODEL_PATH` | `cagataydev/neon-g1-v1` | HuggingFace model ID or local path |

---

## Multi-Step Reasoning

The power of the Strands integration is that the LLM agent can **decompose complex tasks** into sequences of robot actions:

```python
agent("Make me a sandwich")

# The agent might decompose this into:
# 1. neon_tool(action="predict", instruction="Look around and find the bread")
# 2. neon_tool(action="control", instruction="Pick up the bread")
# 3. neon_tool(action="control", instruction="Place bread on the cutting board")
# 4. neon_tool(action="control", instruction="Pick up the butter knife")
# ... and so on
```

The LLM handles high-level planning while Neon handles low-level motor control. This is the "System 2 + System 1" architecture from GR00T N1 — but with any LLM as System 2.
