Connect an agent to the gateway
An agent built on another platform is observed when MeetLoyd finds it: it is in your register, but nothing it does passes through MeetLoyd. It becomes gatewayed when it sends its model calls to the MeetLoyd gateway instead of its model provider. From then on, every call it makes is identified, checked and recorded — and refused when you halt it.
This page explains what the gateway key is, where it goes, and which agents can use it.
What you need
| Base URL | https://api.meetloyd.com/api/v1/gateway/v1 |
| Key | The agent's gateway key (mlg_…), minted on the agent's page: Agents → the agent → Gateway credentials → Mint. It is shown once; store it in the platform's secret store, never in code. |
| Authentication | Authorization: Bearer mlg_… on every request. |
| Protocol | OpenAI-compatible Chat Completions, including streaming and function calling. |
| A model key | Calls run on your organisation's own key for the model's vendor (Models → Providers & keys). Without one, the call is refused (byok_required). |
The key is the agent: whoever holds it acts as that agent. Two settings bound it, both on the same panel:
- Expiry, chosen when you mint.
- Allowed source addresses: the addresses or ranges the agent calls from. Calls from anywhere else are refused and recorded. With no list, a leaked key works from anywhere until you revoke it.
Revoking a key takes effect on the next call.
The change in the agent
For an agent whose code you control, two values change: the base URL and the API key. Nothing else — prompts, framework and memory stay where they are.
Python (OpenAI SDK):
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.meetloyd.com/api/v1/gateway/v1",
api_key=os.environ["MEETLOYD_GATEWAY_KEY"],
)
reply = client.chat.completions.create(
model="claude-sonnet-4-6", # any model your organisation approves
messages=[{"role": "user", "content": "Summarise invoice INV-1042"}],
)
JavaScript / TypeScript (OpenAI SDK):
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.meetloyd.com/api/v1/gateway/v1',
apiKey: process.env.MEETLOYD_GATEWAY_KEY,
})
const reply = await client.chat.completions.create({
model: 'claude-sonnet-4-6', // any model your organisation approves
messages: [{ role: 'user', content: 'Summarise invoice INV-1042' }],
})
The agent names the model it wants; your model policy approves or refuses it. No model is deployed on MeetLoyd for the agent.
Which agents can be connected
| Agent | Can it be connected? | How |
|---|---|---|
| Your own code (LangGraph, CrewAI, AutoGen, a custom service) | Yes | Set the base URL and key in the code, as above. |
| AWS Bedrock AgentCore runtime | Yes | The runtime runs your container or code package: set the base URL in that code, and pass the key from your secret store. |
| AWS Bedrock AgentCore harness | Yes | Configure the harness model with an OpenAI-compatible endpoint: openAiModelConfig with apiBase set to the base URL above and apiFormat set to chat_completions (or liteLlmModelConfig with apiBase). Store the gateway key in AgentCore Identity as an API-key credential provider and reference it with apiKeyArn; the harness sends it with each call. See AWS's harness model documentation. |
| Microsoft Copilot Studio | No | The model runs inside Copilot Studio; its calls never leave Microsoft. The agent stays observed. |
| Microsoft Foundry agents | Yes | On the agent's page, Govern through MeetLoyd routes its model through the gateway with a connection in its Foundry project, and adds the MeetLoyd tools. A second person approves; its instructions and other tools are left as they are. |
| Google Vertex AI Agent Engine code agents | Yes | On the agent's page, Govern through MeetLoyd: you name the variables your code reads for the model and tools endpoints, and the gateway key is placed in a Secret Manager secret of the agent's project. |
| Classic Bedrock Agents, Salesforce Agentforce, other Vertex AI agents, Prisme.ai | Only if the platform lets you set the model endpoint | Where it does not, the agent stays observed. |
A key minted for an agent that cannot send us its calls is never used, and governs nothing. The agent's page says so: an agent counts as gatewayed only once its calls actually reach the gateway.
What happens on each call
In this order, before the model is called:
- Key — unknown, revoked or expired: refused.
- Source address — outside the allowed list: refused and recorded.
- Halt — the agent is paused or its team stopped: refused. This is your kill switch for an agent built elsewhere.
- Budget — over its limit: refused or throttled, as your budget rule says.
- Content checks — prompt injection, guardrails, moderation, personal data.
- Model — your model policy, then the call on your own key.
Then the call is metered against the agent's budget and written to the audit trail.
Tools
Tool access is deny by default: an agent with no tool grants is offered no tools.
- Function calling: tools the agent declares in its request reach the model only if granted. Each tool call the model returns is checked against the grants before it reaches the agent; a refused call is withheld.
- Tools run by MeetLoyd:
GET /toolslists the tools the agent is granted;POST /tools/callwith{"name": "...", "arguments": {...}}runs one, through the same checks.
Grants are set per agent with PUT /api/v1/governed-agents/{agentId}/tools and the body {"grants": ["tool_name", ...]}. An empty list removes all tool access.
On the agent's page, Tool grants at the gateway shows the same grants. Each grant can carry conditions — an expiry, a time window in a time zone, the networks the call must come from, a purpose — and holds only while all of them hold. A grant can also be delegated to another governed agent, which then holds it under every condition from above plus its own: delegation only narrows. Withdrawing a grant withdraws what was delegated from it.
Tools over MCP
An agent whose model runs inside its vendor's platform can still reach the tools you grant it, through the MeetLoyd MCP server at https://api.meetloyd.com/mcp/jsonrpc (Streamable HTTP). It goes through the same key, source-address, halt and grant checks as above, and it is offered only its granted tools.
| Platform | Authentication to choose | What to enter |
|---|---|---|
| Microsoft Copilot Studio | API key, type Header | Header name X-API-Key; the agent's gateway key as the value. |
| Salesforce Agentforce (Agentforce Registry) | OAuth 2.0 | Identity provider URL https://api.meetloyd.com/api/v1/oauth/token; client ID = the OAuth client ID line under the key on the agent's page; client secret = the gateway key; leave the scope empty. |
| Any other MCP client | Bearer token | Authorization: Bearer <gateway key>. |
With OAuth, the platform exchanges the key for an access token valid for one hour. Revoking the key ends the token at its next call.
Agentforce: make the action required. In Agentforce Builder, add the MeetLoyd action to the sub-agent that handles the request, not only to another one, and say in that sub-agent's reasoning instructions that it must call the action (for example: Always call the "current_time - MeetLoyd" action to answer; never answer from your own knowledge). An action that is only available is optional for the Agentforce planner: when the model believes it already knows the answer, it skips the call, and nothing reaches MeetLoyd. Each call that does reach MeetLoyd is authorized against the agent's grants and appears in its audit trail.
Refusals
Refusals use the OpenAI error format (error.message, error.type, error.code), so the agent's SDK raises them like any provider error.
| Status | code | Meaning |
|---|---|---|
| 401 | not_found, revoked, expired, malformed | The key is not valid. |
| 402 | budget_blocked | The agent's budget is spent. |
| 402 | byok_required | Your organisation has no key for this model's vendor. |
| 403 | agent_halted | The agent or its team has been stopped. |
| 403 | source_not_allowed, source_unknown | The call came from an address outside the allowed list, or its address could not be determined. |
| 403 | prompt_injection_detected, outside_agent_purpose, policy codes | A governance check refused the content. |
| 429 | budget_throttled | Throttled by a budget rule; retry after the Retry-After delay. |
| 502 | — | The model provider failed. |
Related
- Discovery sources — how agents are found and what each platform lets us read.
- Governing external agents — the three depths: observed, gatewayed, native, and what each draws in credits.