Skip to content

Tools defined in agent.ts are excluded from the deployment; useTool(tool) then fails every turn with an opaque error #632

Description

@UtpalJayNadiger

Versions: @opencomputer/cli 0.5.1, @opencomputer/agent 0.4.1, Node 26, macOS.

Repro

Take the exact lookup_order example from the tools docs and define it in agent.ts (or any file outside the agent's tools/ directory), then attach it:

const lookupOrder = defineTool({ name: "lookup_order", ... });

export default function Agent() {
  useModel("anthropic/claude-sonnet-4.6");
  useTool(lookupOrder);
  return "...";
}

opencomputer dev syncs and deploys with no warning. Every session turn then fails with only:

opencomputer: The agent could not complete this request.

The real error is visible only in the raw /api/managed-agents/sessions/{id}/events feed:

useTool() referenced "lookup_order", which is not part of this deployment

Cause

The bundler only registers tools discovered by static scan of agents/<agent>/tools/*.ts (definedToolIds in project.js). Tools defined in agent.ts or a sibling file compile fine but never make it into the deployment manifest, so the runtime rejects the useTool() reference.

The same static-scan scope also affects secrets: a defineConnection() in a non-tools/ module produces Skipped GITHUB_TOKEN: it is not referenced by a defineConnection() declaration during .env.local sync.

Expected

Either bundle tools defined in agent.ts/imported modules, or fail at build/sync time with a clear message ("tools must live in agents//tools/"). The docs (tools.md, reactive-agents.md) never state the tools/ directory requirement.

🤖 Filed with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions