mirror of
https://github.com/microsoft/autogen.git
synced 2025-12-28 07:29:54 +00:00
parent
51c8b678de
commit
6d7cbe0027
@ -0,0 +1,25 @@
|
||||
# Examples
|
||||
|
||||
This directory contains examples of how to use AGNext.
|
||||
|
||||
First, you need to install AGNext and development dependencies by running the
|
||||
following command:
|
||||
|
||||
```bash
|
||||
pip install -e '.[dev]'
|
||||
```
|
||||
|
||||
To run an example, just run the corresponding Python script. For example, to run the `coder_reviewer.py` example, run:
|
||||
|
||||
```bash
|
||||
python coder_reviewer.py
|
||||
```
|
||||
|
||||
To enable logging, turn on verbose mode by setting `--verbose` flag:
|
||||
|
||||
```bash
|
||||
python coder_reviewer.py --verbose
|
||||
```
|
||||
|
||||
By default the log file is saved in the same directory with the same filename
|
||||
as the script, e.g., "coder_reviewer.log".
|
||||
@ -238,4 +238,6 @@ if __name__ == "__main__":
|
||||
if args.verbose:
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logging.getLogger("agnext").setLevel(logging.DEBUG)
|
||||
handler = logging.FileHandler("assistant.log")
|
||||
logging.getLogger("agnext").addHandler(handler)
|
||||
asyncio.run(main())
|
||||
|
||||
@ -210,5 +210,7 @@ if __name__ == "__main__":
|
||||
if args.verbose:
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logging.getLogger("agnext").setLevel(logging.DEBUG)
|
||||
handler = logging.FileHandler("chess_game.log")
|
||||
logging.getLogger("agnext").addHandler(handler)
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import argparse
|
||||
import asyncio
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
|
||||
from agnext.application import SingleThreadedAgentRuntime
|
||||
@ -47,4 +49,12 @@ async def main() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Inner-Outter agent example.")
|
||||
parser.add_argument("--verbose", action="store_true", help="Enable verbose logging.")
|
||||
args = parser.parse_args()
|
||||
if args.verbose:
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logging.getLogger("agnext").setLevel(logging.DEBUG)
|
||||
handler = logging.FileHandler("inner_outter.log")
|
||||
logging.getLogger("agnext").addHandler(handler)
|
||||
asyncio.run(main())
|
||||
@ -158,6 +158,7 @@ async def run(message: str, user: str, scenario: Callable[[AgentRuntime], Orches
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Run a orchestrator demo.")
|
||||
choices = {"software_development": software_development}
|
||||
parser.add_argument("--verbose", action="store_true", help="Enable verbose logging.")
|
||||
parser.add_argument(
|
||||
"--scenario",
|
||||
choices=list(choices.keys()),
|
||||
@ -171,4 +172,9 @@ if __name__ == "__main__":
|
||||
)
|
||||
parser.add_argument("--message", help="The message to send.", required=True)
|
||||
args = parser.parse_args()
|
||||
if args.verbose:
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logging.getLogger("agnext").setLevel(logging.DEBUG)
|
||||
handler = logging.FileHandler("inner_outter.log")
|
||||
logging.getLogger("agnext").addHandler(handler)
|
||||
asyncio.run(run(args.message, args.user, choices[args.scenario]))
|
||||
|
||||
@ -50,7 +50,7 @@ line-length = 120
|
||||
fix = true
|
||||
exclude = ["build", "dist", "my_project/__init__.py", "my_project/main.py"]
|
||||
target-version = "py310"
|
||||
include = ["src/**", "examples/**"]
|
||||
include = ["src/**", "examples/*.py"]
|
||||
|
||||
[tool.ruff.format]
|
||||
docstring-code-format = true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user