How AI Agents Boost Development: Inside the ReAct Framework & Prompt Engineering
This article explains how AI agents, using the ReAct framework, enable a human‑machine pair‑programming workflow, details the reasoning‑acting‑observation loop, showcases practical Python examples with smolagents and DeepSeek, and provides prompt‑engineering guidelines for effective tool‑calling.
In the previous article we saw how an AI Agent can increase game development efficiency by over 60%.
Here we explore why AI Agents can achieve this, covering three main parts: the human‑machine collaboration model, the working principle of AI Agents (the ReAct framework), and prompt‑engineering techniques.
Human‑Machine Collaboration Model
Traditional pair programming involves two developers: a Navigator who decides direction and a Driver who writes code. In the new "human‑machine pairing" model, the Navigator remains a human, while the Driver role is taken by a powerful AI Agent.
The workflow follows a simple loop: human issues a task → AI generates a draft → human reviews and provides feedback → AI refines → human gives final approval.
AI Agent Working Principle – ReAct Framework
ReAct combines Reasoning , Acting , and Observation to enable large language models to solve complex tasks that require interaction with external tools or knowledge bases.
Reasoning (Think)
The agent analyses the user request and context, breaks a high‑level goal into clear, executable steps, decides the order, and selects appropriate tools (e.g., code interpreter, web search, file access).
Acting (Do)
Based on the plan, the agent calls the chosen tools, such as read_file("guild_mining.md") or run_test("guild_mining_tests.erl"), and can generate code snippets, documentation, or configuration files.
Observation (Reflect)
The agent examines the tool output, evaluates whether it meets expectations, and if not, uses the error information as new context to re‑enter the Reasoning phase. This iterative Reason → Act → Observe loop continues until the observation confirms task completion.
ReAct Example with smolagents + DeepSeek
smolagents is an open‑source project that implements the ReAct framework. Below is a command to run a DeepSeek‑based example that searches the web and saves results locally:
python .\examples\deepseek_model_example.py -task "查找 AI Agent的信息整理成清单并保存在本地文件"The Python setup creates a DeepSeek model and a ToolCallingAgent equipped with WebSearchTool and SaveToFileTool:
model = OpenAIServerModel(
model_id="deepseek-chat",
api_base="https://api.deepseek.com",
api_key=os.getenv("DEEPSEEK_API_KEY"),
max_tokens=8192,
flatten_messages_as_text=True,
)
agent = ToolCallingAgent(
tools=[WebSearchTool(engine="bing"), SaveToFileTool()],
model=model,
verbosity_level=1,
)
result = agent.run(task)
print(f"结果: {result}")The generated list of AI‑Agent resources is saved to ai_agent_info.md and includes links to articles, GitHub repos, and Q&A pages.
Prompt Engineering for Tool Calls
Effective prompts must clearly define the role, task, context, expected format, and constraints. An example system prompt is:
You are a helpful AI assistant. Use the available tools to answer the user's question.Key elements of a good prompt:
Role : specify the AI’s identity and expertise.
Task : describe the concrete work and desired deliverable.
Context : provide necessary background and reference code.
Format : define the output structure.
Constraints : list non‑negotiable rules (e.g., always provide a tool call, avoid duplicate calls).
Supported Tools for Major LLMs
Current large models (DeepSeek, GPT, Gemini, Claude) understand tool‑calling APIs and can automatically generate structured tool_calls JSON objects. The typical workflow is:
Identify intent and select a tool.
Generate a tool call with proper arguments.
Receive the tool’s result as a message with role "tool".
Use the result to continue reasoning or produce the final answer.
When the model determines enough information is gathered, it stops calling tools and returns a plain text answer.
Conclusion and Next Steps
We have covered the "shape" of AI Agents—their framework and collaboration method. The next article will dive into the "spirit" behind them: how large language models understand prompts and where their intelligence originates.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
