Guide
Heropa

AI agents in hands-on labs: AI Lab Keys, agents and sandboxes

How to give learners, partners and prospects AI agents inside hands-on labs, demos and POCs, safely and with spend under control.

AI agents in virtual labs are AI assistants and coding agents that run inside a hands-on lab, demo or POC so learners, partners and prospects can use them against real software. The safe way to provide them is a virtual key per user, minted when the lab launches, scoped to approved models, a budget and a duration, and expired with the environment. The provider key never enters the lab, cost is capped per seat, and spend is attributed to each user, course or deal.

Key takeaways
  • Every AI tool in a lab needs a key to reach a model, and that key is live access to a paid service, so deciding whose key sits in the lab is the core design question.
  • Per-user virtual keys, minted at launch and expired with the environment, keep the provider key out of the lab and make revocation precise.
  • AI cost scales with the work rather than the clock, so set a budget, allowed models and a duration on every key instead of relying on session time limits.
  • Prospects increasingly want to point their own agent at your API, CLI or MCP server, which makes isolated, scoped AI-enabled POCs a sales requirement.
  • Attributing spend per user, cohort and sales opportunity is what lets you report what a class, demo or POC actually cost.

What are AI agents in virtual labs, and why now?

AI agents in virtual labs are AI tools, from chat assistants to coding agents, that run inside a hands-on lab, demo or proof of concept so learners, partners and prospects can use them against real software. The lab provides the environment, the software and the data. The agent provides a new way to work with all three.

An AI agent is software that uses a large language model to plan steps, call tools and act on the results until a task is done. That ability to act, rather than only reply, is what agentic AI describes, and it is why agents now show up in training plans and sales cycles. More software ships with an API, a CLI or an MCP server so that customers can reach it through the AI tools they already trust. A capability nobody can try is a capability that is hard to teach and hard to sell.

That changes what a lab has to do. Teams running AI labs are typically trying to do one of three things:

  • Teach AI tools themselves, such as an AI coding course where the tool learners came to learn must be open and working the moment they log in.
  • Teach a product with AI beside it, where an assistant explains log lines, diagnoses a broken cluster or drafts configuration while the learner focuses on the skill.
  • Let people drive a product with their own agent, where a prospect or partner points third-party AI agents at your API, CLI or MCP server and judges the result for themselves.

Installing the agent is usually the easy part. The hard part is that every agent needs a key to reach a model, and that key is live access to a paid service. A lab is a copy: the same software, data and configuration for every user. A key is not a copy. Deciding whose key sits inside the lab, what it can spend and how long it lives is the central design question of AI in virtual labs, and most of this guide is about answering it well.

What are the core concepts behind AI in hands-on labs?

The core concepts are a per-user key, the limits attached to it, the way it is delivered into the lab, and the isolated environment the agent works in. Each has a glossary entry if you want the full definition.

AI lab keys

AI lab keys are per-user AI API keys issued inside a lab, demo or POC. Each key is minted at launch, scoped to approved models, a budget and a duration, and expires with the environment. The organization's provider key stays protected and never enters the lab.

Virtual API keys

A virtual API key is a stand-in credential. Requests made with it pass through a platform or proxy that checks the key's own rules, then forwards the call using the real provider key, which the holder never sees. Virtual keys are what make per-user limits possible without creating a new provider account for every learner.

Ephemeral keys

Ephemeral API keys are bound to the session or environment they were created for and stop working when it ends. Nobody has to remember to rotate them, and a key left in a lab image or a screenshot cannot be reused next week.

Per-seat budgets and model allowlists

A per-seat AI budget gives each user a fixed allowance, so total AI cost for a class or event is capped before anyone arrives and one heavy user cannot exhaust access for everyone else. A model allowlist restricts which models a key may call. Together with a duration, these are the three settings that define a key: budget, models and how long access lasts.

Credential injection and credential pools

Credential injection places each key into the AI tooling as the environment is built, so the user never finds, copies or pastes a credential. A credential pool is the managed set of credentials the platform allocates one per user and reclaims when they finish. The same pattern has long been used for cloud accounts and application logins in labs; AI keys are a new kind of credential in the pool.

