Skip to content
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

feat: agent supports dynamic instructions #1023

Merged
merged 3 commits into from
Nov 30, 2024
Merged

feat: agent supports dynamic instructions #1023

merged 3 commits into from
Nov 30, 2024

Conversation

sigoden
Copy link
Owner

@sigoden sigoden commented Nov 30, 2024

This PR implement agent dynamic instructions.

A jsonviewer agent at sigoden/llm-functions#134

aichat-agent-jsonviewer

close #1019

@sigoden sigoden merged commit 431d163 into main Nov 30, 2024
3 checks passed
@sigoden sigoden deleted the feat branch November 30, 2024 23:28
@einarpersson
Copy link

einarpersson commented Dec 2, 2024

Hi!

Hmm interesting. Since my original proposal was rejected I resorted to creating a wrapper function. The wrapper does the following:

  1. Sources a script with some common exported env vars
  2. Optionally sources a similar file for the specific role being in use
  3. populate any env vars in the role markdown file with envsubst with actual values
  4. create a temp role file and call aichat binary with a temp role folder specified

If I were to adopt this new way then I guess I need to transition from roles to agents (I actually liked writing instructions in markdown files, but I guess I can create a util if i would like to keep providing instructions for agents in a INSTRUCTIONS.md file i really wanted to)...

EDIT: Hmm, but agents still can't use shared tools right? Or can they use toolsets now? Don't see anything about it in the docs...

EDIT 2: I just realized another limitation. By using my solution I can make the shell integration role a lot smarter and more reliable by increasing the context given. However, this new feature does only apply to agents as I understand it. Can we make it so that you can override the default shell integration with a %shell% agent? (instead of just a role?)

@sigoden
Copy link
Owner Author

sigoden commented Dec 2, 2024

Hmm, but agents still can't use shared tools right? Or can they use toolsets now?

  1. Agent has tools.txt. For example, https://github.com/sigoden/llm-functions/blob/main/agents/coder/tools.txt
  2. Agent configuration has use_tools field that adds addition tools,
    use_tools: null # Which additional tools to use by agent. (e.g. 'fs,web_search')

Can we make it so that you can override the default shell integration with a %shell% agent?

No. Here are the reasons:

  1. It's not necessary. For most people, %shell% role is good enough.
  2. %shell% role can be easy to customize, try .edit role.
  3. The agent needs to install llm-functions.

@einarpersson
Copy link

einarpersson commented Dec 3, 2024

Thanks for pointing out the shared tools feature, I have been reading the docs but somehow didn't see it.

Hmm, don't know really what .edit role is supposed to do

temp/assistant) .role %shell%                                                                                                                              0

temp/%shell%) .edit role
Error: No role

but I imagine that it still won't be able to provide the dynamic information I am after.

I have to think about this. I would of course like to just your builtin feature rather than my home-made wrapper (but I have to admit really enjoyed just being able to put in arbitrary env vars in the markdown files, it felt very convenient. And I do feel it is very useful to have dynamic context available for the shell assistant).

Hmm, wait - I guess I could just replace the shell integration to use my shell-agent and everything will be fine?

PS. Hope you don't read my comments as criticism, I am just thinking out loud and sharing experiences. Thank you once again for this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AI Agents Support Dynamic Instructions
2 participants