# Develop with Native SDK

### 🚀 Develop and customize new agents

Before starting developing your agents, make sure you have already read the instructions of the agent structures and rules for developing agents in [How to Use Agent](/aios-docs/aios-agent/how-to-use-agent.md) and [How to Develop Agents](/aios-docs/aios-agent/how-to-develop-agents.md). This guide will walk you through creating and running your own agents for AIOS with the native SDK.&#x20;

**Step 1: Set up the Agent Class**

First, in the entry.py in your agent folder, create your agent class and implement the `run` method.&#x20;

```python
class TestAgent:
    def __init__(self, agent_name):
        self.agent_name = agent_name
        self.messages = []

    def run(self, task_input):
        self.messages.append({"role": "user", "content": task_input})
        
        llm_response = llm_chat(
            agent_name=self.agent_name,
            messages=self.messages,
            base_url="http://localhost:8000"
        )
        
        final_result = llm_response["response"]["response_message"]
        return final_result
```

**Step 2: Use APIs provided by AIOS SDK to build your agents**

LLM Core API

Here are the LLM apis that can be imported from `cerebrum/llm/apis.py`

```python
from cerebrum.llm.apis import llm_chat
from cerebrum.llm.apis import llm_chat_with_json_output
from cerebrum.llm.apis import llm_chat_with_tool_call_output
from cerebrum.llm.apis import llm_call_tool
from cerebrum.llm.apis import llm_operate_file
```

* Refer to [LLM-Core API](/aios-docs/aios-agent-sdk/llm-core-api.md) for detailed use

Memory API

Here are the Memory apis that can be imported from `cerebrum/memory/apis.py`

```python
from cerebrum.memory.apis import create_memory
from cerebrum.memory.apis import get_memory
from cerebrum.memory.apis import update_memory
from cerebrum.memory.apis import delete_memory
from cerebrum.memory.apis import search_memories
from cerebrum.memory.apis import create_agentic_memory
```

* Refer to [Memory API](/aios-docs/aios-agent-sdk/memory-api.md) for detailed use

Storage API

Here are the Storage apis that can be imported from `cerebrum/storage/apis.py`

```python
from cerebrum.storage.apis import mount
from cerebrum.storage.apis import create_file
from cerebrum.storage.apis import create_dir
from cerebrum.storage.apis import retrieve_file
from cerebrum.storage.apis import rollback_file
from cerebrum.storage.apis import share_file
```

* Refer to [Storage API](/aios-docs/aios-agent-sdk/storage-api.md) for detailed use

Tool API

```python
from cerebrum.tool.apis import call_tool
```

* Refer to [Tool API](/aios-docs/aios-agent-sdk/tool-api.md) for detailed use

#### Step 3: Run and test your agents

Run the agent you have just built

```bash
run-agent \
  --mode local \
  --agent_path cerebrum/example/agents/test_agent \
  --task "What is the capital of United States?"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aios.foundation/aios-docs/aios-agent/how-to-develop-agents/develop-with-native-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
