Skip to content

Commit 1dc22d9

Browse files
ekzhujackgerrits
andauthored
Add documentation (#68)
* initial docs * update docs * Update agent.md * Update memory.md * Update runtime.md --------- Co-authored-by: Jack Gerrits <[email protected]>
1 parent 178e209 commit 1dc22d9

File tree

8 files changed

+59
-0
lines changed

8 files changed

+59
-0
lines changed

docs/src/core-concepts/agent.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Agent
2+
3+
An agent in AGNext is an entity that can react to, send, and publish
4+
messages. Messages are the only means through which agents can communicate
5+
with each others.
6+
7+
## TypeRoutedAgent
8+
9+
`agnext.components.TypeRoutedAgent`
10+
is a base class for building custom agents. It provides
11+
a simple API for associating message types with message handlers.
12+
Here is an example of simple agent that reacts to `TextMessage`:
13+
14+
```python
15+
from agnext.chat.types import TextMessage
16+
from agnext.components import TypeRoutedAgent, message_handler
17+
from agnext.core import AgentRuntime, CancellationToken
18+
19+
class MyAgent(TypeRoutedAgent):
20+
21+
@message_handler()
22+
async def on_text_message(self, message: TextMessage, cancellation_token: CancellationToken)) -> None:
23+
await self._publish(TextMessage(content=f"I received this message: ({message.content}) from {message.source}"))
24+
```

docs/src/core-concepts/memory.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Memory
2+
3+
Memory is a collection of data corresponding to the conversation history
4+
of an agent.
5+
Data in meory can be just a simple list of all messages, or a sightly more
6+
realistic one which provides a view of the last N messages
7+
(`agnext.chat.memory.BufferedChatMemory`).

docs/src/core-concepts/patterns.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Multi-Agent Patterns

docs/src/core-concepts/runtime.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Agent Runtime
2+
3+
Agent runtime is the execution environment for agents in AGNext.
4+
Similar to the runtime environment of a programming language, the
5+
agent runtime provides the necessary infrastructure to facilitate communication
6+
between agents, manage agent states, and provide API for monitoring and
7+
debugging multi-agent interactions.
8+
9+
Further readings:
10+
11+
1. `agnext.core.AgentRuntime`
12+
2. `agnext.application.SingleThreadedAgentRuntime`

docs/src/core-concepts/tools.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Tools
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Contributing to AGNext

docs/src/getting-started/tutorial.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Tutorial

docs/src/index.rst

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ agnext
66
:hidden:
77

88
getting-started/installation
9+
getting-started/tutorial
10+
getting-started/contributing
11+
12+
.. toctree::
13+
:caption: Core Concepts
14+
:hidden:
15+
16+
core-concepts/runtime
17+
core-concepts/agent
18+
core-concepts/patterns
19+
core-concepts/memory
20+
core-concepts/tools
921

1022
.. toctree::
1123
:caption: Guides

0 commit comments

Comments
 (0)