Is this correct way to define subagents with my gemini api key? #2795

Closed
opened 2026-02-16 17:37:17 -05:00 by yindo · 11 comments
Owner

Originally created by @vrijmetse on GitHub (Nov 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

So I have executed opencode auth login then I chose Google and provided the API Key. I can see the model shows up when I launch opencode.

However when I tried to define subagents through opencode.json I got error when during launch.

Error: undefined is not an object (evaluating x3.data.providers).

Heres my current opencode.json which I put in the project root folder.

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "build": {
      "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app",
      "mode": "primary",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.3,
      "prompt": "{file:./prompts/build.txt}",
      "tools": {
        "write": true,
        "edit": true,
        "bash": true
      }
    },
    "plan": {
      "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app",
      "mode": "primary",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.3,
      "tools": {
        "write": false,
        "edit": false,
        "bash": false
      }
    },
    "architect": {
      "description": "Designs architecture, database schema, and API contracts for the application",
      "mode": "subagent",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.2,
      "prompt": "{file:./prompts/architect.txt}",
      "tools": {
        "write": true,
        "edit": true
      }
    },
    "frontend": {
      "description": "Builds UI with Next.js, Tailwind, and Supabase integration",
      "mode": "subagent",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.3,
      "prompt": "{file:./prompts/frontend.txt}",
      "tools": {
        "write": true,
        "edit": true
      }
    },
    "backend": {
      "description": "Implements Supabase backend logic, APIs, and security policies",
      "mode": "subagent",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.2,
      "prompt": "{file:./prompts/backend.txt}",
      "tools": {
        "write": true,
        "edit": true
      }
    },
    "devops": {
      "description": "Configures environment variables, deployment, and CI/CD pipelines",
      "mode": "subagent",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.1,
      "prompt": "{file:./prompts/devops.txt}",
      "tools": {
        "write": true,
        "bash": true
      }
    },
    "qa": {
      "description": "Reviews and tests for code quality, performance, and security",
      "mode": "subagent",
      "model": "google/gemini-2.5-pro",
      "temperature": 0.1,
      "prompt": "{file:./prompts/qa.txt}",
      "tools": {
        "write": false,
        "edit": false
      }
    }
  }
}


Originally created by @vrijmetse on GitHub (Nov 11, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question So I have executed `opencode auth login` then I chose Google and provided the API Key. I can see the model shows up when I launch opencode. However when I tried to define subagents through opencode.json I got error when during launch. Error: undefined is not an object (evaluating x3.data.providers). Heres my current opencode.json which I put in the project root folder. ``` { "$schema": "https://opencode.ai/config.json", "agent": { "build": { "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app", "mode": "primary", "model": "google/gemini-2.5-pro", "temperature": 0.3, "prompt": "{file:./prompts/build.txt}", "tools": { "write": true, "edit": true, "bash": true } }, "plan": { "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app", "mode": "primary", "model": "google/gemini-2.5-pro", "temperature": 0.3, "tools": { "write": false, "edit": false, "bash": false } }, "architect": { "description": "Designs architecture, database schema, and API contracts for the application", "mode": "subagent", "model": "google/gemini-2.5-pro", "temperature": 0.2, "prompt": "{file:./prompts/architect.txt}", "tools": { "write": true, "edit": true } }, "frontend": { "description": "Builds UI with Next.js, Tailwind, and Supabase integration", "mode": "subagent", "model": "google/gemini-2.5-pro", "temperature": 0.3, "prompt": "{file:./prompts/frontend.txt}", "tools": { "write": true, "edit": true } }, "backend": { "description": "Implements Supabase backend logic, APIs, and security policies", "mode": "subagent", "model": "google/gemini-2.5-pro", "temperature": 0.2, "prompt": "{file:./prompts/backend.txt}", "tools": { "write": true, "edit": true } }, "devops": { "description": "Configures environment variables, deployment, and CI/CD pipelines", "mode": "subagent", "model": "google/gemini-2.5-pro", "temperature": 0.1, "prompt": "{file:./prompts/devops.txt}", "tools": { "write": true, "bash": true } }, "qa": { "description": "Reviews and tests for code quality, performance, and security", "mode": "subagent", "model": "google/gemini-2.5-pro", "temperature": 0.1, "prompt": "{file:./prompts/qa.txt}", "tools": { "write": false, "edit": false } } } } ```
yindo closed this issue 2026-02-16 17:37:17 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 11, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3868: Same exact error message "undefined is not an object (evaluating 'x3.data.providers')" when launching OpenCode, particularly related to configuration issues

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 11, 2025): This issue might be a duplicate of existing issues. Please check: - #3868: Same exact error message "undefined is not an object (evaluating 'x3.data.providers')" when launching OpenCode, particularly related to configuration issues Feel free to ignore if none of these address your specific case.
Author
Owner

