Examples
This page collects small scripts demonstrating different aspects of Pygent. Each link points to the source file on GitHub.
- api_example.py – minimal use of the :class:
~pygent.agent.AgentAPI. - runtime_example.py – using the :class:
~pygent.runtime.Runtimeclass directly. - write_file_demo.py – calling the built-in tools from Python code.
 - custom_model.py – implementing a simple custom model.
 - custom_model_with_tool.py – custom model issuing tool calls.
 - custom_tool.py – registering a custom tool.
 - delegate_task_example.py – delegating work to a background agent.
 - config_file_example.py – loading a config file and delegating a testing agent.
 - delegate_external_tool.py – new tool using an external model service inside a delegated task.
 - crew_example.py – coordenando dois agentes em paralelo.
 - prompt_library.py – using the prebuilt system message builders.
 - agent_presets.py – launching an agent from a preset.
 
See the Custom Models page for a walkthrough of building your own models.
Run these with python <script> from the project root. They expect the environment variables described in the Configuration page.