refactor: demo agent with LLM_AGENT_VAR_* (#82)

This commit is contained in:
sigoden
2024-07-30 15:09:18 +08:00
committed by GitHub
parent 213d1b3fd7
commit 3e8b7b2e45
3 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ documents:
- https://example.com/remote-file.txt - https://example.com/remote-file.txt
``` ```
Refer to `./agents/todo-{sh,js,py}` for examples of how to implement a agent. Refer to [./agents/demo](https://github.com/sigoden/llm-functions/tree/main/agents/demo) for examples of how to implement a agent.
## License ## License
+16 -13
View File
@@ -21,21 +21,26 @@ variables:
When use define variables, please avoid these built-in variables: When use define variables, please avoid these built-in variables:
| name | description | example | | name | description | example |
| :------------ | :-------------------------------------------- | :----------------------- | | :-------------- | :-------------------------------------------- | :----------------------- |
| __os__ | Operating system name | linux | | `__os__` | Operating system name | linux |
| __os_family__ | Operating system family | unix | | `__os_family__` | Operating system family | unix |
| __arch__ | System architecture | x86_64 | | `__arch__` | System architecture | x86_64 |
| __shell__ | Current user's default shell | bash | | `__shell__` | Current user's default shell | bash |
| __locale__ | User's preferred language and region settings | en-US | | `__locale__` | User's preferred language and region settings | en-US |
| __now__ | Current timestamp in ISO 8601 format | 2024-07-29T08:11:24.367Z | | `__now__` | Current timestamp in ISO 8601 format | 2024-07-29T08:11:24.367Z |
| __cwd__ | Current working directory | /tmp | | `__cwd__` | Current working directory | /tmp |
| `__tools__` | List of agent tools | |
Variables should be used in the `instructions` field. Variables can be used in the `instructions` and tools script.
```yaml ```yaml
instructions: | instructions: |
The instructions can inline user defined variables: {{foo}}, {{bar}} and builtin variables {{__shell__}}. The instructions can access variables {{foo}} and {{bar}}.
```
```sh
echo "The tools script can access environment variables $LLM_AGENT_VAR_FOO and $LLM_AGENT_VAR_BAR"
``` ```
### documents ### documents
@@ -53,8 +58,6 @@ documents:
The tool script implements agent-specific tools. The tool script implements agent-specific tools.
> You only need one of the `tools.sh`, `tools.js`, or `tools.py`.
## tools.txt ## tools.txt
The `tools.txt` file enables tool reuse from the `/tools` folder in this project. The `tools.txt` file enables tool reuse from the `/tools` folder in this project.
+1 -1
View File
@@ -5,7 +5,7 @@ instructions: |
You are a AI agent designed to demonstrate agent capabilities. You are a AI agent designed to demonstrate agent capabilities.
<tools> <tools>
__TOOLS__ {{__tools__}}
</tools> </tools>
<system> <system>