@vrijmetse commented on GitHub (Nov 11, 2025):

Thanks for pointing that out, after I run opencode debug config I can see it was not able to find the prompts files. Now I moved the opencode.json from project to global and the issue went away. But the problem I cant see the agents I defined. I only see the built in build and plan agents.

@vrijmetse commented on GitHub (Nov 11, 2025): Thanks for pointing that out, after I run `opencode debug config` I can see it was not able to find the prompts files. Now I moved the `opencode.json` from project to global and the issue went away. But the problem I cant see the agents I defined. I only see the built in `build` and `plan` agents.
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

@vrijmetse can u try on latest and see what happens?

This should work but i need to know:

  • where are the files being placed
  • what error are you seeing now (on latest)

for global you can do: ~/.config/opencode/opencode.json

for project level:

opencode.json or .opencode/opencode.json

And then where are those prompt files?

@rekram1-node commented on GitHub (Nov 11, 2025): @vrijmetse can u try on latest and see what happens? This should work but i need to know: - where are the files being placed - what error are you seeing now (on latest) for global you can do: ~/.config/opencode/opencode.json for project level: opencode.json or .opencode/opencode.json And then where are those prompt files?
Author
Owner

@vrijmetse commented on GitHub (Nov 11, 2025):

I am using the latest 1.0.58 with global config at ~/.config/opencode/opencode.json

