agentc
GitHubagentc-sh/agentc
agentc
GitHubagentc-sh/agentc
›Introduction
Get started›Concepts in 5 minutes›Build your first agent›Add your first tool›Serve and connect
Concepts›Architecture overview›The manifest›The compilation pipeline›Archetypes›The graph›Tools and capabilities›Runtime libraries›Skills›Agents and prompts›Serving and protocols›Observability
Guides›Author a manifest›Write a tool›Give your agent a filesystem›Control network egress›Connect external tools via MCP›Connect agents via A2A›Use the bash tool›Control tool access with capabilities›Write templated prompts›Manage prompts with Langfuse›Pass context from the client›Configure a model provider›Connect a CopilotKit frontend›Deploy a standalone binary›Deploy with Docker and PostgreSQL›Instrument with OpenTelemetry›Extend code generation with blocks
Reference
Manifest
Runtime
›Observability

Control network egress

Decide which hosts, methods, and addresses your agent's components may reach.

The runtime HTTP client is always present, but what it can reach is first shaped by the manifest and then adjusted further at startup through runtime configuration. This guide shows how to start from the default policy and narrow it to the exact network surface a component needs.

Start from the default

With no network block, outbound requests are unrestricted by URL pattern. Loopback, private, and link-local addresses are still refused by default.

The manifest is the first place network policy is defined. Runtime configuration can also control the policy at startup, including when the manifest omits the network block entirely, so one compiled binary can still be tightened or relaxed per deployment.

Allow one API host

Add a network block with a single allow pattern when the component should reach one API host and nothing else.

agent.acl
network {
  policy {
    allow = [
      {
        protocol = "https"
        hostname = "api.example.com"
      }
    ]
  }
}

Requests to any other host are now refused.

Narrow the methods

Add methods to limit which HTTP methods the client may use. When methods is unset, methods are unrestricted.

agent.acl
network {
  policy {
    methods = ["GET", "POST"]

    allow = [
      {
        protocol = "https"
        hostname = "api.example.com"
      }
    ]
  }
}

Set a timeout

Add request_timeout_ms when the whole request should have a deadline. Use runtime() when the operator should be able to adjust the value at startup.

agent.acl
network {
  limits {
    request_timeout_ms = runtime("NETWORK_REQUEST_TIMEOUT_MS", 5000)
  }

  policy {
    allow = [
      {
        protocol = "https"
        hostname = "api.example.com"
      }
    ]
  }
}

Permit an address class for local development

Loopback is off by default because allowing it lets component code talk to services bound on the same machine, which is usually broader access than a production agent should have. Make it runtime configurable when local development needs it.

agent.acl
network {
  policy {
    addresses {
      allow_loopback = runtime("NETWORK_ALLOW_LOOPBACK", false)
    }

    allow = [
      {
        protocol = "http"
        hostname = "127.0.0.1"
        port     = "3000"
      }
    ]
  }
}

The default stays off, but an operator can enable it where it is explicitly wanted.

Make a request from a component

Send a request from a component using the corresponding runtime library.

import { fetch } from "agentc:http";

try {
  const response = await fetch("https://api.example.com/status");

  if (!response.ok) {
    throw new Error(`upstream returned ${response.status}`);
  }

  const body = await response.text();
  console.log(body);
} catch (error) {
  console.error(String(error));
}

If the request violates the egress policy, fetch rejects and the error message explains the refusal.

Where to go next

  • network reference
  • agentc:http
← PreviousGive your agent a filesystemNext →Connect external tools via MCP

© 2026 pogue.dev. All rights reserved.

Creative CommonsCC BY 4.0
On this pageStart from the defaultAllow one API hostNarrow the methodsSet a timeoutPermit an address class for local developmentMake a request from a componentWhere to go next

Search docs

Search the agentc documentation