Add documentation (#68)

* initial docs

* update docs

* Update agent.md

* Update memory.md

* Update runtime.md

---------

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
This commit is contained in:
Eric Zhu 2024-06-12 08:25:42 -07:00 committed by GitHub
parent 178e209e5f
commit 1dc22d9672
8 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,24 @@
# Agent
An agent in AGNext is an entity that can react to, send, and publish
messages. Messages are the only means through which agents can communicate
with each others.
## TypeRoutedAgent
`agnext.components.TypeRoutedAgent`
is a base class for building custom agents. It provides
a simple API for associating message types with message handlers.
Here is an example of simple agent that reacts to `TextMessage`:
```python
from agnext.chat.types import TextMessage
from agnext.components import TypeRoutedAgent, message_handler
from agnext.core import AgentRuntime, CancellationToken
class MyAgent(TypeRoutedAgent):
@message_handler()
async def on_text_message(self, message: TextMessage, cancellation_token: CancellationToken)) -> None:
await self._publish(TextMessage(content=f"I received this message: ({message.content}) from {message.source}"))
```

View File

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

View File

@ -0,0 +1 @@
# Multi-Agent Patterns

View File

@ -0,0 +1,12 @@
# Agent Runtime
Agent runtime is the execution environment for agents in AGNext.
Similar to the runtime environment of a programming language, the
agent runtime provides the necessary infrastructure to facilitate communication
between agents, manage agent states, and provide API for monitoring and
debugging multi-agent interactions.
Further readings:
1. `agnext.core.AgentRuntime`
2. `agnext.application.SingleThreadedAgentRuntime`

View File

@ -0,0 +1 @@
# Tools

View File

@ -0,0 +1 @@
# Contributing to AGNext

View File

@ -0,0 +1 @@
# Tutorial

View File

@ -6,6 +6,18 @@ agnext
:hidden:
getting-started/installation
getting-started/tutorial
getting-started/contributing
.. toctree::
:caption: Core Concepts
:hidden:
core-concepts/runtime
core-concepts/agent
core-concepts/patterns
core-concepts/memory
core-concepts/tools
.. toctree::
:caption: Guides