Skip to content

hooks for agents#53

Merged
echarles merged 3 commits intomainfrom
feat/hooks
Mar 1, 2026
Merged

hooks for agents#53
echarles merged 3 commits intomainfrom
feat/hooks

Conversation

@echarles
Copy link
Member

@echarles echarles commented Mar 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 1, 2026 10:22
@netlify
Copy link

netlify bot commented Mar 1, 2026

Deploy Preview for agent-runtimes failed.

Name Link
🔨 Latest commit eacf70b
🔍 Latest deploy log https://app.netlify.com/projects/agent-runtimes/deploys/69a418bf5e9de70008114d7b

@echarles echarles changed the title hooks hooks for agents Mar 1, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs a terminology rename across the codebase, replacing the old "AgentSpace" / "agent space" terminology with the current "Agent Runtime" / "agent runtime" naming. Additionally, it introduces two new hooks (useAgentRuntimes.ts and useAgentStore.ts) that wrap the Datalayer runtimes service cache and expose a centralized Zustand store for agent specs and running agents.

Changes:

  • Rename all occurrences of "AgentSpace/agent space" to "Agent Runtime/agent runtime" in comments and docstrings across TypeScript, Python, and codegen files.
  • Add useAgentRuntimes.ts: new hooks that delegate to @datalayer/core/lib/hooks cache for fetching/creating/deleting agent runtimes from the K8s backend.
  • Add useAgentStore.ts: new centralized Zustand store holding the static agent spec catalogue and the live running agents list, with spec enrichment logic in setRunningAgents.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/types/Types.ts Updated AgentSpec docstring: "AgentSpace" → "Agent Runtime"
src/specs/agents/mocks/agents.ts Updated autogenerated comment: "AgentSpaces" → "Agent Runtimes"
src/specs/agents/datalayer-ai/agents.ts Updated autogenerated comment: "AgentSpaces" → "Agent Runtimes"
src/specs/agents/codemode-paper/agents.ts Updated autogenerated comment: "AgentSpaces" → "Agent Runtimes"
src/specs/agents/codeai/agents.ts Updated autogenerated comment: "AgentSpaces" → "Agent Runtimes"
src/hooks/useAgentStore.ts New Zustand store for agent specs catalog + running agent runtimes
src/hooks/useAgentRuntimes.ts New hooks delegating to useCache for runtime CRUD operations; defines AgentRuntimeData type
src/hooks/index.ts Exports the two new hook modules
src/components/chat/store/conversationStore.ts Updated comments: "agent space" → "agent runtime"
src/components/chat/components/base/ChatBase.tsx Updated comments: "agent spaces" → "agent runtimes"
src/components/chat/components/Chat.tsx Updated comment: "agent spaces" → "agent runtimes"
src/components/McpServerManager.tsx Updated docstring: "agent spaces" → "agent runtimes"
scripts/codegen/generate_agents.py Updated codegen templates: "AgentSpaces" → "agent runtimes"
agent_runtimes/types/types.py Updated Python docstrings: "agent space" → "agent runtime"
agent_runtimes/specs/agents/mocks/agents.py Updated autogenerated comment
agent_runtimes/specs/agents/datalayer_ai/agents.py Updated autogenerated comment
agent_runtimes/specs/agents/codemode_paper/agents.py Updated autogenerated comment
agent_runtimes/specs/agents/codeai/agents.py Updated autogenerated comment

url?: string;
token?: string;
// Agent specification with suggestions for chat UI
agentSpec?: Record<string, any>;
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The agentSpec field in AgentRuntimeData is typed as Record<string, any>, but in useAgentStore.ts the setRunningAgents mutator assigns a fully-typed AgentSpec object to this field (line 61: return spec ? { ...agent, agentSpec: spec } : agent). The weak Record<string, any> type means TypeScript will not provide proper autocomplete or catch type errors when consumers of runningAgents access agentSpec fields. The type should be AgentSpec | undefined (using the imported AgentSpec from ../types/Types) rather than Record<string, any>. Note this would require importing AgentSpec in useAgentRuntimes.ts as well.

Copilot uses AI. Check for mistakes.
* Agent Library.
*
* Predefined agent specifications that can be instantiated as AgentSpaces.
* Predefined agent specifications that can be instantiated as agent runtimes.
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The codegen template in generate_agents.py uses lowercase "agent runtimes" (line 365 for TypeScript, line 78 for Python), but the auto-generated TypeScript files in this PR were manually updated to use title case "Agent Runtimes". If the codegen script is re-run in the future, the TypeScript files will revert to lowercase "agent runtimes", introducing inconsistency. The template at line 365 should match what was manually set in the TypeScript files (i.e., use "Agent Runtimes" with title case if that's the intended naming convention).

Suggested change
* Predefined agent specifications that can be instantiated as agent runtimes.
* Predefined agent specifications that can be instantiated as Agent Runtimes.

Copilot uses AI. Check for mistakes.
@echarles echarles merged commit 4813c2c into main Mar 1, 2026
19 of 23 checks passed
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.

2 participants