Agent Engineering in Practice: From Self-Awareness to Skill-Based Tool Calling
This article explains how LLM-based AI agents move from single-turn question answering to continuous task execution. It covers giving agents structured knowledge of their own runtime environment, using agents to modify agent code under controls, managing parallel agent tasks through clear decomposition and prompt structure, and integrating tools through protocol-based interfaces or skill-based packaging.
1. Background: From Question Answering to Continuous Execution
Over the past two years, the way large language models are applied has changed noticeably. Early products mainly supported single-turn question answering. A user asked a question, the model returned a text answer, and the interaction ended there. As models became more capable at tool calling, long-context processing, and reasoning, more systems gained the ability to execute tasks continuously. They can read files, run commands, call external services, and maintain state across multiple steps. Such systems are commonly called AI agents.
The value of an agent lies in its execution, and execution brings new engineering problems. The system needs to know what it can do, where it runs, and which rules it must follow. When something goes wrong, people need to observe its behavior, interrupt its operations, and roll back the results. This article covers three areas: runtime self-awareness, development workflows, and tool integration.
2. Self-Awareness: Helping Agents Understand Their Runtime Environment
Self-awareness means an agent can obtain and use structured information about itself. Common categories include:
- Code location: the directory structure and entry files of the project source code;
- Documentation location: an index of API references, design documents, and change logs;
- Runtime model: the model version in use, its context window limit, sampling parameters, and so on;
- Available tools: the list of tools registered in the current session and their permission scopes;
- Runtime environment: the operating system, runtime version, and network and file system access permissions.
This information reduces the model’s need to guess. If an agent does not know its own configuration, it can only infer answers from experience when asked whether it can read a certain directory or which parameters a task used. Those inferences are often unreliable. Injecting this information as structured context gives the reasoning a factual basis.
The following code sample is illustrative only and shows the idea:
def build_self_context(project_root: str, model_id: str, tools: list[str]) -> dict:"""Build a structured description of the agent's runtime environment to inject as system context."""return {"source_root": project_root,"docs_index": f"{project_root}/docs","model": model_id,"available_tools": sorted(tools),"policy": "Write operations require manual confirmation",}
Two points matter in practice. First, the self-description should be generated by the program, not written by the model, because otherwise the information may not match the actual state. Second, keep the description to the minimum needed for the task. Too much unrelated content in the context takes space from useful information and can interfere with reasoning.
3. Agents Building Agents: A Meta-Development Workflow
When an agent can read its own source code, a development approach emerges: using an agent to modify and debug the agent itself. This can shorten iteration cycles, especially for repetitive framework-level work such as adding test cases, fixing known defects, and synchronizing documentation with code.
This capability needs constraints. Self-modification means system behavior may change without anyone noticing, so the following principles are recommended:
- Version-control all changes, with each change corresponding to a traceable commit;
- Perform self-modification only in an isolated branch or sandbox, with human review before merging;
- Set critical configuration, permission policies, and security-related modules to read-only, so the agent cannot rewrite them;
- Keep one-click rollback available, and verify regularly that the rollback process actually works.
With these constraints in place, self-modification moves from a risky operation to a controllable development method.
4. Parallel Tasks and Development Workflows
Managing multiple agent tasks at the same time is now fairly common for engineers. Compared with running tasks one at a time, parallel work increases throughput, but it also requires clearer task boundaries.
4.1 Task Decomposition
Each agent task should meet three conditions: a single goal, clearly defined inputs and outputs, and independent verifiability. For example, the task “refactor the user module and add missing tests” can be split into three steps: review the existing interfaces, add unit tests, and perform the refactor and compare test results. Each step is handled by a separate task, which reduces mutual interference and makes errors easier to locate.
4.2 Prompt Length and Structure
In practice, short and precise prompts often work better than lengthy instructions. Long prompts can introduce conflicting conditions, and the model may miss some of the requirements. A better structure is:
- State the task goal in the first sentence;
- List the constraints afterward, one per line;
- End with acceptance criteria, for example, “all tests pass, and no public interfaces are changed.”
4.3 Input Methods
Voice input can reduce the effort of expression in some scenarios, and it suits describing a fairly complete requirement. Whichever input method is used, the key is to state the requirement fully and have the agent restate its understanding before execution, so deviations are caught early.
4.4 An Engineering Approach
Letting a model generate code and judging its quality by feel is often called “vibe coding.” This approach suits prototype exploration but is hard to sustain for production systems. Agent engineering emphasizes clear specifications, task decomposition, automated testing, code review, and observability. The model is one of the executors, and the engineering process still determines the final quality.
5. Tool Integration: Protocol-Based Interfaces and Skill-Based Packaging
Agents typically call external capabilities through one of two approaches.
The first is protocol-based integration. A unified protocol registers each tool’s description, parameters, and calling method in the model context. Its advantage is a high degree of standardization, which makes tools easier to reuse across platforms. The drawbacks are that the full description of each tool consumes context, so the burden grows noticeably as the number of tools increases, and combining different tools requires an additional orchestration layer.
The second is skill-based packaging. A group of capabilities is wrapped as a skill module with documentation. Each skill provides a short description, an entry command, and an output convention, and it is loaded on demand. Models have already been trained on a large amount of command-line material, especially for handling files, text, and processes, so they are comfortable composing command-line tools.
The two approaches compare as follows:
| Dimension | Protocol-based integration | Skill-based packaging |
|---|---|---|
| Context usage | Grows with the number of tools | Loaded on demand, lower usage |
| Composability | Depends on an orchestration layer | Can be combined directly through pipes and scripts |
