Agent Tools and Skills: A Practical Guide to Secure Deployment
AI agents become useful when large language models can interact with external systems through tools. This guide explains how to define, connect, and extend agent capabilities while controlling operational and security risks. It covers built-in tools, JSON Schema validation, MCP-based integrations, custom skills, execution modes, controlled self-improvement, and pre-launch checks.
Why Agents Need Tools
A common industry formula is: agent = large language model + prompt + tools. A language model can generate text, but it cannot query a database, read project files, or run tests on its own. Tools allow the model to interact with external environments and complete practical tasks.
The more powerful the tools, the greater the risk. The following sections cover built-in tools, tool definitions, protocol integrations, custom skills, execution modes, controlled improvement, and launch readiness.
1. Built-In Tools: Capabilities and Boundaries
Most agent frameworks provide four basic categories of tools.
File system operations (
read/write): These tools read source code and configuration files and write back changes. Access should normally be limited to the current project directory, and files should be opened in read-only mode whenever possible. Before writing, retain a backup of the original file or rely on version control for recovery.Command execution (
bash/exec): These tools run tests, install dependencies, and start builds. They represent the highest level of risk. Run them in a containerized sandbox, use an allowlist of permitted commands, configure timeouts and output-length limits, and log every invocation. High-risk operations—including deleting files, pushing code, deploying releases, and accessing external networks—should require human approval. Do not run an agent on the host machine with production credentials.Task management (
todo/scheduler): An agent can break a large task into smaller steps and track the status of each one. A task list makes progress visible to humans and allows the agent to resume from a checkpoint after an interruption.Web access and search (
web/search): These tools retrieve current documentation and public information, reducing errors caused by answering from the model’s memory. Search results are external data, not instructions. If a page contains text such as “ignore previous instructions,” the agent should disregard it and report it to the user. Responses should include source links.
2. Tool Definitions: From Schema to Execution
Tool parameters are commonly described with JSON Schema. The following is an example of a file-reading tool:
{"name": "read_file","description": "Read the contents of a file for reviewing source code or configuration.","parameters": {"type": "object","properties": {"file_path": {"type": "string","description": "The absolute or relative path of the file to read"}},"required": ["file_path"]}}
The model generates parameters that match this structure based on the user’s request. However, the framework should not execute the call immediately. It should first:
- Validate parameter types and required fields.
- Confirm that the path is within the permitted scope.
- Execute the tool and return the result.
If validation fails, the framework should return a clear error code so the model can correct the parameters instead of silently ignoring the request.
Schemas also require version management. Renaming or removing a field can break existing callers, so each change should trigger a version update. Different models may support tool-calling formats differently. For example, they may vary in their support for parallel calls and their adherence to strict JSON mode. Before integrating a new model, validate its tool-calling success rate against a test set.
Before connecting a tool to a production environment, use the following checklist:
- Confirm that the selected model supports function calling or a compatible tool-calling protocol.
- Create a Schema for each tool and assign a version number.
- Register each tool with the minimum permissions required.
- Store secrets in a secrets-management service rather than in code or prompts.
- Configure timeouts and maximum retry counts.
- Log the input, output, and execution time of every call.
- Establish an evaluation set and maintain a rollback path.
3. Standardized Protocol Services: MCP as an Example
As the number of tools grows, differences in interfaces and authentication methods increase maintenance costs. The Model Context Protocol (MCP) provides a standardized interface that allows models to connect to external data sources and tool collections in a consistent way.
MCP does not automatically connect enterprise services. Before use, deploy or connect the appropriate MCP Server or adapter, such as an integration for object storage, logging, or monitoring and alerting systems. The integration should include the following controls:
- Authentication: Use an API key or OAuth token. Store credentials in a secrets-management service and rotate them regularly.
- Permission scope: For example, grant read access to selected storage buckets without granting write or delete permissions.
- Network access control: Use an allowlist to restrict accessible endpoints, and place the integration in a dedicated private network when necessary.
- Call auditing: Record the caller, timestamp, parameter summary, and return status.
A recommended integration sequence is:
- Deploy the service.
- Configure authentication.
- Declare the available tools.
- Test read-only calls first.
- Enable write operations only after validation.
- Keep a human approval step for write operations.
4. Custom Skills: Encapsulating Repeatable Workflows
Many use cases involve fixed, multi-step processes. A custom Skill can package these steps into a reusable module.
Consider a debugging workflow. A typical process includes reading error logs, analyzing the stack trace, searching related code, proposing a fix, applying the change, and running tests. This process can be packaged as a Skill named debug_workflow with the following contract:
- Input: The error log path, service name, and reproduction command.
- Output: A root-cause summary, code patch, and test results.
- Failure handling: Retry an individual step no more than twice. If the entire workflow has not completed after 300 seconds, stop execution and report its current status.
- Human intervention: Require user confirmation before modifying code. If two consecutive fixes fail, or if the fix involves a database schema change, hand the task over to an engineer.
The value of a Skill is predictable execution and reviewable results. It does not replace human judgment about code quality.
5. Preset Modes: Choose Based on Context and Risk
Frameworks commonly provide several execution modes with different trade-offs:
| Mode | Suitable For | Response Speed | Resource Usage | Permission Risk | Recommendation |
|---|---|---|---|---|---|
| Standard | Most general programming tasks | Moderate | Moderate | Low | Use by default |
| Minimal | Simple questions and lightweight completion | Fast | Low | Low | Use for simple, speed-sensitive tasks |
| Creative | Complex tasks that require multi-step exploration | Slow | High | High | Disabled by default; enable only in controlled environments |
Minimal mode reduces tool calls and reasoning steps, so it responds more quickly. However, it may skip necessary validation and is not appropriate for operations with side effects.
6. Creative Mode: Controlled Improvement
Creative mode allows an agent to reflect on its own behavior during execution. For example, after repeated failures on a type of task, the agent may record the causes and propose changes to a prompt or Skill.
This capability requires strict controls:
- The agent may write proposed changes only to candidate files. It must not directly overwrite production prompts or the Skill library.
- Candidate changes require human approval and must be validated against an evaluation set.
- All changes must be version-controlled, with complete diffs retained for rollback.
- The agent must not have permission to modify its own access controls or audit logs.
Under these conditions, Creative mode can be tested on a small scale for tasks with an evaluation set. Without these safeguards, it should remain disabled.
7. Pre-Launch Checklist
Before deploying an agent, verify each of the following:
- Tools and protocol services use least-privilege permissions.
- All secrets are managed by a secrets-management service.
- Tool calls and command executions generate audit logs.
- An evaluation set covers the main scenarios, with baseline results recorded.
- Model-call volume and costs are monitored, with a budget limit configured.
- The system is released gradually to a small group of users first.
- A rollback plan defines the recovery steps to follow if problems occur.
When permission governance, evaluation, auditing, and rollback mechanisms are in place, agents can take on more repetitive work in well-bounded scenarios such as code retrieval, test execution, and log investigation. Outside these boundaries, engineers should continue to provide oversight.