Agent labs and agent sandboxes

An agent lab is a lab designed around an agent: the exercise, the expected output and the likely failure points are planned in advance. An AI agent sandbox is the isolation that makes it safe, with contained compute, restricted access and scoped, expiring credentials, so an agent that misreads a goal only affects a disposable environment.

Bring your own key

Bring your own key (BYOK) means connecting your own AI provider account so usage runs under your existing agreements and billing. In labs it is usually the organization, not the learner, that brings the account, and the platform mints per-user keys from it.

How do per-user AI keys work in a lab, step by step?

Per-user AI keys work by storing the provider key once, attaching rules to a lab template, and minting a scoped virtual key for each person when the environment launches. A typical lifecycle has five stages.

  1. Configure. Connect an AI provider account, or use a provider account managed by the lab platform. The provider key is stored once, outside any lab.
  2. Attach. Define a profile for the AI access and attach a pool of keys to the lab template. Set the allowed models, the budget per seat and the expiry.
  3. Mint. When an environment is created and launched, the platform creates a key for each person and reserves that key's budget against the available balance.
  4. Inject. Each key is written into the AI tooling in the lab, such as a coding agent in VS Code or a chat interface beside the exercise, so the tool is authenticated before the user logs in.
  5. Return. When the lab is destroyed, its keys expire with it. Unspent budget goes back to the balance, and the spend is recorded against the environment, the user and the program that used it.

Two details matter in practice. First, AI cost is measured in LLM tokens, and token usage scales with the work, not the clock. Two people on the same exercise can use very different amounts depending on how they prompt, which model answers and whether an agent loops. That is why the budget belongs on the key, not just on the session timer. Second, when a key reaches its cap, AI calls stop being authorized but the lab keeps running. The software, the data and the rest of the exercise are unaffected. Some agents report a clear error when this happens and others fail in ways that look like a broken lab, so test the behavior before a cohort, not during one.

Because each key belongs to one person, API key revocation is precise. You can revoke or reissue a single user's key, or every key in one environment, without disrupting anyone else.

Shared key, learner-supplied key or per-user virtual key: what is the difference?

The difference is who carries the risk, the cost and the setup work. Most teams try these options in order before settling on per-user virtual keys.

  • Learner brings their own key: moves cost and risk off your account, but moves setup onto someone who came to learn or to evaluate your product. Many learners have no personal provider account, and few prospects will set up billing with a third party to sit through a demo.
  • One shared key in the template: the most reliable way to make the AI work on boot, and the riskiest. The key is visible to everyone who touches the lab and outlives the session. Any one user, or one runaway agent loop, can spend the whole budget. The bill arrives as one number with no breakdown, and rotating the key breaks every lab that uses it at once.
  • A corporate or employee account: works for internal demos until a sales engineer hits an internal spend cap mid-demo, and it mixes customer-facing usage with the team's own work.
  • A self-run AI gateway: provides virtual keys, budgets and logging, but it is infrastructure your team has to host, secure and maintain, and it knows nothing about labs. Someone still has to mint keys per session, place them in each environment and clean them up afterwards.
  • Per-user virtual keys issued by the lab platform: one key per person per environment, minted at launch with its own models, budget and expiry, injected into the tooling and expired with the environment. The provider key never enters the lab, cost is capped per seat, and spend is attributed automatically.

Good AI API key management in labs therefore looks less like distributing keys and more like provisioning them: the key becomes one more resource the environment creates and destroys, just like the virtual machines and application accounts around it.

How do different teams use AI agents in labs?

Training, sales engineering, partner and events teams all use AI in labs, but each optimizes for something different: learning outcomes, evaluation quality, consistency at scale or speed on the day.

Technical training and customer education

