# Last9 plugins and agent skills

> Install Last9 plugins or individual skills for log, trace, CloudWatch, and Go instrumentation workflows.

Source: https://last9.io/docs/ai/agent-skills/

The [Last9 AI Toolkit](https://github.com/last9/ai-toolkit) provides plugins and skills for coding agents. A plugin bundles skills for a client. Each skill contains instructions for a specific task, such as selecting a service, discovering fields, querying telemetry, and checking the result.

For example, the logs skill tells the agent to confirm the fields available for the selected service. It then uses counts or other summaries to find a pattern before inspecting matching records. The Last9 MCP server supplies the tools that run the queries.

## Choose a skill

| Skill              | Use it for                                            | What it guides                                                                                                                             |
| ------------------ | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `last9-logs`       | Investigating errors and log patterns                 | Select the service, discover attributes, summarize patterns, and inspect matching records.                                                 |
| `last9-traces`     | Investigating latency, errors, or a specific trace    | Confirm the service, environment, time, and symptom, then discover fields before building a query.                                         |
| `last9-cloudwatch` | Investigating AWS metrics already ingested into Last9 | Identify the AWS resource and metric statistic, query the selected resource, and distinguish missing data from a measured zero.            |
| `go-agent-install` | Adding Last9 instrumentation to a Go application      | Inspect the module and framework, check for existing OpenTelemetry instrumentation, configure supported instrumentation, and verify spans. |

CloudWatch investigations cover Billing, RDS/Aurora, ElastiCache, MSK, DynamoDB, EC2, SQS, DMS, KMS, and S3. The CloudWatch skill queries data in Last9, and AWS ingestion setup is a separate step. See [AWS CloudWatch metrics](/docs/integrations/observability/aws-cloudwatch-metrics/) to send the metrics to Last9.

## Install the toolkit

Choose the plugin for your client, or install individual skills with the skills CLI. The Claude Code and Codex plugins bundle the four skills listed above. Connect Last9 MCP separately after the setup.

<span id="opencode"></span>
<span id="opencode-plugin"></span>

**Claude Code**

Add the marketplace and install its Last9 plugin:

```bash
claude plugin marketplace add last9/ai-toolkit
claude plugin install last9@last9-ai-toolkit
```

The plugin bundles the four skills listed above.

**Codex**

Add the marketplace and install its Last9 plugin:

```bash
codex plugin marketplace add last9/ai-toolkit
codex plugin add last9@last9-ai-toolkit
```

The plugin bundles the four skills listed above.

**OpenCode**

Version 0.3.0 supports OpenCode V1 and does not run on OpenCode V2. See the [OpenCode migration guide](https://opencode.ai/v2/docs/migrate-v1) for the differences between versions.

The published [Last9 OpenCode plugin](https://www.npmjs.com/package/@last9/opencode-plugin) configures the hosted Last9 MCP server and bundles the four skills listed above. Add it to your `opencode.json` or `opencode.jsonc`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [["@last9/opencode-plugin", { "org": "<org_slug>" }]]
}
```

Replace `<org_slug>` with your organization slug, restart OpenCode, then authorize access:

```bash
opencode mcp auth last9
```

You can set the `url` option to a full MCP endpoint instead of supplying `org`. The plugin also accepts `LAST9_ORG_SLUG` or `LAST9_MCP_URL` as environment variables. An existing `last9` MCP configuration takes precedence over the plugin's settings.

The plugin includes the skills, so a separate skills installation is unnecessary. If you prefer to configure MCP and skills separately, use [OpenCode MCP setup](/docs/integrations/opencode/) and the individual skills tab.

**Individual skills**

Use an agent that supports [Agent Skills](https://skills.sh), such as Claude Code, Codex, or Cursor. Run the following command:

```bash
npx skills add last9/ai-toolkit
```

Follow the installer's prompts to select the skills and target agent. To install only the logs skill, run the following command:

```bash
npx skills add last9/ai-toolkit --skill last9-logs
```

To install for Claude Code, run the following command:

```bash
npx skills add last9/ai-toolkit -a claude-code
```

For other ways to install the skills, see the [toolkit installation guide](https://github.com/last9/ai-toolkit#installation).

## Connect Last9 MCP

The logs, traces, and CloudWatch skills require an authenticated Last9 MCP connection in the same agent session. See [Last9 MCP setup](/docs/ai/mcp/#setup) for your client, and check your connection settings on the [MCP](https://app.last9.io/mcp) page in Last9.

Installing a skill or the Claude Code or Codex plugin does not authenticate the client or give it access to telemetry. If the agent cannot find the required tools, check the MCP connection before starting the investigation.

## Run an investigation

Ask your agent to use the installed skill and provide the service or resource and time window it needs. Replace the example resources with your own.

### Find a log error pattern

```text
Use the last9-logs skill to investigate errors for checkout-api
in production over the last 30 minutes. Discover the fields in
the selected service, summarize the main error patterns, and show evidence
for the most frequent pattern.
```

Check that the agent confirms the service and field names before applying filters. Review whether the result is a count of all matching records or a sample of individual records.

### Investigate a slow request

```text
Use the last9-traces skill to investigate slow requests for
checkout-api in production between 14:00 and 14:30 UTC on
2026-09-10. Start by confirming the available attributes, then
find representative slow traces and explain which operations
account for the delay.
```

If you have a trace ID, include it to narrow the investigation. The agent may ask for missing service, environment, or time details.

### Investigate an AWS resource

```text
Use the last9-cloudwatch skill to inspect CPU and query latency
for my RDS instance over the last hour. Confirm the Last9 data
source, AWS account, region, and instance before querying.
State the metric statistics, units, and any missing data.
```

A CloudWatch resource may have no application service label or APM instrumentation. Identify the AWS resource using the dimensions returned by queries and the account and region in its integration settings.

## Instrument a Go service

Run the instrumentation skill from your Go application repository:

```text
Use the go-agent-install skill to inspect this Go service and
add Last9 tracing. Check the framework and existing OpenTelemetry
instrumentation before making changes. Show how to verify a
request appears in Last9.
```

The skill supports automatic wiring for chi and provides manual integration guidance for other frameworks. Review the resulting code changes and instrumentation settings, then generate a request and confirm that its spans reach Last9.

## Verify the result

Skills guide model behavior. They do not replace the client's permissions, approval controls, or your review of the output.

Before using an investigation result, review the following details:

- Confirm that the agent called the Last9 tools with the intended service, resource, and time window.
- Open returned evidence links and inspect their queries and time windows.
- Check whether a result was sampled, incomplete, or blocked by a tool error.
- Keep a proposed explanation separate from a confirmed cause.

For a complete workflow, see [Investigate an incident with AI](/docs/ai/investigate-an-incident/). To embed Last9 tools in your own agent, see [Build your own AI SRE on Last9 data](/docs/ai/build-your-own-ai-sre/).

---

## Troubleshooting

| Problem                                            | Next step                                                                                                               |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| The agent does not recognize a skill               | Check that you installed it for that agent and that the agent can see it in the current session.                        |
| The skill is available but Last9 tools are missing | Connect and authenticate Last9 MCP in the same client.                                                                  |
| The agent guesses a field or service name          | Ask it to use discovery tools and the returned names before retrying the query.                                         |
| CloudWatch metrics are not found                   | Confirm ingestion, data source, account, region, and resource; do not assume every exporter uses the same metric names. |
| Go instrumentation already exists                  | Have the agent inspect the existing setup before adding another provider or middleware.                                 |

Please get in touch with us on [Discord](https://discord.com/invite/Q3p2EEucx9) or [Email](mailto:support@last9.io) if you have any questions.
