Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions docs/source/llm_examples/acp/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
than one flattened string, so an attached file costs a line of context and a
screenshot arrives as an image the model actually sees

All the protocol machinery lives in ``library.py``; what is left here is an agent,
four imported tools, and a command line -- which is the point of the example.
All the protocol machinery lives in ``library.py`` and ``server.py``; what is left
here is an agent, four imported tools, and a command line -- which is the point of
the example.

The ``prompt`` skill's signature is the server's contract (see
`EffectfulACPAgent`): the name matches the protocol method it answers
Expand Down Expand Up @@ -41,6 +42,9 @@

Set ``ACP_OFFER_MODELS`` to a comma-separated list to put a picker in the editor's
UI, so the session can be switched without editing the editor's configuration.

Add ``--autoreload`` to edit this file, the modules it imports, ``library.py`` or the
harness while the server runs; ``server.py`` still needs a restart.
"""

import argparse
Expand Down Expand Up @@ -85,8 +89,14 @@ def prompt(
def main() -> None:
from library import EffectfulACPAgent

argparse.ArgumentParser(description=__doc__).parse_args()
asyncio.run(EffectfulACPAgent(Assistant).serve())
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"--autoreload",
action="store_true",
help="re-run code as it is edited, while serving",
)
args = parser.parse_args()
asyncio.run(EffectfulACPAgent(Assistant).serve(autoreload=args.autoreload))


if __name__ == "__main__":
Expand Down
Loading
Loading