This is the result of my opencode debug config command, looks like its able to pick up my prompt correctly.

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "plan": {
      "model": "google/gemini-2.5-pro",
      "temperature": 0.3,
      "tools": {
        "write": false,
        "edit": false,
        "bash": false
      },
      "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app",
      "mode": "primary"
    },
    "build": {
      "model": "google/gemini-2.5-pro",
      "temperature": 0.3,
      "prompt": "You are the primary orchestrator agent.\n\nYour job is to:\n- Interpret the user's request or product goal.\n- Delegate architectural planning to the Architect agent.\n- Pass UI tasks to the Frontend agent.\n- Pass data and logic tasks to the Backend agent.\n- Ask the DevOps agent to configure and deploy.\n- Request the QA agent to review and test outputs.\n\nReturn a cohesive project summary or delivery plan.",
      "tools": {
        "write": true,
        "edit": true,
        "bash": true
      },
      "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app",
      "mode": "primary"
    },
    "architect": {
      "model": "gemini-2.5-pro",
      "temperature": 0.2,
      "prompt": "You are the **System Architect**.\n\nYour responsibilities:\n- Analyze high-level product requirements.\n- Design the app architecture (Next.js frontend + Supabase backend).\n- Define database schema, API contracts, and auth flow.\n- Output results as clear, modular markdown or code snippets.\n\nFocus on:\n- Simplicity and scalability.\n- Developer experience (DX).\n- Secure, maintainable folder structure.\n\nOutput files:\n- `docs/architecture_plan.md`\n- `database/schema.sql`",
      "tools": {
        "write": true,
        "edit": true,
        "bash": false
      },
      "description": "Plans the system architecture, data model, and overall structure",
      "mode": "subagent",
      "name": "architect"
    },
    "frontend": {
      "model": "gemini-2.5-pro",
      "temperature": 0.3,
      "prompt": "You are the **Frontend Engineer**.\n\nResponsibilities:\n- Implement Next.js pages, components, and layouts.\n- Use TypeScript and Tailwind CSS.\n- Integrate Supabase SDK for authentication and data fetching.\n- Follow the plan from `architect.md`.\n\nFocus on:\n- Responsive, accessible, and performant UI.\n- Clean and reusable React components.\n- Proper SSR/ISR configuration.\n\nOutput files:\n- `app/` folder source files\n- `components/` and `lib/` utilities",
      "tools": {
        "write": true,
        "edit": true,
        "bash": false
      },
      "description": "Builds the Next.js frontend with Tailwind and Supabase integration",
      "mode": "subagent",
      "name": "frontend"
    },
    "backend": {
      "model": "gemini-2.5-pro",
      "temperature": 0.2,
      "prompt": "You are the **Backend Engineer**.\n\nResponsibilities:\n- Implement Supabase database schema, RLS policies, and functions.\n- Write Supabase Edge Functions or SQL procedures.\n- Handle security, performance, and data validation.\n- Align your work with the architecture defined by `architect.md`.\n\nFocus on:\n- Efficient and normalized schema design.\n- Secure RLS policies.\n- Well-documented API endpoints.\n\nOutput files:\n- `supabase/functions/*.ts`\n- `database/schema.sql`\n- `docs/backend_api.md`",
      "tools": {
        "write": true,
        "edit": true,
        "bash": false
      },
      "description": "Implements Supabase backend logic and APIs",
      "mode": "subagent",
      "name": "backend"
    },
    "devops": {
      "model": "gemini-2.5-pro",
      "temperature": 0.1,
      "prompt": "You are the **DevOps Engineer**.\n\nResponsibilities:\n- Set up environment variables for Supabase and Next.js.\n- Configure deployment (e.g., Vercel + Supabase).\n- Define CI/CD pipeline steps (GitHub Actions or similar).\n- Ensure seamless integration between frontend and backend.\n\nFocus on:\n- Environment reproducibility.\n- Secure handling of credentials.\n- Deployment reliability.\n\nOutput files:\n- `.env.example`\n- `.github/workflows/deploy.yml`\n- `docs/devops_setup.md`",
      "tools": {
        "write": true,
        "bash": true,
        "edit": true
      },
      "description": "Configures environment, CI/CD, and deployment for Next.js + Supabase",
      "mode": "subagent",
      "name": "devops"
    },
    "qa": {
      "model": "gemini-2.5-pro",
      "temperature": 0.1,
      "prompt": "You are the **QA & Reviewer Agent**.\n\nResponsibilities:\n- Review code quality and adherence to best practices.\n- Write test cases (unit and integration).\n- Identify performance or security concerns.\n- Provide constructive feedback, do not modify code directly.\n\nFocus on:\n- Code clarity, test coverage, and UX quality.\n- Security and data validation.\n- Regression and edge-case testing.\n\nOutput files:\n- `tests/qa_report.md`\n- `tests/*.spec.ts`",
      "tools": {
        "write": false,
        "edit": false,
        "bash": false
      },
      "description": "Reviews and tests the project for quality assurance",
      "mode": "subagent",
      "name": "qa"
    }
  },
  "mode": {},
  "plugin": [],
  "command": {},
  "username": "vrijmetse",
  "keybinds": {
    "leader": "ctrl+x",
    "app_exit": "ctrl+c,ctrl+d,<leader>q",
    "editor_open": "<leader>e",
    "theme_list": "<leader>t",
    "sidebar_toggle": "<leader>b",
    "status_view": "<leader>s",
    "session_export": "<leader>x",
    "session_new": "<leader>n",
    "session_list": "<leader>l",
    "session_timeline": "<leader>g",
    "session_share": "none",
    "session_unshare": "none",
    "session_interrupt": "escape",
    "session_compact": "<leader>c",
    "messages_page_up": "pageup",
    "messages_page_down": "pagedown",
    "messages_half_page_up": "ctrl+alt+u",
    "messages_half_page_down": "ctrl+alt+d",
    "messages_first": "ctrl+g,home",
    "messages_last": "ctrl+alt+g,end",
    "messages_copy": "<leader>y",
    "messages_undo": "<leader>u",
    "messages_redo": "<leader>r",
    "messages_toggle_conceal": "<leader>h",
    "model_list": "<leader>m",
    "model_cycle_recent": "f2",
    "model_cycle_recent_reverse": "shift+f2",
    "command_list": "ctrl+p",
    "agent_list": "<leader>a",
    "agent_cycle": "tab",
    "agent_cycle_reverse": "shift+tab",
    "input_clear": "ctrl+c",
    "input_forward_delete": "ctrl+d",
    "input_paste": "ctrl+v",
    "input_submit": "return",
    "input_newline": "shift+return,ctrl+j",
    "history_previous": "up",
    "history_next": "down",
    "session_child_cycle": "ctrl+right",
    "session_child_cycle_reverse": "ctrl+left"
  }
}

However I notice something strange, if I copy the opencode.json into my project root then I get this error mentioned here https://github.com/sst/opencode/issues/4230#issuecomment-3519609998. so means theres something wrong with my opencode.json ?