Training teams run AI coding courses where an AI coding agent is open and authenticated in VS Code at launch, and the exercise is to build something with it. They also use AI-assisted learning, where an assistant sits beside a security operations exercise to explain suspicious log lines or helps diagnose a broken Kubernetes cluster, so learners spend the session on the fix. Courses on prompt engineering and broader AI upskilling need the same thing: real tools, real models and no account setup. Both instructor-led and self-paced formats work, and the next cohort runs the same course with a fresh set of keys.

Sales engineering, demos and POCs

In an AI-enabled POC, the prospect evaluates your software with an AI agent, often the one they already use, pointed at your API, CLI or MCP server. The sales engineer prepares the tooling in advance and scopes a key to that evaluation, for example a few hours and a set budget. The prospect opens an isolated environment and runs the workflows that matter to them. Spend is recorded against the sales opportunity, kept separate from the AI the sales team uses for its own work, and the key expires with the POC so the next prospect starts clean. See sales demos and POCs for how lifecycle controls apply to those environments.

Partner enablement

Partners need the same agent-ready labs your own teams use, delivered consistently across regions. Per-user keys let partner trainers run classes without receiving your provider credentials, and usage can be reported per partner. See partner enablement.

Events, workshops and hackathons

Events concentrate many users into a short window. A budget per seat fixes the AI cost of the event in advance, and isolated environments mean one team's experiment cannot affect another's. Where agents need accelerated hardware for local models or inference work, GPU labs supply it without asking participants for a powerful machine.

How should you evaluate a platform for AI agents in labs?

Evaluate a platform on whether it treats AI access as part of lab provisioning, with per-user keys, limits, attribution and teardown handled automatically. Use this checklist with your security, finance and enablement stakeholders.

  • Provider key isolation: is the provider key stored once, outside every environment, and never visible to users?
  • One key per user per environment: are keys minted automatically at launch, or does someone distribute them by hand?
  • Limits per key: can you set the budget, the allowed models and the duration for each key, per template?
  • Injection into tooling: is the key placed into the agent or assistant you chose, so it is authenticated before the user logs in?
  • Expiry and revocation: do keys expire with the environment, and can you revoke or reissue one user's key without touching anyone else?
  • Behavior at the cap: when a budget is reached, does AI stop while the lab keeps running?
  • Attribution: is spend recorded per user, environment, course and sales opportunity, so AI usage attribution is built in rather than estimated from an invoice?
  • Visibility during a session: can admins watch usage while labs run, and can learners see their remaining budget and time?
  • Provider choice: does it support the providers and models your audience expects, under your own provider account or a managed one?
  • Agent surfaces: can a lab expose your API, CLI and MCP server so agents that rely on tool calling can act on your product?
  • Isolation: is every user's environment separate, with network and access scoped to the exercise?
  • Lifecycle: do time limits, idle shutdown and teardown apply to AI access as well as compute?

The attribution and limits questions are where AI spend management succeeds or fails. If spend cannot be tied to a cohort or a deal, you cannot say what a program costs to run twice.

What are the governance risks and common pitfalls?

The main risks are credential exposure, unbounded spend, unattributed usage and agents acting on untrusted input. Most pitfalls come from treating AI access as a one-off install rather than a governed, per-session resource.

  • Keys baked into images. A key stored in a template is copied into every environment launched from it and survives long after the session ends. Inject keys at launch instead.
  • Time limits mistaken for cost controls. A two-hour lab can still produce a large token bill. Keep time limits, but set a budget on every key.
  • Models left wide open. A course that needs a small model should not be able to call the most expensive one. Some tools default to the strongest model available, so the allowlist is the cheapest lever you have.
  • Untested failure modes. Run each lab yourself, measure what a thorough attempt consumes, set the ceiling with headroom, and check what the agent shows a user when the cap is reached.
  • Prompt injection. Prompt injection is most dangerous when a model can take actions. Keep agents inside isolated environments with only the access the exercise requires.
  • Shadow AI in customer-facing work. When teams have no sanctioned way to provide AI in labs, people paste in personal or corporate keys. That is shadow AI with your customers watching.

