eidolon-ai / eidolon

The first AI Agent Server, Eidolon is a pluggable Agent SDK and enterprise ready, deployment server for Agentic applications
https://www.eidolonai.com/
Apache License 2.0
297 stars 32 forks source link

[ problem ] found unhashable key in resource `user_prompt: {{ body }}` #944

Open flynntsang opened 2 days ago

flynntsang commented 2 days ago

To Reproduce

  1. Clone the agent-machine
  2. Create a new agent resource file, e.g. hello-world-agent.eidolon.yaml
  3. Use the IDE shortcuts, e.g.:
    • apiVersion
    • AgentResource
    • SimpleAgent
    • actions
  4. Add or edit the configuration so you get the following file:
    apiVersion: server.eidolonai.com/v1alpha1
    kind: Agent
    metadata:
    name: hello-world-agent
    spec:
    implementation: SimpleAgent
    actions:
    - name: converse
      user_prompt: {{ body }}
      allow_file_upload: true
      output_state: idle
  5. From the agent-machine root directory, load the server, e.g. sudo make docker-serve
  6. See error (attached)
...
agent-server-1  |   File "/usr/local/lib/python3.11/site-packages/yaml/constructor.py", line 141, in construct_mapping
agent-server-1  |     raise ConstructorError("while constructing a mapping", node.start_mark,
agent-server-1  | yaml.constructor.ConstructorError: while constructing a mapping
agent-server-1  |   in "/local_mount/resources/hello-world-agent.eidolon.yaml", line 9, column 20
agent-server-1  | found unhashable key
agent-server-1  |   in "/local_mount/resources/hello-world-agent.eidolon.yaml", line 9, column 21

error-action-body-unhashable-key.txt

flynntsang commented 2 days ago

@LukeLalor Quoting prevents an error, specifically: "{{ body }}"

To do: update the IDE plugins.

apiVersion: server.eidolonai.com/v1alpha1
kind: Agent
metadata:
  name: hello-world-agent
spec: 
  implementation: SimpleAgent
  description: |
    "This is a general agent that uses an LLM to answer questions."
  system_prompt: You are a helpful assistant. Always use the provided tools, if appropriate, to complete the task.
  actions:
    - name: converse
      user_prompt: "{{ body }}"
      allow_file_upload: true
      output_state: idle
LukeLalor commented 2 days ago

This might be a bug in vscode yaml plugin. which would be somewhat out of our control.

We just say that the default string is "{{ body }}" and the plugin is what adds it unquoted, which isn't valid yaml as far as I can tell.

LukeLalor commented 2 days ago

on a similar note

agent-server-1  | ERROR - Failed to start AgentOS
agent-server-1  | Traceback (most recent call last):
...
agent-server-1  | yaml.constructor.ConstructorError: while constructing a mapping
agent-server-1  |   in "/local_mount/resources/hello-world-agent.eidolon.yaml", line 9, column 20
agent-server-1  | found unhashable key
agent-server-1  |   in "/local_mount/resources/hello-world-agent.eidolon.yaml", line 9, column 21

is this error clear enough? Perhaps the stack trace should just be "Error parsing yaml file hello-world.yaml: ConstructorError: while constructing mapping in ... line 9, column 20"