AI Personal Learning
and practical guidance
豆包Marscode1

Atomic Agents: a framework for building lightweight modular AI intelligences

General Introduction

Atomic Agents is an extremely lightweight and modular framework designed around the concept of atomicity for building agent AI pipelines and applications. The framework provides a set of tools and agents that can be combined to create powerful applications. It is based on Instructor built with Pydantic for data and pattern validation and serialization. All logic and control flow is written in Python, enabling developers to apply best practices and workflows from traditional software development without sacrificing flexibility or clarity.Atomic Agents is designed to meet the enterprise's need for consistent and reliable outputs through modularity, predictability, scalability, and control.

Recommended Reading:Goodbye LangChain! Atomic Agent is on fire!


Atomic Agents:构建轻量级模块化AI智能体框架-1

 

Function List

  • modularization: Build AI applications by combining small, reusable components.
  • predictability: Define clear input and output patterns to ensure consistent behavior.
  • scalability: Easily replace components or integrate new ones without destroying the entire system.
  • controlling: Fine-tune each part of the system individually, from system tips to tool integration.
  • data validation: Data and pattern validation and serialization using Pydantic.
  • Python development: All logic and control flow is written in Python for ease of use by developers.

 

Using Help

Installation process

  1. Make sure Python 3.11 or later is installed.
  2. Install Atomic Agents using pip:
复制复制复制复制复制复制复制复制复制
复制
   pip install atomic-agents
  1. Install providers such as OpenAI and Groq as needed:
复制复制复制复制复制复制复制复制
复制
   pip install openai groq

Guidelines for use

Creating a Proxy

  1. Defining System Tips: Determine the act and purpose of the agent.
  2. Defining Input Modes: Specifies the structure and validation rules for agent input.
  3. Defining Output Modes: Specifies the structure and validation rules for the agent output.
  4. stored memory: Save dialog history or other relevant data.
  5. context provider (computing): Inject dynamic context into the agent's system prompt at runtime.

sample code (computing)

复制复制复制复制复制复制复制
复制
from atomic_agents import Agent, SystemPrompt, InputSchema, OutputSchema
# 定义系统提示
system_prompt = SystemPrompt("你是一个帮助用户解决问题的AI助手。")
# 定义输入和输出模式
input_schema = InputSchema({"type": "object", "properties": {"question": {"type": "string"}}})
output_schema = OutputSchema({"type": "object", "properties": {"answer": {"type": "string"}}})
# 创建代理
agent = Agent(system_prompt=system_prompt, input_schema=input_schema, output_schema=output_schema)
# 使用代理
response = agent.run({"question": "今天的天气怎么样?"})
print(response["answer"])

Development Workflow

  1. Creating a new branch: Create branches for new features or fixes.
复制复制复制复制复制复制
复制
   git checkout -b feature-branch
  1. Making code changes: Make changes in the appropriate project directory.
  2. Formatting Code: Use Black formatting code.
复制复制复制复制复制
复制
   black atomic_agents
  1. code inspection: Code checking with Flake8.
复制复制复制复制
复制
   flake8 atomic_agents
  1. operational test: Ensure that all tests pass.
复制复制复制
复制
   pytest --cov atomic_agents
  1. Submit changes: Commit and push to a remote repository.
复制复制
复制
   git commit -m 'Add some feature'
git push origin feature-branch
  1. Creating a pull request: Create a pull request on GitHub describing the changes and linking to related issues.
May not be reproduced without permission:Chief AI Sharing Circle " Atomic Agents: a framework for building lightweight modular AI intelligences
en_USEnglish