Strong AI governance for labs starts with three questions. Ask your security team for a written position on AI provider credentials in customer-facing environments. Ask whoever owns the AI budget whether spend can be attributed to a cohort, evaluation or deal today. Ask the product team which agent surfaces a customer may drive unsupervised. An AI sandbox with scoped, expiring keys makes the answers enforceable rather than aspirational.

How does Heropa approach AI agents in virtual labs?

Heropa approaches AI agents in virtual labs by making the AI key part of the lab itself: a virtual key per user, minted at launch and expiring with the environment, alongside the templates, credentials and lifecycle controls customers already use.

With AI Lab Keys, your AI provider key is stored once, in a dedicated AI cloud account inside the Heropa platform. You create an AI Profile, then attach a set of keys, known as a credential pool, to a Template, setting the models, budget per seat and expiry. When the lab launches, Heropa mints a key for each person, reserves its budget against your balance and injects it into the tooling you chose, such as Claude Code in VS Code or Open WebUI beside a guided exercise. Keys run on the same credential pool machinery as the Credential Manager customers use for cloud accounts and external systems.

  • Providers: Anthropic, OpenAI, Google Gemini and Amazon Bedrock.
  • Your account or ours: bring your own AI provider account and keep your existing agreements and rates, or use Heropa-managed access, load a balance and top up as you go.
  • Control: usage updates in real time, keys can be revoked or reissued per environment or per user, and key details can be shown or hidden.
  • Learner view: the Lab Workspace shows learners their remaining AI budget and time.
  • Attribution: spend is recorded per user and per lab, and for POCs against each sales opportunity. When a cap is hit, AI usage stops and the environment carries on.

Separately, the Heropa MCP server uses the Model Context Protocol to connect Claude to your Heropa account, so admins can build templates, lab guides, courses and events by describing what they need, with per-tool permissions.

For more detail, read Introducing AI Lab Keys, putting AI in labs without sharing your API key, why AI spend in labs is hard to control and the Heropa MCP announcement, or book a demo.

FAQ

Frequently asked questions

How do I give each learner their own OpenAI or Anthropic API key in a lab?

Store your provider key once on the lab platform and issue each learner a virtual key minted when their environment launches. Each virtual key carries its own budget, allowed models and expiry, is injected into the AI tooling before the learner logs in, and expires when the lab is destroyed. Learners never see or handle the real provider key, and you never distribute keys by hand.

Is it safe to share one AI API key across a training class?

It works, but it is the riskiest option. A shared key is visible to everyone who touches the lab and outlives the session. Any one user or a looping agent can spend the whole budget, the invoice arrives with no breakdown by cohort or course, and rotating the key breaks every lab that uses it at the same time. Per-user virtual keys avoid all four problems.

What happens when a learner runs out of AI budget in a lab?

With per-user keys, AI calls stop being authorized for that learner only. The lab keeps running, so the software, data and the rest of the exercise are unaffected, and everyone else in the class continues on their own allowance. How the agent reports the stop varies by tool, so test it before a cohort and tell learners what they will see.

How much AI budget does a learner need for a hands-on lab?

It depends on the exercise and the model. Run the lab yourself, measure what a thorough attempt consumes, and set the per-key ceiling with headroom above that. A short guided exercise on a small, fast model needs little, while an agentic coding build or a multi-day workshop on a frontier model needs considerably more. Restricting models often moves cost more than usage does.

Can prospects use their own AI agent in a software POC?

Yes. In an AI-enabled POC, the prospect points the agent they already use at your API, CLI or MCP server inside an isolated environment. The vendor scopes a key to that evaluation with a budget, allowed models and duration, records spend against the sales opportunity, and the key expires with the POC so each prospect starts with a clean slate.

Do I need an AI gateway to put AI in virtual labs?

Not necessarily. A self-hosted AI gateway can issue virtual keys and enforce budgets, but you host, secure and maintain it, and it does not know about labs, so someone still has to mint keys per session, inject them into each environment and clean up afterwards. A lab platform that mints per-user keys as part of provisioning handles that lifecycle for you.

With Heropa, building, managing or scaling a hands-on lab is simple.

See for yourself.