Agent Engineering in Practice: From Bidirectional Software to Effective Skill Design Engineering practice for AI agents is shifting from "getting models to answer questions" to "getting models to complete tasks." Large language models are moving beyond text generation toward calling tools, reading and writing files, accessing APIs, and collaborating with users. Along the way, engineering teams need to rethink three questions: where the model gets stuck, in what form tools should be handed to the model, and how interaction should be organized. Based on a developer's shared experience in agent skill engineering, this article summarizes the core ideas and two key skill designs, and adds practical boundary conditions for real-world deployment.
Agent engineering is shifting from making models answer questions to making models complete tasks. This article examines two key techniques—Programmatic Tool Calling (PTC) to reduce inference rounds and context consumption, and structured human-in-the-loop interaction to reduce ambiguity—along with the concept of bidirectional software design. Readers will learn the trade-offs of each approach, boundary conditions for adoption, and a practical checklist for iterating on agent tools based on observed failure cases.
Engineering practice for AI agents is shifting from “getting models to answer questions” to “getting models to complete tasks.” Large language models are moving beyond pure text generation toward calling tools, reading and writing files, accessing APIs, and collaborating with users. Along the way, engineering teams need to rethink three questions: where the model gets stuck, in what form tools should be handed to the model, and how interaction should be organized. Based on a developer’s shared experience in agent skill engineering, this article summarizes the core ideas and two key skill designs, and adds boundary conditions worth considering in production.
1. From a User-Centric View to an Agent-Centric View
Traditional software development focuses mainly on the needs of end users, treating the model as a passive execution tool. As agent capabilities improve, this one-way perspective is no longer sufficient. Some developers have introduced the concept of “latent demand”: when solving problems, agents encounter their own difficulties—insufficient information, cumbersome steps, or unstable output formats. These difficulties reflect the model’s experience needs.
With this perspective, developers can design systems around three questions:
- What specific difficulties does the agent encounter while solving problems?
- What form of tool most directly addresses those difficulties?
- How do a tool’s input and output structures affect the agent’s reasoning and execution?
General standards such as the Model Context Protocol (MCP), as well as various custom skills, are products of this line of thinking. Once a tool is built, the agent should actually use it so teams can observe its behavior, then revise the tool based on failure cases and detours. This “design, try, observe, revise” loop is the core of bidirectional software design.
2. Programmatic Tool Calling (PTC): Reducing Inference Rounds and Context Usage
The problem with traditional tool calling is that every call completes a full roundtrip: the model generates a call instruction, the runtime executes it and returns the result, the result is written into the context, and the model reasons again to produce the next instruction. A task involving multiple queries, file reads, and API calls generates many roundtrips, causing two direct problems:
- Inference count grows with the number of calls, increasing user wait time.
- Every returned raw payload consumes context window space. With large data volumes, the context can overflow and downstream reasoning quality may degrade.
Programmatic tool calling takes a different approach: the model generates a script in a single pass. The script can contain conditionals, loops, and multiple API requests, and is executed in a sandbox environment. For the model, the whole process involves one inference output and one result receipt. The script only returns the final results the model needs; intermediate data stays in the execution environment and no longer consumes context.
Some platforms have launched similar “code modes” that run scripts in the cloud. Local approaches emphasize integration with developers’ existing environments—for example, using local files, project dependencies, and existing permission systems directly. Both address the same class of problem; the main difference is where the execution environment lives.
PTC’s prerequisite is that the model can reliably generate correct code. Only when code generation accuracy is high enough does it make sense to move the call chain out of model reasoning and into a more deterministic script engine. Whether to adopt PTC therefore depends on three factors: the model’s coding capability, the stability of tool APIs, and whether permissions can be controlled.
When deploying PTC, verify the following items one by one:
- Sandbox permissions: scripts can only access explicitly authorized APIs and files; everything else is denied by default.
- Timeouts and resource limits: set caps on script runtime, memory, and network request counts.
- Failure handling: define whether a failed script retries, rolls back, or returns error information to the model.
- Logging and auditing: record each script’s inputs, the APIs it called, and output summaries for troubleshooting.
- Context budget: specify how much data is returned to the model, keeping only the fields needed for reasoning.
PTC suits tasks where call sequences are relatively fixed, API response structures are stable, and operations can be safely replayed. It does not suit tasks involving irreversible write operations without confirmation mechanisms, or cases where APIs change frequently and the model must make ad-hoc decisions based on intermediate results. In those situations, step-by-step calling remains safer.
3. Structured Human-Model Interaction: Balancing Flexibility and Determinism
When executing complex tasks, agents often need to ask users questions to resolve ambiguity in requirements. There are three main ways to ask, each with different trade-offs:
| Format | Pros | Cons |
|---|---|---|
| Free-text questions | Users can express themselves freely; handles complex cases | Answers may be vague and hard for the model to parse |
| Fixed option buttons | Clear structure; easy to process programmatically | Restricts user expression; struggles with edge cases |
| Modal forms | Combines structured fields with supplementary explanation | Higher design cost; too many fields burden users |
Some developers find modal forms work well for certain tasks. The approach: the tool call contains a clear question text plus several structured input fields, such as dropdowns and single-line text inputs. When the model calls the tool, it is effectively assembling an interactive UI; after the user fills it in, the structured result is returned to the model.
This approach has two benefits. Users filling in fields reduces ambiguity in expression. And with structured intent in hand, the model’s subsequent reasoning stays more accurate. The original author noted that the model calls this skill frequently once available, suggesting a need for a clean, low-noise information channel.
Note that the original write-up provides no sample size or evaluation criteria, so this conclusion should be treated as the author’s practical observation rather than a universal rule. Teams should measure question counts, answer completeness, and task completion rates in their own scenarios before adopting the approach.
4. Summary and Engineering Takeaways
Progress in agent engineering comes from the combined push of engineering practice and model capability. PTC reduces inference rounds; modal interaction makes questions clearer. Both share the same starting point: treat the model as an executor that needs collaboration, observe the friction it encounters when using tools, and adjust the tools and interaction accordingly.
For deployment, consider this checklist:
- Record tool call counts and inference rounds per task to identify high-frequency roundtrip stages.
- Determine whether those high-frequency stages have fixed call sequences and replayable results. If so, consider wrapping them into scripts first.
- For question-asking scenarios, track user answer completeness and the model’s subsequent error rate to decide whether structured forms are needed.
- Set up permissions, timeouts, and auditing for all executable scripts and write operations.
- After every tool change, have the agent re-run typical tasks and compare failure rates and elapsed time.
The effectiveness of agent applications ultimately depends on whether tools match how models work—and on whether engineering teams can continuously improve through observation and measurement.
