---
title: Architecture
description: CowAgent 2.0 system architecture and core design
---

# Architecture

CowAgent 2.0 is a comprehensive upgrade from a simple chatbot to an AI super assistant, built on an Agent architecture with autonomous thinking, task planning, long-term memory, and skill extension capabilities.

## System Architecture

```
┌──────────────────────────────────────────────────────┐
│                     Channels                         │
│    Web │ Feishu │ DingTalk │ WeCom │ WeChat MP       │
└───────────────────────┬──────────────────────────────┘
                        │
┌───────────────────────▼──────────────────────────────┐
│                    Agent Core                        │
│  ┌─────────────┐ ┌──────────┐ ┌───────────────────┐  │
│  │ Task Planner│ │  Memory  │ │  Skills Engine     │  │
│  └──────┬──────┘ └────┬─────┘ └────────┬──────────┘  │
│         │             │                │              │
│  ┌──────▼─────────────▼────────────────▼──────────┐  │
│  │                  Tools                         │  │
│  │  File R/W │ Bash │ Browser │ Scheduler │ ...   │  │
│  └────────────────────────────────────────────────┘  │
└───────────────────────┬──────────────────────────────┘
                        │
┌───────────────────────▼──────────────────────────────┐
│                    Models                            │
│   OpenAI │ Claude │ Gemini │ MiniMax │ GLM │ ...     │
└──────────────────────────────────────────────────────┘
```

### Core Modules

| Module | Description |
| --- | --- |
| **Channels** | Message channel layer for receiving and sending messages, supporting Web, Feishu, DingTalk, WeCom, WeChat Official Accounts, etc. |
| **Agent Core** | The intelligent agent engine, including task planning, memory system, and skills engine |
| **Tools** | Tool layer through which the Agent accesses OS resources, with 10+ built-in tools |
| **Models** | Model layer supporting unified access to major domestic and international LLMs |

## Agent Mode

When Agent mode is enabled, CowAgent operates as an autonomous intelligent agent with the following workflow:

1. **Receive Message** - Receives user input through a channel
2. **Understand Intent** - Analyzes task requirements and context
3. **Plan Task** - Breaks complex tasks into multiple steps
4. **Call Tools** - Selects appropriate tools to execute each step
5. **Update Memory** - Stores important information in long-term memory
6. **Return Result** - Sends execution results back to the user

## Workspace

The Agent workspace defaults to `~/cow`, storing system prompts, memory files, skill files, etc.:

```
~/cow/
├── system.md          # Agent system prompt
├── user.md            # User profile
├── memory/            # Long-term memory storage
│   ├── core.md        # Core memory
│   └── daily/         # Daily memory
├── skills/            # Custom skills
│   ├── skill-1/
│   └── skill-2/
└── .env               # Secret keys for skills
```

## Core Configuration

Configure Agent mode parameters in `config.json`:

```json
{
  "agent": true,
  "agent_workspace": "~/cow",
  "agent_max_context_tokens": 40000,
  "agent_max_context_turns": 30,
  "agent_max_steps": 15
}
```

| Parameter | Description | Default |
| --- | --- | --- |
| `agent` | Enable Agent mode | `true` |
| `agent_workspace` | Workspace path | `~/cow` |
| `agent_max_context_tokens` | Maximum context tokens | `40000` |
| `agent_max_context_turns` | Maximum context conversation turns | `30` |
| `agent_max_steps` | Maximum tool call steps per task | `15` |
