Skip to content

Add ML Commons agents - #144

Open
esmarkowski wants to merge 2 commits into
feature/move-machine-learning-to-native-opensearch-clientfrom
feature/add-ml-commons-agents
Open

esmarkowski wants to merge 2 commits into
feature/move-machine-learning-to-native-opensearch-clientfrom
feature/add-ml-commons-agents

Conversation

@esmarkowski

@esmarkowski esmarkowski commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Agents are declared as classes with an agent type, an LLM, memory and tools, then registered, executed and deleted from Ruby or rake. Tool model: and index: options resolve to the model id and index name when the agent registers.

class SupportAgent < Stretchy::MachineLearning::Agent
  agent_type :conversational_flow
  llm :claude_model
  memory :conversation_index
  tool :vector_db, model: :embedding_model, index: Post, embedding_field: "body_embedding"
  tool :ml_model, model: :claude_model, prompt: "${parameters.question}"
end

SupportAgent.register!
SupportAgent.execute(question: "How do I reset my password?")

AGENT=SupportAgent rake stretchy:ml:agent:create creates one agent. stretchy:up creates agents after models deploy, and stretchy:down deletes them before models undeploy.

Resource now provides find, exists? and delete! for every ML resource, raising a resource-specific missing_error. ModelGroup uses them.

A flow agent with ListIndexTool was registered, executed and deleted against OpenSearch 3.9.0. Specs pass on OpenSearch 3.9.0, OpenSearch 2.19.7 and Elasticsearch 8.12.2.

Closes #137

Spencer Markowski and others added 2 commits November 16, 2026 17:15
Agent declares an ML Commons agent with agent_type, llm, memory and a tool
DSL, and registers, executes, finds and deletes it through client.ml.
Tool `model:` and `index:` options resolve to a model id and index name at
register time.

Resource gains the shared find, exists?, delete! and remote_id_for, with a
per-resource missing_error, and ModelGroup now uses them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stretchy:ml:agent:create, delete and status act on every Agent, or the one
named in AGENT. stretchy:up creates agents after models deploy and
stretchy:down deletes them before models undeploy.

RakeHelpers holds the ENV-or-descendants lookup and the spinner loop so other
tasks can share them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@esmarkowski
esmarkowski added this pull request to stack #142 November 16, 2026 22:19
@esmarkowski esmarkowski changed the title feature/add ml commons agents Add ML Commons agents Nov 16, 2026
@esmarkowski
esmarkowski marked this pull request as ready for review November 16, 2026 22:19

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ML Commons agents

1 participant