A secure network zone is not a small trusted intranet. It is an identity-based microsegment in which the agent has only the connection paths that its task requires.
In our previous article, we discussed the 12 controls a company should implement before allowing an AI agent to access real systems. These include the agent’s own identity, restricted network connections, tool-specific authorisation, human approval, logging and a tested kill switch. [1]
In this article, we focus on one of these layers: technically restricting an AI agent’s network access with Tailscale.
The goal is not to build a small internal network in which the agent can move freely. The goal is an identity-based microsegment in which only the connection paths required by the agent’s task exist.
Network access requirements
The agent may connect to
- the approved LLM gateway on port 443
- the approved tool API on port 443.
The agent must not connect to
- production database
- ERP system directly
- the administration server
- employee endpoints
- other agents
- the public internet without a managed gateway.
This is a much more specific security feature than the generic claim that the agent is “behind the VPN”.
A secure network zone is not the same as a trusted internal network
A traditional network segment is often built around a VLAN, subnet, or firewall zone.
For example, an agent can be placed on a network:
10.40.20.0/24
A firewall may block traffic to other subnets, but workloads within the same network may still see each other. Network policy is primarily based on IP addresses and network location.
In the Tailscale architecture, the network zone can be modelled differently:
In a Tailscale Grants policy, a connection is defined by at least three pieces of information:
src = who or what is allowed to initiate the connection
dst = to which resource the connection can be established
ip = what protocol and port to use
The Grants rule model is deny-by-default: a connection is not allowed unless the complete policy contains a matching rule. A new tailnet can nevertheless include a broad pre-populated policy, so that starter policy must be replaced before least privilege is achieved. The Tailscale control plane distributes identity, key and policy information to devices, while WireGuard-encrypted data traffic remains in the data plane. Netmap trimming reduces peer information, but a device can still see permitted destinations, usable exit nodes, devices authenticated as the same user and devices that may initiate connections to it. [2] [21] [23]
A secure network zone is therefore, in practice, a graph of allowed connections:
Reachability(ai-agent) = {
ai-llm-gateway:443,
ai-tool-gateway:443
}
Everything else remains outside the graph.
Reachability(ai-agent, prod-db:5432) = false
Reachability(ai-agent, prod-admin:22) = false
Reachability(ai-agent, erp-api:443) = false
This corresponds to the access path thinking used by Defense First:
- Identify
- Model
- Implement
- Prove
First, the actual business need is identified. The connection path is then modelled, enforced with the Grants policy and proven with both allowed and denied tests. [3]
Threat model: assume the agent misbehaves
The reference architecture should not be designed only around normal agent behaviour.
The initial assumption of the architecture should be that one of the following occurs:
- The agent interprets the task incorrectly.
- The agent reads a document containing a prompt-injection attack.
- The tool used by the agent or the MCP server is compromised.
- A software dependency used by the agent is compromised in a supply-chain attack.
- The agent's workload identity or application ID is stolen.
- Code execution is obtained in the agent execution environment.
- An agent is trying to reach a system it should not be using.
OWASP identifies agent-goal hijacking, tool misuse, identity and permission abuse, agentic supply-chain weaknesses and unexpected code execution among the risks of agent systems. International government guidance therefore recommends tightly restricted resources and actions, least privilege, short-lived credentials, isolation and gradual deployment. [4] [22]
The security goal of the network layer is not: the agent never tries to do anything dangerous.
A better goal is: even if an agent tries to perform a dangerous operation, the required network path does not exist.
The reference architecture for this article is based on the following security requirements:
- I1The agent has no direct connection to the database.
- I2The agent does not have a direct connection to the ERP system.
- I3The agent does not have an SSH or management connection to production.
- I4The agent does not hold the model provider’s API key.
- I5The agent accesses business systems only through the tool and API gateway.
- I6Reading, approval and writing are separated into different services and identities.
- I7Traffic to the public internet only goes through a separately managed gateway.
- I8Each allowed and blocked Tailscale connection is tested.
- I9Agent network access can be removed centrally.
- I10Actions performed by the agent can be correlated across network, tool and application logs.
Reference architecture
The architecture below is suitable, for example, for an agent handling invoices, support requests, customer data or other internal business processes.
Low Trust Zone
tag:ai-agent-invoice-prod- agent framework and model context
- limited memory
- isolated tool execution
LLM gateway
Keys, approved models, cost and rate limits, and managed egress.
Tool and API Gateway
Allowed tool list, parameter validation, authentication and event logs.
In the architecture, the agent is a deliberately low-trust workload.
The agent is allowed to process untrusted content and generate suggestions, but cannot directly connect to high-impact systems.
Component 01
AI Agent Execution Environment
The Agent Execution Environment includes language model orchestration, context, memory, and any code or tool execution.
This environment is treated as potentially compromised.
The agent must not contain:
- production database credentials
- general ERP administration credentials
- SSH keys
- long-lived model-provider API keys
- Tailscale control-plane administrative permissions
- permission to change their own tags or Grants policies.
The agent's own Tailscale identity gives it only two connection paths: the LLM Gateway and the Tool API Gateway.
Component 02
LLM gateway
The LLM gateway forwards agent model calls to an approved model provider.
Its tasks may include:
- holding model-provider API keys
- restricting access to approved models
- user and agent usage limits
- token and cost limits
- request classification
- data filtering
- logging
- model provider switching in a controlled manner.
The agent does not need the external model service’s credentials. It authenticates to the internal LLM gateway with its own workload identity.
Tailscale is also developing the Aperture gateway for this purpose, centralising model access, model-provider credentials and telemetry. As verified on 29 July 2026, Aperture is beta. Its evaluator is deny-by-default when no grant matches, but a new instance currently includes a broad starter configuration that grants all users administrative access and access to all configured models. Replace and test that configuration before production use. Aperture does not remove the need for authorisation in target applications, tools and data services. [5] [24]
Component 03
Tool and API Gateway
The tool and API gateway is the control point between the agent and the business systems.
The agent does not directly contact the ERP system or database. It calls well-defined tools, for example:
get_invoice(invoice_id)
get_supplier(supplier_id)
create_invoice_draft(invoice_data)
request_payment_approval(payment_data)
The task of the gateway is to check:
- whether the agent in question is allowed to use the tool
- whether the parameters are in the correct format
- whether the requested record falls within the agent’s allowed scope
- whether the request exceeds the risk limit of the amount or quantity
- whether the operation requires human approval
- whether the number of calls is abnormal
- whether the operation should be suspended.
Network policy determines whether the agent can reach the gateway. Tool policy determines what the agent may do through it.
Component 04
Separate read API
Read operations should be separated from write operations.
For example, an agent or tool API can retrieve:
- one invoice’s details
- one customer’s contract level
- one supplier’s master data
- history of one support request.
The read API does not need to provide a generic SQL connection to the database.
Bounded API
Single Named Object
GET /invoices/7421
Too Broad Access
Arbitrary SQL
SELECT * FROM invoices;
The read API can enforce object-level authorisation, data minimisation and result filtering before returning data to the agent.
Component 05
Approval Service
High impact actions are not given to the agent to perform directly.
An agent can form a proposal:
{
"action": "create-payment",
"invoice_id": "7421",
"recipient": "FI00 0000 0000 0000 00",
"amount_eur": 1240.00
}
The approval service shows the human the exact action, not just a verbal summary written by the agent.
Approval should be bound to:
- agent identity
- exact action
- target resource
- amount
- recipient
- approver
- validity period
- unique nonce value.
If the agent changes the amount, recipient, or other relevant parameter after approval, the approval is no longer valid.
Component 06
Write-action executor
The actual change is done by a separate workload, not an AI agent.
The write-action executor:
- receives an approved action object
- checks a signature or proof of authorisation
- checks the validity of the approval
- checks that the operation has not already been performed
- only executes a predefined API call
- stores the result and the correlation ID.
The write-action executor may connect to the ERP system’s restricted API. It still needs no direct database access or SSH administration path.
Agent identity and tag structure
In Tailscale, servers, containers, automation, and other non-personal devices can be identified with tags.
A tag is not just a descriptive label. It is used as the identity of the workload and as the source or target selector for the Grants policy. When a device is tagged, it is treated as a tag identity instead of the user's personal identity. [6]
A generic tag should be avoided:
tag:ai-agent
It does not tell what the agent does, in which environment it operates, whether it has read or write permissions, or what system it is associated with.
A better tag might be:
tag:ai-agent-invoice-prod
Or more specifically:
tag:ai-invoice-reader-prod
tag:ai-invoice-drafter-prod
tag:ai-payment-executor-prod
One identity for one purpose
Development, test and production environments should not be combined with the same identity:
tag:ai-agent-invoice-dev
tag:ai-agent-invoice-test
tag:ai-agent-invoice-prod
Similarly, reading and writing operations should be separated:
tag:ai-invoice-reader-prod
tag:ai-invoice-write-executor-prod
The permissions of Tailscale tags are combined additively. If multiple tags are assigned to the device, the permissions obtained through all tags can take effect. The combination of tags cannot be treated as a requirement "tag A and tag B" in the standard rule, so clear combination tags should be used instead of unclear combinations of many tags. [6]
Ambiguous combination
Three additive tags
tag:ai-agent
tag:production
tag:finance
Intent
One combination tag
tag:ai-finance-agent-prod
Permission to assign a tag is high-risk
tagOwners defines who can associate a device with a specific tag identity.
If an attacker can assign this tag to their own workload:
tag:ai-write-executor-prod
they may also obtain the network paths granted to that identity.
Permission to assign tags must therefore be restricted to a security administration group or controlled automation. tagOwners delegates who may assign the identity through normal workflows; tailnet Owners, Admins and Network admins can apply any tag as part of their administrative role. Tag ownership does not itself grant network access, which is defined separately in Grants. [6] [7]
Smallest functional Grants implementation
The first version can be built with one agent and one gateway.
ai-agent-read-prod → ai-tool-gateway-prod:443ai-agent-read-prod → prod-db:5432ai-agent-read-prod → prod-admin:22Illustrative Tailscale policy:
{
"groups": {
"group:security-admins": [
"security-admin@example.com"
]
},
"tagOwners": {
"tag:ai-agent-read-prod": [
"group:security-admins"
],
"tag:ai-tool-gateway-prod": [
"group:security-admins"
],
"tag:prod-db": [
"group:security-admins"
],
"tag:prod-admin": [
"group:security-admins"
]
},
"grants": [
{
"src": [
"tag:ai-agent-read-prod"
],
"dst": [
"tag:ai-tool-gateway-prod"
],
"ip": [
"tcp:443"
]
}
],
"tests": [
{
"src": "tag:ai-agent-read-prod",
"proto": "tcp",
"accept": [
"tag:ai-tool-gateway-prod:443"
],
"deny": [
"tag:prod-db:5432",
"tag:prod-admin:22"
]
}
]
}
The policy has three separate issues.
tagOwners
"tagOwners": {
"tag:ai-agent-read-prod": [
"group:security-admins"
]
}
Only the specified security group is allowed to associate the device with the agent's identity.
grants
{
"src": [
"tag:ai-agent-read-prod"
],
"dst": [
"tag:ai-tool-gateway-prod"
],
"ip": [
"tcp:443"
]
}
The agent is allowed to establish a TCP connection to gateway port 443.
This rule does not allow the agent to access other gateway ports, the database, the administration server or other tailnet devices.
tests
{
"src": "tag:ai-agent-read-prod",
"proto": "tcp",
"accept": [
"tag:ai-tool-gateway-prod:443"
],
"deny": [
"tag:prod-db:5432",
"tag:prod-admin:22"
]
}
The test shows both allowed and blocked connections.
Tailscale runs the tests defined in the policy file whenever the policy changes. If a test expectation is not met, the policy change is rejected. Tests are particularly important because Grants rules are additive: another overbroad rule can inadvertently give the agent more access than its own narrowly defined rule suggests. [7]
Production-grade Grants reference policy
The following example implements the entire reference architecture.
Identities used are:
tag:ai-agent-invoice-prod
tag:ai-llm-gateway-prod
tag:ai-tool-gateway-prod
tag:ai-read-api-prod
tag:ai-approval-api-prod
tag:ai-write-executor-prod
tag:erp-api-prod
tag:prod-db
tag:prod-admin
Illustrative policy:
{
"groups": {
"group:security-admins": [
"security-admin@example.com"
]
},
"tagOwners": {
"tag:ai-agent-invoice-prod": [
"group:security-admins"
],
"tag:ai-llm-gateway-prod": [
"group:security-admins"
],
"tag:ai-tool-gateway-prod": [
"group:security-admins"
],
"tag:ai-read-api-prod": [
"group:security-admins"
],
"tag:ai-approval-api-prod": [
"group:security-admins"
],
"tag:ai-write-executor-prod": [
"group:security-admins"
],
"tag:erp-api-prod": [
"group:security-admins"
],
"tag:prod-db": [
"group:security-admins"
],
"tag:prod-admin": [
"group:security-admins"
]
},
"grants": [
{
"src": [
"tag:ai-agent-invoice-prod"
],
"dst": [
"tag:ai-llm-gateway-prod",
"tag:ai-tool-gateway-prod"
],
"ip": [
"tcp:443"
]
},
{
"src": [
"tag:ai-tool-gateway-prod"
],
"dst": [
"tag:ai-read-api-prod",
"tag:ai-approval-api-prod"
],
"ip": [
"tcp:443"
]
},
{
"src": [
"tag:ai-approval-api-prod"
],
"dst": [
"tag:ai-write-executor-prod"
],
"ip": [
"tcp:443"
]
},
{
"src": [
"tag:ai-write-executor-prod"
],
"dst": [
"tag:erp-api-prod"
],
"ip": [
"tcp:443"
]
}
],
"tests": [
{
"src": "tag:ai-agent-invoice-prod",
"proto": "tcp",
"accept": [
"tag:ai-llm-gateway-prod:443",
"tag:ai-tool-gateway-prod:443"
],
"deny": [
"tag:ai-read-api-prod:443",
"tag:ai-approval-api-prod:443",
"tag:ai-write-executor-prod:443",
"tag:erp-api-prod:443",
"tag:prod-db:5432",
"tag:prod-admin:22"
]
},
{
"src": "tag:ai-tool-gateway-prod",
"proto": "tcp",
"accept": [
"tag:ai-read-api-prod:443",
"tag:ai-approval-api-prod:443"
],
"deny": [
"tag:ai-write-executor-prod:443",
"tag:erp-api-prod:443",
"tag:prod-db:5432",
"tag:prod-admin:22"
]
},
{
"src": "tag:ai-approval-api-prod",
"proto": "tcp",
"accept": [
"tag:ai-write-executor-prod:443"
],
"deny": [
"tag:erp-api-prod:443",
"tag:prod-db:5432",
"tag:prod-admin:22"
]
},
{
"src": "tag:ai-write-executor-prod",
"proto": "tcp",
"accept": [
"tag:erp-api-prod:443"
],
"deny": [
"tag:prod-db:5432",
"tag:prod-admin:22"
]
}
]
}
What is important is not the exact name of the tags, but separating the access paths and testing the entire additive policy with the correct identities, ports and services of the client.
Grant 1: agent can only reach two gateways
{
"src": [
"tag:ai-agent-invoice-prod"
],
"dst": [
"tag:ai-llm-gateway-prod",
"tag:ai-tool-gateway-prod"
],
"ip": [
"tcp:443"
]
}
Agent can use approved model service and approved tools.
It cannot directly reach the read API, approval service, write-action executor, ERP system, database or administration server.
Grant 2: the tool API is allowed to read and create an approval request
{
"src": [
"tag:ai-tool-gateway-prod"
],
"dst": [
"tag:ai-read-api-prod",
"tag:ai-approval-api-prod"
],
"ip": [
"tcp:443"
]
}
The tool API can fetch limited information and leave the proposal for approval. However, it cannot perform a write operation directly.
Grant 3: the approval service is allowed to initiate a write operation
{
"src": [
"tag:ai-approval-api-prod"
],
"dst": [
"tag:ai-write-executor-prod"
],
"ip": [
"tcp:443"
]
}
Only the approval service has a network path to the write operator. The agent or tool API does not have this path.
Grant 4: the executor may only use the ERP system’s restricted API
{
"src": [
"tag:ai-write-executor-prod"
],
"dst": [
"tag:erp-api-prod"
],
"ip": [
"tcp:443"
]
}
The write-action executor may use the ERP API but not the production database or administration server.
Because of this, the ERP API can implement action-specific authorisation, object-level access, quantity limits, idempotency, event logging and rollback support.
Network policy does not replace application authorisation
A regular Tailscale Grant can allow a connection:
tag:ai-tool-gateway-prod
→
tag:ai-read-api-prod:443
A grant alone does not decide which HTTP method or API operation a gateway can use:
GET /invoices/7421
POST /payments
DELETE /suppliers/91
The network layer answers the question: is the source allowed to establish a network connection to the destination?
The application layer answers the question: what is the source allowed to do after establishing a connection?
Tailscale Grants also supports application-specific capability definitions, but the target application itself must implement and interpret the respective permissions. Tailscale treats application capability parameters as opaque JSON data and does not implement application business logic. [2]
A secure overall design therefore requires at least three authorisation layers:
Close paths that bypass Tailscale
Tailscale policy protects Tailscale traffic. It does not automatically prevent the service from being reachable also via a public IPv4 or IPv6 address, the cloud service's internal network, the local LAN network, the Kubernetes cluster's normal service network, or another network interface.
Tailscale Grants does not change what a device can reach on the local network outside Tailscale. If the database is directly accessible via a regular subnet, the agent may bypass the fine-grained tailnet policy entirely. [8]
Close public ingress
An internal API service should not listen openly on all network interfaces, such as 0.0.0.0:443, unless a public connection is specifically intended.
The service can be bound to localhost or its Tailscale IP address, protected with a host firewall or cloud security group, published inside the tailnet with Tailscale Serve, or connected through a tsnet identity embedded in the application.
Tailscale Serve can bring a service running on localhost to tailnet for internal use, so that tailnet's access policy remains in effect. Tailscale Funnel, on the other hand, publishes the service to the public internet, so it should not be confused with a private agent architecture. [9]
Restrict ordinary internet egress
By default, a Tailscale Grant does not control the agent’s ordinary internet traffic outside Tailscale. If the operating system has a default route to the internet, the agent may establish an HTTPS connection to an external destination without that connection passing through Tailscale policy.
The agent's internet egress must be limited separately, for example, with a cloud platform or operating system firewall, Kubernetes NetworkPolicy, egress proxy, separate network namespace, controlled NAT gateway or controlled exit node and the firewall behind it.
AI agent
│
│ Tailscale
▼
Internal LLM gateway
│
│ controlled egress
▼
Approved model provider
In this case, only the LLM gateway is allowed to connect to the model provider.
Tailscale App Connectors can route traffic for specified SaaS services through a managed exit and provide a predictable public source address. However, App Connector alone does not make the route mandatory if the workload still has another open internet route. [10]
An exit node can centralise internet traffic through one point. Permission to use it is defined separately with the autogroup:internet destination, but destination or domain restrictions must still be enforced by the exit node’s firewall, proxy or another egress control. [11]
How to attach an agent to Tailscale
The implementation depends on the agent's execution environment and lifecycle.
Long-lived virtual machine or server
A standard Tailscale client can be installed on a long-lived agent server. The workload is attached to tailnet with a purpose-related tag, such as tag:ai-agent-invoice-prod.
Server updates, node keys and removal must be managed as part of normal server management. Key expiry is disabled by default when a device is initially authenticated with a tag, so the organisation must define the workload identity's lifecycle, reauthentication and removal process. [6]
Container or sidecar
The agent can be run in a container with a Tailscale sidecar running alongside it.
Agent container
│
│ localhost / container network
▼
Tailscale sidecar
│
▼
Tailnet
The agent container does not directly need Tailscale management credentials. Sidecar handles network identity and tailnet connectivity. The other routes of the container network must still be limited so that the agent cannot bypass the sidecar via a standard cluster or internet connection.
Short-lived job or CI task
For short-lived agents, the ephemeral-node model can be used. An ephemeral node is removed after a short period of inactivity, or immediately when it logs out. It is suitable, for example, for a single analysis or data-processing task, a CI/CD agent or a dynamically started container.
An ephemeral node reduces the number of stale workload devices left under management, but does not eliminate the need to protect the credentials used to join the tailnet. A newly created instance receives a new Tailscale IP address. [12]
Workload Identity Federation
When the execution environment supports OIDC-based workload identity, a platform-signed identity proof can replace the need to store a long-lived Tailscale auth key.
Tailscale validates the token's signature, issuer, audience, expiry and configured claim-matching rules, then returns a short-lived Tailscale API token with configured scopes. That token can be used with the Tailscale API and, when granted the required scope, to register a node; it is not a credential for the target business application. [13]
Embedded in the application tsnet
A Tailscale connection can be embedded in a Go application using the tsnet library. Each agent service can then connect to tailnet as a separate node, even if several services are running on the same machine.
Same physical server:
invoice-reader → its own tsnet identity
invoice-writer → its own tsnet identity
reporting-agent → its own tsnet identity
admin-tool → its own tsnet identity
This prevents the entire server from being treated as one broad network identity. tsnet enables both outbound connections and tailnet internal listening points within the application. [14]
Test the policy at three levels
A successful demo alone does not demonstrate a secure architecture. Testing must cover at least three levels:
1. Tailscale policy tests
The testssection of the policy file verifies that the Grants policy produces the intended connectivity matrix.
{
"src": "tag:ai-agent-invoice-prod",
"proto": "tcp",
"accept": [
"tag:ai-tool-gateway-prod:443"
],
"deny": [
"tag:erp-api-prod:443",
"tag:prod-db:5432",
"tag:prod-admin:22"
]
}
The test must be run as part of every policy change. In addition to a positive test, explicit negative tests are needed. Otherwise, some other broad Grant may allow the connection without changing the agent's own rule.
2. Real network connection tests
In addition to the policy, the connections must be tested from the real agent execution environment.
| Test | Expected Result | Evidence |
|---|---|---|
| Agent → LLM Gateway:443 | Allowed | TLS Connection and Service Log |
| Agent → Tool API:443 | Allowed | API authenticated response |
| Agent → read API direct | Blocked | Connection failure |
| Agent → ERP API direct | Blocked | Connection failure |
| Agent → database:5432 | Blocked | Connection failure |
| Agent → administration:22 | Blocked | Connection failure |
| Tool API → writer | Blocked | Connection failure |
| Agent → unknown internet destination | Blocked | Egress Firewall Log |
| Removed Agent Node → tailnet | Blocked | Reconnect Fails |
| Passed Recovery Plan | Succeeds | Documented Rollback Test |
3. Application level tests
A working network connection to the gateway does not prove that application authorisation is working.
get_invoice("7421")get_all_invoices()delete_invoice("7421")create_payment without approvalcreate_payment with expired approvalcreate_payment with changed amountTailscale policy tests show tailnet network level reachability. They do not test the business logic of the API, the access permissions of target records, or the correctness of human approval.
Logging: what do you need to be able to prove?
A single agent run should form a compound chain of events. The same correlation tag, for example run_id: ai-run-2026-07-28-000142, is associated with the agent execution log, the LLM gateway log, the tool API log, the approval object, the write action log, and the target application event log.
In this case, it is possible to find out afterwards who started the task, which agent performed it, which model and tools were used, which network objects were connected, which data was read, who approved the operation and what was changed in the system.
Tailscale Configuration Audit
Tailscale's audit log records administrative changes: who changed the policy, what setting was changed, when the change was made, and the previous and new state of the policy. This helps show when an agent's access permissions were changed and who made the change. [15]
Network flow logs
Network flow logs record connection metadata such as source and destination nodes, protocol, port and transferred data volume. They do not record traffic content. The feature is currently available on Premium and Enterprise plans, retains the most recent 30 days in Tailscale and requires supported clients to send telemetry.
Flow logs describe observed flows; they should not be treated as a complete record of denied connection attempts or as a stand-alone IDS, SIEM or real-time threat-detection system. Depending on the use case, local Tailscale logs, host and egress firewall logs or gateway logs are needed to detect and evidence denied attempts. [16]
Log streaming, currently available on Premium and Enterprise plans, can send supported audit and network logs to centralised storage or a SIEM. [17]
Implement a real kill switch
Stopping an agent must not depend on whether the agent is no longer responding to management commands. The stop must be outside the agent.
- Stop agent workload.
- Remove agent's Tailscale device or its Grants privileges.
- Revoke agent application and API IDs.
- Prevent agent internet egress.
- Prevent new tool calls on gateway.
- Keep logs for investigation.
- Rotate or revoke any exposed auth keys, API tokens and other credentials.
- Revert the changes made by the agent.
Revoking the original Tailscale auth key does not automatically revoke access for a device that has already joined the tailnet with it. An auth key is used to register the device; the registered node then has its own device and key lifecycle. If necessary, remove the node or change its access policy. [18]
Likewise, removing the Tailscale network access does not alone revoke the application tokens already obtained by the agent. It must be possible to revoke the network identity and application credentials independently of each other.
Common mistakes
1. An agent is given a generic and overly broad tag
tag:ai-agent does not distinguish between agents' tasks or risks. Use purpose-related tags such as tag:ai-invoice-reader-prod and tag:ai-payment-executor-prod.
2. The combined effect of several tags is not taken into account
Tag permissions are additive. The combination tag:ai-agent, tag:finance and tag:prod may grant more permissions than the designer intended. Use a purpose-based combo tag and test the entire policy.
3. The agent is connected directly to the database
A direct SQL connection easily gives too wide a reading and writing surface. Use the chain: agent → tool API → bounded business API → database.
4. Agent has direct internet connection
Prompt injection or a compromised tool can use open internet egress to export data. Centralize egress to the gateway and prevent other egress with a separate network control.
5. Service is still public
A precise Tailscale policy does not help if a public IP address or cloud internal-network route bypasses the tailnet. Close public ports and unnecessary non-Tailscale routes.
6. Only the paths that should work are tested
One successful HTTPS connection does not prove that the agent cannot access the database or SSH server. Negative tests are at least as important as positive ones.
7. Flow logs are considered a complete threat detection system
Flow logs show connection metadata, not application content or a complete picture of all blocked attempts. Combine network, application, tool, agent and egress logs.
8. The agent may change its own network identity
The agent should not have Tailscale administrative permissions, the permission to grant itself tags, or the permission to change the Grants policy. Controls must not be managed by the agent they constrain.
9. Development and production agent use the same identity
In a development environment, a compromised agent can obtain production connection paths. Separate identities and Grants rules by environment.
10. Revoking an auth key is assumed to be a kill switch
Revoking the access key does not remove the access of the already registered device. Test the node deletion, Grants change, and application token cancellation as a single entity.
Optional further development: stable service identity
In a production environment, there can be multiple parallel instances of a tool API or LLM gateway. Tailscale Services separates a stable service identity from individual hosts.
{
"src": [
"tag:ai-agent-invoice-prod"
],
"dst": [
"svc:ai-tool-gateway"
],
"ip": [
"tcp:443"
]
}
The agent uses a stable service name, and the service can be implemented on multiple tagged, approved hosts. This makes it easier to replace instances and build high availability without tying the agent's policy to one server. Tailscale Services currently supports TCP services, so protocol, client-version and host-approval requirements must be checked before adopting this pattern. [19]
When is the agent’s network zone ready for production?
An agent’s network zone is not production-ready merely because Tailscale is installed. A new tailnet’s initial default policy may allow broad device-to-device traffic. A least-privilege Grants policy, tag ownership and policy tests must be designed separately. [3] [23]
You should be able to demonstrate at least the following things about production readiness:
- The agent has its own purpose-bound workload identity.
- Development, test and production environments are separated.
- Tag issuing permissions are limited.
- The agent has only named targets, protocols and ports.
- The agent has no direct database or administration connection.
- Read, approval and write paths are separated.
- Application authorisation works in addition to network policy.
- Public and local network bypass routes are closed.
- Internet egress is limited by a separate control.
- The policy has both pass and block tests.
- The tests cover the additive effects of the entire policy.
- Real end-to-end connections have been tested.
- Network, agent, tool, and application logs can be combined.
- Suspension and token revocation have been tested.
- There is a documented rollback procedure for the change.
- The agent access path has a named owner.
A secure network zone limits the blast radius
The safety of an AI agent cannot be built on the assumption that the model always understands the user's intent, recognizes all malicious instructions, and chooses a safe action in all situations.
However, a deterministic limit can be implemented in the network layer:
Tailscale in this architecture implements workload identity, an encrypted connection layer, and tightly bounded network accessibility. The application, API gateway, approval service, firewall and monitoring implement the other layers.
Tailscale is not a substitute for application authentication, data access permissions, vulnerability management, EDR system, SIEM solution or incident response. The customer is also responsible for device updates, identity management, tag and group management, and an appropriate access policy. [3]
A good first implementation is deliberately small:
Defense First identifies the customer's actual access path, models the target state, implements it with Tailscale Grants and produces tests, documentation and a recovery plan for both allowed and denied connections. [20]
One agent. Precisely named connections. Verified boundaries.
Restrict the first AI agent’s network zone.
Book a 30-minute Tailscale assessmentKey sources
- Defense First: Secure AI agent deployment in the enterprise — 12 security controls.
- Tailscale: Grants.
- Defense First: Tailscale guide for companies.
- OWASP GenAI Security Project: OWASP Top 10 for Agentic Applications 2026.
- Tailscale: Secure AI agent connectivity.
- Tailscale: Tags.
- Tailscale: Policy file and policy tests.
- Tailscale: Access controls and ACLs.
- Tailscale: Tailscale Serve.
- Tailscale: App Connectors.
- Tailscale: Exit nodes.
- Tailscale: Ephemeral nodes.
- Tailscale: Workload Identity Federation.
- Tailscale:
tsnet.Server. - Tailscale: Configuration audit logging.
- Tailscale: Network flow logs.
- Tailscale: Log streaming.
- Tailscale: Auth keys.
- Tailscale: Tailscale Services.
- Defense First: Tailscale expert in Finland.
- Tailscale: Control and data planes.
- Australian Cyber Security Centre and international partners: Careful Adoption of Agentic AI Services.
- Tailscale: Device visibility principles.
- Tailscale: Aperture configuration reference.