@vrijmetse commented on GitHub (Nov 11, 2025): I am using the latest 1.0.58 with global config at `~/.config/opencode/opencode.json` This is the result of my `opencode debug config` command, looks like its able to pick up my prompt correctly. ``` { "$schema": "https://opencode.ai/config.json", "agent": { "plan": { "model": "google/gemini-2.5-pro", "temperature": 0.3, "tools": { "write": false, "edit": false, "bash": false }, "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app", "mode": "primary" }, "build": { "model": "google/gemini-2.5-pro", "temperature": 0.3, "prompt": "You are the primary orchestrator agent.\n\nYour job is to:\n- Interpret the user's request or product goal.\n- Delegate architectural planning to the Architect agent.\n- Pass UI tasks to the Frontend agent.\n- Pass data and logic tasks to the Backend agent.\n- Ask the DevOps agent to configure and deploy.\n- Request the QA agent to review and test outputs.\n\nReturn a cohesive project summary or delivery plan.", "tools": { "write": true, "edit": true, "bash": true }, "description": "Primary orchestrator that coordinates all sub-agents to build a full-stack Next.js + Supabase app", "mode": "primary" }, "architect": { "model": "gemini-2.5-pro", "temperature": 0.2, "prompt": "You are the **System Architect**.\n\nYour responsibilities:\n- Analyze high-level product requirements.\n- Design the app architecture (Next.js frontend + Supabase backend).\n- Define database schema, API contracts, and auth flow.\n- Output results as clear, modular markdown or code snippets.\n\nFocus on:\n- Simplicity and scalability.\n- Developer experience (DX).\n- Secure, maintainable folder structure.\n\nOutput files:\n- `docs/architecture_plan.md`\n- `database/schema.sql`", "tools": { "write": true, "edit": true, "bash": false }, "description": "Plans the system architecture, data model, and overall structure", "mode": "subagent", "name": "architect" }, "frontend": { "model": "gemini-2.5-pro", "temperature": 0.3, "prompt": "You are the **Frontend Engineer**.\n\nResponsibilities:\n- Implement Next.js pages, components, and layouts.\n- Use TypeScript and Tailwind CSS.\n- Integrate Supabase SDK for authentication and data fetching.\n- Follow the plan from `architect.md`.\n\nFocus on:\n- Responsive, accessible, and performant UI.\n- Clean and reusable React components.\n- Proper SSR/ISR configuration.\n\nOutput files:\n- `app/` folder source files\n- `components/` and `lib/` utilities", "tools": { "write": true, "edit": true, "bash": false }, "description": "Builds the Next.js frontend with Tailwind and Supabase integration", "mode": "subagent", "name": "frontend" }, "backend": { "model": "gemini-2.5-pro", "temperature": 0.2, "prompt": "You are the **Backend Engineer**.\n\nResponsibilities:\n- Implement Supabase database schema, RLS policies, and functions.\n- Write Supabase Edge Functions or SQL procedures.\n- Handle security, performance, and data validation.\n- Align your work with the architecture defined by `architect.md`.\n\nFocus on:\n- Efficient and normalized schema design.\n- Secure RLS policies.\n- Well-documented API endpoints.\n\nOutput files:\n- `supabase/functions/*.ts`\n- `database/schema.sql`\n- `docs/backend_api.md`", "tools": { "write": true, "edit": true, "bash": false }, "description": "Implements Supabase backend logic and APIs", "mode": "subagent", "name": "backend" }, "devops": { "model": "gemini-2.5-pro", "temperature": 0.1, "prompt": "You are the **DevOps Engineer**.\n\nResponsibilities:\n- Set up environment variables for Supabase and Next.js.\n- Configure deployment (e.g., Vercel + Supabase).\n- Define CI/CD pipeline steps (GitHub Actions or similar).\n- Ensure seamless integration between frontend and backend.\n\nFocus on:\n- Environment reproducibility.\n- Secure handling of credentials.\n- Deployment reliability.\n\nOutput files:\n- `.env.example`\n- `.github/workflows/deploy.yml`\n- `docs/devops_setup.md`", "tools": { "write": true, "bash": true, "edit": true }, "description": "Configures environment, CI/CD, and deployment for Next.js + Supabase", "mode": "subagent", "name": "devops" }, "qa": { "model": "gemini-2.5-pro", "temperature": 0.1, "prompt": "You are the **QA & Reviewer Agent**.\n\nResponsibilities:\n- Review code quality and adherence to best practices.\n- Write test cases (unit and integration).\n- Identify performance or security concerns.\n- Provide constructive feedback, do not modify code directly.\n\nFocus on:\n- Code clarity, test coverage, and UX quality.\n- Security and data validation.\n- Regression and edge-case testing.\n\nOutput files:\n- `tests/qa_report.md`\n- `tests/*.spec.ts`", "tools": { "write": false, "edit": false, "bash": false }, "description": "Reviews and tests the project for quality assurance", "mode": "subagent", "name": "qa" } }, "mode": {}, "plugin": [], "command": {}, "username": "vrijmetse", "keybinds": { "leader": "ctrl+x", "app_exit": "ctrl+c,ctrl+d,<leader>q", "editor_open": "<leader>e", "theme_list": "<leader>t", "sidebar_toggle": "<leader>b", "status_view": "<leader>s", "session_export": "<leader>x", "session_new": "<leader>n", "session_list": "<leader>l", "session_timeline": "<leader>g", "session_share": "none", "session_unshare": "none", "session_interrupt": "escape", "session_compact": "<leader>c", "messages_page_up": "pageup", "messages_page_down": "pagedown", "messages_half_page_up": "ctrl+alt+u", "messages_half_page_down": "ctrl+alt+d", "messages_first": "ctrl+g,home", "messages_last": "ctrl+alt+g,end", "messages_copy": "<leader>y", "messages_undo": "<leader>u", "messages_redo": "<leader>r", "messages_toggle_conceal": "<leader>h", "model_list": "<leader>m", "model_cycle_recent": "f2", "model_cycle_recent_reverse": "shift+f2", "command_list": "ctrl+p", "agent_list": "<leader>a", "agent_cycle": "tab", "agent_cycle_reverse": "shift+tab", "input_clear": "ctrl+c", "input_forward_delete": "ctrl+d", "input_paste": "ctrl+v", "input_submit": "return", "input_newline": "shift+return,ctrl+j", "history_previous": "up", "history_next": "down", "session_child_cycle": "ctrl+right", "session_child_cycle_reverse": "ctrl+left" } } ``` However I notice something strange, if I copy the opencode.json into my project root then I get this error mentioned here https://github.com/sst/opencode/issues/4230#issuecomment-3519609998. so means theres something wrong with my opencode.json ?
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

@vrijmetse we made the error better on latest (1.0.61)

@rekram1-node commented on GitHub (Nov 11, 2025): @vrijmetse we made the error better on latest (1.0.61)
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

Where are these prompts defined?
"{file:./prompts/frontend.txt}",

I'd recommend using absolute paths unless they actually live in the same dir as ur project

@rekram1-node commented on GitHub (Nov 11, 2025): Where are these prompts defined? "{file:./prompts/frontend.txt}", I'd recommend using absolute paths unless they actually live in the same dir as ur project
Author
Owner

@vrijmetse commented on GitHub (Nov 11, 2025):

The prompts live in ~/.config/opencode/prompts Also I believe the location is correct, if you can see during my debug its able to load the txt content right.

I copied both prompts folder and opencode.json to my project still cant see the agents.

@vrijmetse commented on GitHub (Nov 11, 2025): The prompts live in ~/.config/opencode/prompts Also I believe the location is correct, if you can see during my debug its able to load the txt content right. I copied both prompts folder and opencode.json to my project still cant see the agents.
Author
Owner

@vrijmetse commented on GitHub (Nov 11, 2025):

I even tried to remove the prompts from my project opencode.json. I can only launch the opencode ui but no new agents visible. Only the default build and plan are there.

@vrijmetse commented on GitHub (Nov 11, 2025): I even tried to remove the prompts from my project opencode.json. I can only launch the opencode ui but no new agents visible. Only the default `build` and `plan` are there.
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

@vrijmetse subagents cant be toggled to, but you can @ reference them

@rekram1-node commented on GitHub (Nov 12, 2025): @vrijmetse subagents cant be toggled to, but you can @ reference them
Author
Owner

@vrijmetse commented on GitHub (Nov 12, 2025):

Ouch, then its working fine. Sorry for the rookie mistakes. Thanks for the help!

@vrijmetse commented on GitHub (Nov 12, 2025): Ouch, then its working fine. Sorry for the rookie mistakes. Thanks for the help!
Author
Owner

@rekram1-node commented on GitHub (Nov 12, 2025):

no prob

@rekram1-node commented on GitHub (Nov 12, 2025): no prob
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2795