-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor agent_fs to defAgent and update related documentation #755
Changes from all commits
deacff1
459bc2a
37f9008
bd1738a
852c21e
96c7516
bc3595f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Builtin Agents | ||
description: List of agents in system prompts | ||
--- | ||
import { LinkCard } from '@astrojs/starlight/components'; | ||
|
||
### Builtin Agents | ||
|
||
<LinkCard title="fs" description="Queries files to accomplish tasks" href="/genaiscript/reference/scripts/system#systemagent_fs" /> | ||
<LinkCard title="git" description="Agent that can query a repository using Git to accomplish tasks. Provide all the context information available to execute git queries." href="/genaiscript/reference/scripts/system#systemagent_git" /> | ||
<LinkCard title="github" description="Agent that can query GitHub to accomplish tasks" href="/genaiscript/reference/scripts/system#systemagent_github" /> | ||
<LinkCard title="interpreter" description="Run code interpreters for Python, Math. Use this agent to ground computation questions." href="/genaiscript/reference/scripts/system#systemagent_interpreter" /> | ||
<LinkCard title="user_input" description="Ask user for input to confirm, select or answer a question." href="/genaiscript/reference/scripts/system#systemagent_user_input" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,24 +6,19 @@ | |
|
||
### Builtin tools | ||
|
||
<LinkCard title="agent_fs" description="Agent that can query files to accomplish tasks" href="/genaiscript/reference/scripts/system#systemagent_fs" /> | ||
<LinkCard title="agent_git" description="Agent that can query a repository using Git to accomplish tasks. Provide all the context information available to execute git queries." href="/genaiscript/reference/scripts/system#systemagent_git" /> | ||
<LinkCard title="agent_github" description="Agent that can query GitHub to accomplish tasks" href="/genaiscript/reference/scripts/system#systemagent_github" /> | ||
<LinkCard title="agent_interpreter" description="Run code interpreters for Python, Math. Use this agent to ground computation questions." href="/genaiscript/reference/scripts/system#systemagent_interpreter" /> | ||
<LinkCard title="agent_user_input" description="Ask user for input to confirm, select or answer a question." href="/genaiscript/reference/scripts/system#systemagent_user_input" /> | ||
<LinkCard title="fs_diff_files" description="Computes a diff between two files." href="/genaiscript/reference/scripts/system#systemfs_diff_files" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be a typo here.
|
||
<LinkCard title="fs_find_files" description="Finds file matching a glob pattern. Use pattern to specify a regular expression to search for in the file content." href="/genaiscript/reference/scripts/system#systemfs_find_files" /> | ||
<LinkCard title="fs_read_file" description="Reads a file as text from the file system. Returns undefined if the file does not exist." href="/genaiscript/reference/scripts/system#systemfs_read_file" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The 'agent_fs', 'agent_git', 'agent_github', 'agent_interpreter', and 'agent_user_input' LinkCards have been removed. Ensure that this change is intentional and that any references to these agents are updated accordingly in the documentation.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of several LinkCard components may indicate that the corresponding agents are deprecated or moved. Ensure that this change is intentional and that any references to these agents are updated or removed elsewhere in the documentation to maintain consistency.
|
||
<LinkCard title="git_branch_current" description="Gets the current branch using git." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_branch_list" description="List all branches using git." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_diff" description="Computes file diffs using git. If the diff is too large, it returns the list of modified/added files." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_log" description="Generates a log of commits using git." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_diff" description="Computes file diffs using the git diff command. If the diff is too large, it returns the list of modified/added files." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_list_commits" description="Generates a history of commits using the git log command." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_status" description="Generates a status of the repository using git." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="git_last_tag" description="Gets the last tag using git." href="/genaiscript/reference/scripts/system#systemgit" /> | ||
<LinkCard title="github_actions_workflows_list" description="List all workflows as a list of 'id: name' pair." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_jobs_list" description="List all jobs for a run." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_job_logs_get" description="Download workflow job log. If the log is too large, use 'github_actions_job_logs_diff' to compare logs." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_job_logs_diff" description="Diffs two workflow job logsr." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_workflows_list" description="List all github workflows." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_jobs_list" description="List all jobs for a github workflow run." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_job_logs_get" description="Download github workflow job log. If the log is too large, use 'github_actions_job_logs_diff' to compare logs." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_actions_job_logs_diff" description="Diffs two github workflow job logs." href="/genaiscript/reference/scripts/system#systemgithub_actions" /> | ||
<LinkCard title="github_files_get" description="Get a file from a repository." href="/genaiscript/reference/scripts/system#systemgithub_files" /> | ||
<LinkCard title="github_files_list" description="List all files in a repository." href="/genaiscript/reference/scripts/system#systemgithub_files" /> | ||
<LinkCard title="github_issues_list" description="List all issues in a repository." href="/genaiscript/reference/scripts/system#systemgithub_issues" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import { FileTree } from "@astrojs/starlight/components" | ||
import AudioPlayer from "../../components/AudioPlayer.astro" | ||
import DirectoryLinks from "../../components/DirectoryLinks.astro" | ||
import { Content as BuiltinAgents } from "../../components/BuiltinAgents.mdx" | ||
|
||
import vscodeSrc from "../../../public/images/visual-studio-code.png" | ||
|
||
|
@@ -116,6 +117,43 @@ | |
|
||
</Card> | ||
|
||
<Card title="LLM Tools" icon="setting"> | ||
|
||
Register JavaScript functions as [LLM tools](/genaiscript/reference/scripts/tools/) | ||
|
||
```js wrap | ||
defTool("weather", "live weahter", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be a typo here.
|
||
{ city: "Paris" }, // schema | ||
async ({ city }) => // callback | ||
{ ... "sunny" } | ||
) | ||
``` | ||
|
||
or use built-in [@agentic tools](/genaiscript/guides/agentic-tools/) | ||
|
||
```js wrap | ||
import { WeatherClient } from "@agentic/weather" | ||
defTool(new WeatherClient()) | ||
``` | ||
|
||
</Card> | ||
|
||
<Card title="LLM Agents" icon="sun"> | ||
|
||
Combine [tools](/genaiscript/reference/scripts/tools) and [inline prompts](/genaiscript/reference/scripts/inline-prompts/) | ||
into an [agent](/genaiscript/reference/scripts/agents). | ||
|
||
```js wrap | ||
defAgent( | ||
"git", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be a typo here.
|
||
"Agent that answer git questions for the current repo", | ||
"You are a helpful expert in using git.", | ||
{ tools: ["git"] } | ||
) | ||
``` | ||
|
||
</Card> | ||
|
||
<Card title="Reuse and Share Scripts" icon="star"> | ||
|
||
Scripts are [files](/genaiscript/reference/scripts/)! They can be versioned, shared, forked, ... | ||
|
@@ -259,27 +297,6 @@ | |
|
||
</Card> | ||
|
||
<Card title="LLM Tools" icon="setting"> | ||
|
||
Register JavaScript functions as [LLM tools](/genaiscript/reference/scripts/tools/) | ||
|
||
```js wrap | ||
defTool("weather", "live weahter", | ||
{ city: "Paris" }, // schema | ||
async ({ city }) => // callback | ||
{ ... "sunny" } | ||
) | ||
``` | ||
|
||
or use built-in [@agentic tools](/genaiscript/guides/agentic-tools/) | ||
|
||
```js wrap | ||
import { WeatherClient } from "@agentic/weather" | ||
defTool(new WeatherClient()) | ||
``` | ||
|
||
</Card> | ||
|
||
<Card title="Code Interpreter" icon="seti:python"> | ||
|
||
Let the LLM run code in a sandboxed execution environment. | ||
|
@@ -379,16 +396,23 @@ | |
</CardGrid> | ||
|
||
## Case Studies | ||
|
||
Tales from the real world using GenAIScript. | ||
|
||
<DirectoryLinks directory="case-studies" /> | ||
|
||
## Samples | ||
|
||
Fully fledged scripts ready to use. | ||
|
||
<DirectoryLinks directory="samples" /> | ||
|
||
## Guides | ||
|
||
A cookbook full of recipes to make you a genius scripter. | ||
|
||
<DirectoryLinks directory="guides" /> | ||
|
||
## Agents | ||
|
||
<BuiltinAgents /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Agents (LLM Tools) | ||
description: An Agent is a tool that queries LLM, equipped with other tools, to accomplish tasks. | ||
sidebar: | ||
order: 7.1 | ||
--- | ||
|
||
import { Content as BuiltinAgents } from "../../../../components/BuiltinAgents.mdx" | ||
|
||
GenAIScript defines an **agent** as a [tool](/genaiscript/reference/scripts/tools) that | ||
runs an [inline prompt](/genaiscript/reference/scripts/inline-prompts) to accomplish a task. The agent LLM is typically augmented with | ||
additional tools. | ||
|
||
## Agent flow engine | ||
|
||
**GenAIScript does _not_ implement any agentic workflow or decision.** | ||
It relies entierly on [tools](/genaiscript/reference/scripts/tools) support builtin to the LLMs. | ||
|
||
## defAgent | ||
|
||
The `defAgent` function is used to define an agent that can be called by the LLM. It takes a JSON schema to define the input and expects a string output. The LLM decides to call this agent on its own! | ||
|
||
```ts | ||
defAgent( | ||
"git", // agent id becomes 'agent_git' | ||
"Handles any git operation", // description | ||
"You are a helpful expert in using git.", | ||
{ | ||
tools: ["git"], | ||
} | ||
) | ||
``` | ||
|
||
- the agent id will become the tool id `agent_<id>` | ||
- the description of the agent will automatically be augmented with information about the available tools | ||
|
||
<BuiltinAgents /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link to the agent_fs documentation has been removed, which may lead to a broken link or missing information for users.