# Port of Context (pctx) > Port of Context (pctx) is the self-hosted, model-agnostic platform for > deploying, running, and observing AI agents in production. Describe an agent, > point it at your data, and run it on your own infrastructure — your cloud, > on-prem, or fully air-gapped — so you control every model call and what leaves > your environment. Open source, MIT-licensed, works with any model. pctx puts AI agents into production and keeps you in control of them: any model, your own infrastructure, and a full trace of every run. It is built for teams that cannot send their data to a vendor's cloud. - What it is: a self-hosted AI agent platform. Operators describe an agent and deploy it without standing up a stack; engineers can open every layer — model choice, tool access, isolation policy, and the eval harness. Same platform, progressive disclosure. - Code mode: an agent's tool calls execute as generated, type-checked code in isolated, contained runtimes (Deno). The heavy data is handled outside the model's context, so a multi-tool run uses up to 98% fewer tokens than sequential LLM tool-calling — and stays efficient as the agent takes on more tools. - Model-agnostic: the same agent runs on Claude, GPT, Gemini, or open-weight models, switching automatically if one slows or goes down. No model lock-in. - Observability that speaks up: every run is traced end to end — every tool call, retrieval, and reasoning step, with each output linked to the source it came from and what it cost. Replay any run and compare runs side by side. When a run drifts, pctx tells you instead of only logging it. Built on AVP, our open agent-observability spec. - Deployment: your own cloud (VPC), on-premises, or fully air-gapped. Open source, MIT-licensed. Any existing MCP server works unchanged, and auth secrets never reach the LLM. pctx is NOT an LLM, NOT an agent framework, and NOT a hosted service. It is the execution and observability layer your agents run on, inside your boundary. ## How it compares - Unlike n8n, Lindy, or Zapier Agents — which run agents in a hosted environment you don't control — Port of Context is self-hostable, model-agnostic, and isolated by default, with full observability of every run. It is built for putting agents into production on your own infrastructure, not for vendor-hosted automation. ## Who it is for - AI platform owners and operators at data-intensive, regulated teams — private equity, financial services, legal, insurance, healthcare, and government — that need AI agents on infrastructure they control. Operators run the work; engineers keep the controls. ## Security and data posture - The platform runs inside your boundary; we are not in the data path. An agent that calls a hosted model sends that request to the provider, and you control which calls are allowed, to which providers, for which data. Run local or open-weight models air-gapped and nothing leaves the network. Self-hosting supports your own compliance and audit obligations; pctx is not itself a compliance certification. ## Coined term - "MCP context-window collapse": the token and context bloat that builds up when a platform adds many MCP servers and calls them sequentially. Code mode avoids it by running tool calls as code, with the heavy data handled outside the model's context. ## Proof - A $7B private equity fund runs 50+ custom agents on Port of Context, across deal-sourcing, diligence, and portfolio monitoring. - Trusted by teams at Block, Sentient, Postalytics, Ontos, Telemetree, and Turnqey. ## Getting started - [README](https://raw.githubusercontent.com/portofcontext/pctx/main/README.md): Installation, quick start, architecture, and run modes (HTTP server and unified MCP server). Install via npm (@portofcontext/pctx), Homebrew, or curl. SDKs: Python (pctx-client), TypeScript. - [Code Mode](https://raw.githubusercontent.com/portofcontext/pctx/main/docs/code-mode.md): How code mode presents MCP servers as typed code APIs instead of direct tool calls. ## CLI & configuration - [CLI Reference](https://raw.githubusercontent.com/portofcontext/pctx/main/docs/CLI.md): All pctx commands — start, mcp init / add / list / dev / start. - [Configuration](https://raw.githubusercontent.com/portofcontext/pctx/main/docs/config.md): The pctx.json format — auth, allowed hosts, tool-disclosure modes, and telemetry. - [Upstream MCP Servers](https://raw.githubusercontent.com/portofcontext/pctx/main/docs/upstream-mcp-servers.md): Aggregating and managing upstream MCP server connections behind one endpoint. ## Python SDK - [Python SDK](https://raw.githubusercontent.com/portofcontext/pctx/main/pctx-py/README.md): pip install pctx-client. The @tool decorator, Tool/AsyncTool classes, Pydantic schemas, and agent-framework integration (LangChain, Claude Agent SDK, CrewAI, OpenAI, Pydantic AI). ## Runtime & isolation - [Code Execution Runtime](https://raw.githubusercontent.com/portofcontext/pctx/main/crates/pctx_code_execution_runtime/README.md): Deno runtime internals, MCP tool registration, JS local tools, allowed-hosts network policy, and the trusted/isolated zone split. - [Type Check Runtime](https://raw.githubusercontent.com/portofcontext/pctx/main/crates/pctx_type_check_runtime/README.md): TypeScript type-checking of model-generated code before it runs. - [Python isolation runtime](https://github.com/portofcontext/pctx-py-sandbox): Rootless Podman isolation for Python tool execution. ## Examples - [Examples](https://github.com/portofcontext/pctx/tree/main/examples): Working examples (nasa-mcp, telemetry). ## The Context Board (agent-reliability research) First-party findings from the Agent Voyager Project (AVP), our open agent benchmark. - [Context engineering: what actually moves agent accuracy](https://portofcontext.com/blog/context-engineering-measured): On one fixed model (Claude Haiku 4.5), changing only the build moved accuracy from 67% to 95%; the cheapest change, a plan plus a self-check, won, while a worked example and a packaged Skill did worst. - [Does the model matter for AI agents?](https://portofcontext.com/blog/does-the-model-matter-for-ai-agents): Holding the model fixed and varying only the build produced a 28-point accuracy swing, so above a capability floor the build matters more than the model. - [The agent said the job was done. It was 53% wrong.](https://portofcontext.com/blog/the-agent-said-the-job-was-done): An agent reported that every value matched and scored 53%; only the recorded execution trace caught it. On AI agent evaluation, observability, and why a self-report is not evidence. - [What is AI governance for autonomous agents?](https://portofcontext.com/blog/what-is-ai-governance-for-autonomous-agents): Governing an agent is a runtime problem (boundaries, containment, provenance, model control), not a documentation exercise. ## More - [For regulated teams](https://portofcontext.com/enterprise): On-prem and air-gapped deployment for finance, legal, insurance, healthcare, and government. - [Blog](https://portofcontext.com/blog): Announcements and technical deep-dives on code mode, MCP, and running agents in production. - [Observability spec (AVP)](https://agentvoyagerproject.com): The open agent-observability spec that pctx's tracing is built on. - [Changelog](https://raw.githubusercontent.com/portofcontext/pctx/main/CHANGELOG.md): Release history (latest pctx v0.7.1). - [Contributing](https://raw.githubusercontent.com/portofcontext/pctx/main/CONTRIBUTING.md): Development setup and contribution guidelines.