What Programming Language Is Used in datawhalechina/hello-agents?
The datawhalechina/hello-agents repository is built entirely in Python, requiring basic Python programming skills to implement and extend its educational agent framework.
The Hello-Agents project by DataWhale China provides an open-source framework for learning autonomous agent development. If you are investigating what programming language is used in datawhalechina/hello-agents, the codebase confirms that Python serves as the sole implementation language, from documentation prerequisites to core framework modules located in the hello_agents/ directory.
Evidence from Repository Documentation
The project explicitly identifies Python as its prerequisite in the primary documentation. According to README_EN.md, users must possess "basic Python programming skill" to follow the tutorials and extend the framework.
This requirement aligns with the repository's composition, which contains dozens of Python scripts ranging from utility files like fix_bold_format.py to tutorial entry points such as code/chapter9/project/main.py. The consistent use of .py extensions throughout the codebase confirms Python as the dominant programming language.
Core Python Implementation Files
The framework's architecture is organized into modular Python packages that demonstrate specific agent capabilities:
SimpleAgent Class: The file hello_agents/agent/simple_agent.py defines the SimpleAgent class, which provides the foundational logic for agent initialization and execution through its run() method.
TerminalTool Utility: Located in hello_agents/tools/builtin/terminal_tool.py, this module implements the TerminalTool class, enabling agents to execute shell commands via Python's native subprocess capabilities.
Context Management: The hello_agents/context/builder.py module handles memory and retrieval operations essential for stateful agent interactions, illustrating Python's suitability for complex agent architectures.
Practical Implementation Examples
The repository contains runnable Python snippets that demonstrate typical usage patterns. Below are implementations derived directly from the source code.
The following example shows how to create a simple agent by extending the HelloAgentsLLM base class and implementing the completion() method:
from hello_agents.agent import SimpleAgent
from hello_agents.llm import HelloAgentsLLM
class MyLLM(HelloAgentsLLM):
def completion(self, prompt, **kwargs):
# Call OpenAI / Azure / local LLM here
return "model response"
agent = SimpleAgent(llm=MyLLM())
response = agent.run("Explain the concept of ReAct.")
print(response)
This pattern is implemented in hello_agents/agent/simple_agent.py and serves as the primary entry point for agent creation.
To demonstrate tool integration, the TerminalTool allows agents to interact with the system shell:
from hello_agents.tools.builtin.terminal_tool import TerminalTool
terminal = TerminalTool()
result = terminal.run({"command": "ls -1 *.py | head -n 5"})
print("First 5 Python files:", result)
This utility, found in hello_agents/tools/builtin/terminal_tool.py, accepts a dictionary parameter with a command key and returns the shell output as a string.
Summary
- Python is the exclusive language used throughout the datawhalechina/hello-agents repository, as stated in
README_EN.mdand evidenced by the.pyfile structure. - Core modules include
simple_agent.pyfor agent logic,terminal_tool.pyfor system integration, andbuilder.pyfor context management. - Implementation requires extending base classes like
HelloAgentsLLMand utilizing method signatures such ascompletion()andrun(). - Tutorial chapters (e.g., Chapter 8 and Chapter 9) reference these Python modules to teach progressive agent development concepts.
Frequently Asked Questions
Is the datawhalechina/hello-agents repository written entirely in Python?
Yes. The repository is implemented entirely in Python, from the core framework files in hello_agents/ to tutorial scripts like code/chapter9/project/main.py and utility files such as fix_bold_format.py. The documentation explicitly lists Python as the-required programming language for contributors.
What Python skills are required to use the hello-agents framework?
According to the README_EN.md file, users need "basic Python programming skill" to work with the project. This includes understanding object-oriented concepts to extend classes like HelloAgentsLLM and SimpleAgent, as well as familiarity with dictionary structures for tool parameter passing.
Can I integrate hello-agents with existing Python projects?
Yes. The framework is designed as a modular Python package. You can import components directly from the hello_agents namespace, such as from hello_agents.agent import SimpleAgent, allowing seamless integration with existing Python codebases and virtual environments.
Where are the main Python source files located in the repository?
The primary source code resides in the hello_agents/ directory, with key files including hello_agents/agent/simple_agent.py for agent logic and hello_agents/tools/builtin/terminal_tool.py for system utilities. Tutorial examples are located in the code/ directory, organized by chapter.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →