Skip to main content

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 URLhttps://api.meetloyd.com/api/v1/gateway/v1
KeyThe 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.
AuthenticationAuthorization: Bearer mlg_… on every request.
ProtocolOpenAI-compatible Chat Completions, including streaming and function calling.
A model keyCalls 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​

AgentCan it be connected?How
Your own code (LangGraph, CrewAI, AutoGen, a custom service)YesSet the base URL and key in the code, as above.
AWS Bedrock AgentCore runtimeYesThe 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 harnessYesConfigure 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 StudioNoThe model runs inside Copilot Studio; its calls never leave Microsoft. The agent stays observed.
Microsoft Foundry agentsYesOn 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 agentsYesOn 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.aiOnly if the platform lets you set the model endpointWhere 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:

  1. Key — unknown, revoked or expired: refused.
  2. Source address — outside the allowed list: refused and recorded.
  3. Halt — the agent is paused or its team stopped: refused. This is your kill switch for an agent built elsewhere.
  4. Budget — over its limit: refused or throttled, as your budget rule says.
  5. Content checks — prompt injection, guardrails, moderation, personal data.
  6. 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.

The checks every gateway call passes in order: key, source address, halt, budget, content checks, then the model on your own key.The checks every gateway call passes in order: key, source address, halt, budget, content checks, then the model on your own key.

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 /tools lists the tools the agent is granted; POST /tools/call with {"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.

PlatformAuthentication to chooseWhat to enter
Microsoft Copilot StudioAPI key, type HeaderHeader name X-API-Key; the agent's gateway key as the value.
Salesforce Agentforce (Agentforce Registry)OAuth 2.0Identity 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 clientBearer tokenAuthorization: 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.

StatuscodeMeaning
401not_found, revoked, expired, malformedThe key is not valid.
402budget_blockedThe agent's budget is spent.
402byok_requiredYour organisation has no key for this model's vendor.
403agent_haltedThe agent or its team has been stopped.
403source_not_allowed, source_unknownThe call came from an address outside the allowed list, or its address could not be determined.
403prompt_injection_detected, outside_agent_purpose, policy codesA governance check refused the content.
429budget_throttledThrottled by a budget rule; retry after the Retry-After delay.
502—The model provider failed.