Skip to content

Conversation

@Gops123
Copy link
Collaborator

@Gops123 Gops123 commented Dec 26, 2025

Summary

Fixes #84 - Agent Config Parser Error: memory field type mismatch

The memory field in agent configs now supports both simple string format (backward compatible) and structured object format:

Simple String Format (existing)

memory: "File:./agent-memory.json"
memory: "InMemory"

Structured Object Format (new)

memory:
  type: File
  config:
    path: ./k8s-helper-memory.json
    max_messages: 50

Changes

  • aof-core/agent.rs: Add MemorySpec enum supporting both simple string and structured formats
  • aof-core/agent.rs: Add StructuredMemoryConfig struct for the object format
  • aof-core/agent.rs: Implement helper methods: memory_type(), path(), max_messages(), is_file(), is_in_memory()
  • aof-core/agent.rs: Implement Display trait for pretty printing
  • aof-core/lib.rs: Export new types
  • aof-runtime/runtime.rs: Update create_memory_async() to handle MemorySpec
  • aof-runtime/agent_executor.rs: Fix test compilation
  • docs/reference/agent-spec.md: Document both formats with examples

Testing

  • Added 6 new unit tests covering:
    • Simple string format (file and in-memory)
    • Structured object format (file and in-memory)
    • K8s-style YAML with structured memory (exact format from bug report)
    • No memory configuration
  • All existing tests pass
  • Manual verification with the example from the bug report

Backward Compatibility

✅ Fully backward compatible. Existing configurations using string format continue to work.

🤖 Generated with Claude Code

Gopal and others added 4 commits December 26, 2025 16:57
Previously, the memory field in agent configs only accepted a simple
string format like "File:./path.json". Users wanted to use a more
explicit structured format with type and config fields:

  memory:
    type: File
    config:
      path: ./k8s-helper-memory.json
      max_messages: 50

This change adds a MemorySpec enum that supports both formats:
- Simple string: "File:./path.json" (backward compatible)
- Structured: {type: File, config: {path: ..., max_messages: ...}}

Changes:
- Add MemorySpec and StructuredMemoryConfig types in aof-core
- Update AgentConfig, AgentSpec, and FlatAgentConfig to use MemorySpec
- Update runtime.rs to handle the new MemorySpec type
- Add Display trait for MemorySpec for pretty printing
- Add comprehensive tests for both formats
- Update documentation with new structured format examples

Fixes #84

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for a new tool format that uses explicit type declarations:

  tools:
    - type: Shell
      config:
        allowed_commands: [kubectl, helm]
        working_directory: /tmp
    - type: MCP
      config:
        name: kubectl-mcp
        command: ["npx", "-y", "@modelcontextprotocol/server-kubectl"]
    - type: HTTP
      config:
        base_url: http://localhost:8080

This format is more explicit and follows Kubernetes-style conventions.

Changes:
- Add TypeBasedToolSpec struct with Shell/MCP/HTTP types
- Add TypeBasedToolType enum
- Update ToolSpec enum to support TypeBased variant
- Add helper methods: is_http(), is_shell(), tool_type(), type_based_spec()
- Add 4 new tests for type-based tool parsing
- Update documentation with new format examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a note explaining the three supported tool specification formats:
- Type-based: {type: Shell, config: {...}}
- Simple: - shell
- Qualified: {name: shell, source: builtin, config: {...}}

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Now the runtime can actually process type-based tool specifications:

  tools:
    - type: Shell
      config:
        allowed_commands: [kubectl, helm]
    - type: MCP
      config:
        name: kubectl-mcp
        command: ["npx", "-y", "@server-kubectl"]
    - type: HTTP
      config:
        base_url: http://localhost

Changes:
- Add AgentConfig methods for type-based tools:
  - type_based_shell_tools(), type_based_mcp_tools(), type_based_http_tools()
  - has_type_based_tools()
  - type_based_mcp_to_server_configs() - converts to McpServerConfig
  - shell_tool_config(), http_tool_config() - extract typed configs
- Add ShellToolConfig and HttpToolConfig structs
- Update runtime to detect and process type-based tools:
  - Shell tools: adds shell + allowed_commands to executor
  - MCP tools: converts to MCP server configs and initializes
  - HTTP tools: adds http tool to executor
- Export new types from aof-core

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gouravjshah gouravjshah merged commit 7a5d6a0 into main Dec 26, 2025
@gouravjshah gouravjshah deleted the fix/issue-84-memory-field-type-mismatch branch January 2, 2026 12:00
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.

Agent Config Parser Error: memory field type mismatch

3 participants