One orchestrator routing work to finance, marketing, and sales specialists, each with its own folder and .env file, connected to business tools through MCP or a custom connection.

Most people meet AI through a chat window, and a chat window can only talk. The step from there to AI that does real work inside your business, pulling from your CRM, writing to your spreadsheets, and handing tasks between agents, runs through a small file called .env. This post is a basic tutorial on what that file is and how to set one up, then a way to choose among three options: a custom connection that reads from the file, an MCP server, or a service like Composio. You can't make that choice well until you know what the file does.

What does a .env file actually do?

The name is short for "environment," meaning the settings of the place where a program runs. The file is plain text, one setting per line, written as a name and a value:

DATABASE_URL=replace-me
SESSION_SECRET=replace-me
PAYMENTS_SECRET_KEY=replace-me
EMAIL_API_KEY=replace-me
NEXT_PUBLIC_SITE_URL=https://example.com

Those names are generic examples, not from a real project, and the values are fake on purpose. NEXT_PUBLIC_SITE_URL is a public setting the app can show in the browser; the others are secrets and stay on the machine. An API key is the password one program uses to talk to another: when your software asks a CRM for a list of deals, or asks an AI model to write a summary, the key tells that service who is asking and whose account to use. The program reads the .env file when it starts, and the code, and any agent working in the folder, should refer to each setting by its name only, never by its value. You type the real values yourself on each machine that needs them.

Where does .env sit between chat and agents?

When I teach this, I describe three steps. In chat, you talk to a model and upload what it needs. In a work tab, such as Claude Cowork or the Work tab in ChatGPT, the model can read, clean, and create files inside a folder on your computer, which is a real jump in what it can do for you. At the time of writing, those work tabs can't use API keys to reach outside services, so they stop at the edge of your folder.

The third step is a coding agent such as Claude Code or Codex, working inside your own folder with your own rules. That's where the .env file comes in: it lets the folder reach the CRM, the accounting tool, the email system. A folder with instructions, skills, and a .env file is the smallest version of a real agent, and every larger system I've built is that same shape repeated.

my-project/
├── AGENTS.md        what this agent is for and how it works
├── .agents/skills/  repeatable tasks it knows how to do
├── .env             the keys it needs, never committed
└── Reports/         the work it produces

How do you set one up?

  1. Pick one workflow you do every week and can describe in a sentence.
  2. Make a folder with an AGENTS.md file that says what the agent is for.
  3. Create the .env file with the names you need, plus a .env.example that lists the same names with fake or empty values. The .env file is never committed; the example file is, so a teammate or an agent can see which names are required.
  4. Add .env to your .gitignore before the first commit, so the file never enters your repository.
  5. Type the real values yourself on each machine that needs them, then ask your coding agent to build the workflow, loading each setting by name and never printing a value. If a required name is missing, the build or the run should fail clearly.
  6. Test with one small run, check the result against what you expected, then save the steps as a skill.

One habit sits around those steps: keep secrets in the .env file and out of chats, code, and git. Give each agent its own keys, and set a spending limit where your provider offers one. If you rotate a key, update every copy of the file that still has the old value. If a key leaks, revoke it and create a new one first, then update every copy and check the usage page.

When is each connection the skillful choice?

A .env file is one way to connect. Two others come up constantly, and the skill is knowing which to use.

Use a .env file and a custom connection when the tool has no good connector, when you need the same steps every time (a script, not a conversation), or when you want one tightly scoped key for one job. A pattern I teach: build a weekly report with plain code so the numbers come out the same every time, then make one API call to write the explanation, and have a person check it. The report is deterministic and the explanation is probabilistic. Deterministic versus probabilistic workflows gets its own post.

Use an MCP server when a solid one exists for the tool and the agent needs to use that tool as part of a conversation, with judgment. An MCP server is a standard way for an AI app to plug into a tool, such as email, a calendar, or a CRM. They keep getting better, and they are often the right choice, but not always. What an MCP server is, and when you still need a custom connection is its own post.

Use Composio, or a similar connection service, when you need several accounts or several tools and don't want each native Claude or ChatGPT connector loaded up front, which eats context. Composio is a genuine help here, and it's improving: you sign in once per account, and the agent can use those connections without a pile of keys in the folder. You still need a .env file sometimes, for tools it doesn't cover, for custom scripts, and for keys the service itself may need.

If this is true The skillful choice is
No good connector exists, or you need exact, repeatable steps A .env file and a custom connection
A solid MCP server exists, and the agent will use the tool in conversation An MCP server
You need several accounts or tools, and native connectors would load too much context up front Composio, or a similar service, with a .env file for whatever it doesn't cover

My own agents used to have long .env files, with a key for nearly every tool. Those files have gotten shorter as MCP has matured and as I've moved many connections to Composio. Shorter doesn't mean gone.

How does an orchestrator use .env files?

Once you have more than one agent, the same file shows up in a larger shape. An orchestrator is one agent whose job is routing: it decides which specialist should handle a request, passes along the context, and checks what comes back. Each specialist is a folder like the one above, with its own instructions, skills, and, when it needs them, a .env file holding only the keys that job needs.

Diagram of an orchestrator agent routing a request to finance, marketing, and sales specialists. Each specialist has its own folder and .env file, and they reach email, CRM, and other tools through a connector layer of MCP and similar services, or through a custom connection that reads a key from .env.

Separating the keys does three things. A specialist can only do what its own keys allow, so the finance agent can't send marketing email. When something breaks, you know which folder to open. And the structure follows how a company already divides its work, which makes the system easier for people to understand and trust.

This is the foundation of what I've built: a development team on the Claude Code side, backend infrastructure for our own company and for a healthcare company we helped bring to market, and coaching in which an executive team at a construction materials company went from uncomfortable with AI to using it in daily financial reporting, and building company systems, in four weeks.

Frequently asked questions

What does .env stand for?

It stands for "environment." The file holds the settings for the environment a program runs in, such as which keys to use and which accounts to connect to.

Do I still need a .env file if I use MCP servers or Composio?

Often less, but not never. Those connections cover many tools. A .env file covers the rest: tools without a good connector, custom scripts, and any keys the connection services themselves need.

How is a .env file different from an AGENTS.md or CLAUDE.md file?

An instructions file tells the agent what to do and how you want it done. A .env file holds the keys it uses to reach other tools. One is guidance, the other is access.

When should I move from a work tab to an agent in a folder?

Move when you need the work to reach an outside tool that the work tab can't connect to, or when you want a repeatable task with its own instructions and schedule.

How do I choose among a .env file, an MCP server, and Composio?

Start with what the job needs. Exact, repeatable steps or no good connector: use a .env file and a custom connection. A solid MCP server and a conversational tool: use the server. Several accounts, and native connectors would eat too much context: use Composio, and keep a .env file for whatever it doesn't cover.

Where this leads

A .env file is a small thing that marks a big change: your instructions stop living in a chat and start living in a folder that can reach your tools. Once that clicks, the choice among a custom connection, an MCP server, and a service like Composio gets easier. A common data format, JSON, carries the information between them, and What is JSON, and why does it matter when you use AI? is the next post. I teach this progression in my AI coaching, one step at a time, on a team's own work.

By Jordan Zawaydeh. Last updated December 2, 2026.

← All posts