Skip to content

Refine config docs and fix matcher required param detection#29

Merged
JohnRichard4096 merged 2 commits intomainfrom
docs/update
Mar 16, 2026
Merged

Refine config docs and fix matcher required param detection#29
JohnRichard4096 merged 2 commits intomainfrom
docs/update

Conversation

@JohnRichard4096
Copy link
Copy Markdown
Member

@JohnRichard4096 JohnRichard4096 commented Mar 16, 2026

Summary by Sourcery

Update configuration and advanced usage documentation to introduce BuiltinAgentConfig and clarify option responsibilities, and fix dependency resolution for required parameters in the hook matcher.

Bug Fixes:

  • Correct required-parameter detection in hook dependency resolution to avoid missing required arguments.

Enhancements:

  • Refine configuration examples to separate builtin agent policy controls from general FunctionConfig behavior and improve wording for LLM and security options.

Documentation:

  • Document BuiltinAgentConfig in both English and Chinese guides and API references, update AmritaConfig examples to include builtin configuration, and streamline getting-started examples by removing options no longer on FunctionConfig.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Mar 16, 2026

Reviewer's Guide

Updates configuration documentation to introduce BuiltinAgentConfig, relocate tool_calling_mode and agent_thought_mode settings from FunctionConfig to BuiltinAgentConfig examples in both English and Chinese docs, refines wording throughout the docs, and fixes a dependency resolution bug in the hook matcher by computing required parameters from already-filtered parameters.

Class diagram for AmritaConfig and BuiltinAgentConfig configuration split

classDiagram
    class AmritaConfig {
        +FunctionConfig function_config
        +LLMConfig llm
        +CookieConfig cookie
        +BuiltinAgentConfig builtin
    }

    class FunctionConfig {
        +bool use_minimal_context
        +bool agent_mcp_client_enable
    }

    class BuiltinAgentConfig {
        +string tool_calling_mode
        +string agent_thought_mode
    }

    class LLMConfig {
        +bool enable_memory_abstract
        +float memory_abstract_proportion
        +int max_tokens
        +int llm_timeout
        +bool auto_retry
        +int max_retries
        +int memory_length_limit
    }

    class CookieConfig {
        +bool enable_cookie
        +string cookie
    }

    AmritaConfig *-- FunctionConfig : composes
    AmritaConfig *-- LLMConfig : composes
    AmritaConfig *-- CookieConfig : composes
    AmritaConfig *-- BuiltinAgentConfig : composes
Loading

File-Level Changes

Change Details Files
Document BuiltinAgentConfig as part of the core configuration and update AmritaConfig examples to include it.
  • Extend import examples to include BuiltinAgentConfig in AmritaConfig usage snippets.
  • Add builtin=BuiltinAgentConfig(...) to AmritaConfig construction examples in both English and Chinese guides.
  • Clarify FunctionConfig description as controlling core behaviors of AmritaCore rather than all agent policy.
  • Adjust headings and descriptions around configuration sections to accommodate the new BuiltinAgentConfig section.
docs/guide/concepts/index.md
docs/zh/guide/concepts/index.md
docs/guide/api-reference/index.md
docs/zh/guide/api-reference/classes/AmritaConfig.md
Move tool_calling_mode and agent_thought_mode examples from FunctionConfig into BuiltinAgentConfig sections and basic examples, and simplify FunctionConfig usage.
  • Remove tool_calling_mode and agent_thought_mode arguments from FunctionConfig examples in getting-started docs (English and Chinese) and from AmritaConfig examples where they no longer apply.
  • Add detailed subsections under BuiltinAgentConfig describing tool_calling_mode and agent_thought_mode semantics, with updated example code in both English and Chinese conceptual guides.
  • Update configuration best-practices sections and surrounding text to align with the new division of responsibilities between FunctionConfig and BuiltinAgentConfig.
docs/guide/concepts/index.md
docs/zh/guide/concepts/index.md
docs/guide/getting-started/basic-example.md
docs/zh/guide/getting-started/basic-example.md
docs/guide/api-reference/index.md
docs/zh/guide/api-reference/classes/AmritaConfig.md
Polish English and Chinese documentation wording and naming consistency for concepts and advanced topics.
  • Capitalize "Agent" consistently where used as a proper component name and refine phrasing around context usage, timeouts, retries, and security settings.
  • Clarify various comments in code snippets (e.g., memory_abstract_proportion semantics, max_tokens, llm_timeout, memory_length_limit).
  • Rename some section titles for clarity (e.g., Stream Processing Design, Callback-based Responses, Memory Summarization Mechanism) and remove redundant determiners in class descriptions.
  • Tweak comments and parameter descriptions for ChatObject and PresetManager examples for more natural wording.
docs/guide/concepts/index.md
docs/zh/guide/concepts/index.md
Fix dependency resolution logic in the hook matcher to correctly derive the set of required parameters.
  • Introduce a required_params dictionary initialized before iterating over parameters and populated only for parameters whose default is inspect.Parameter.empty.
  • Remove the previous computation of required_params from the full function signature parameters in favor of the filtered set derived while scanning params.
  • Use the newly built required_params when resolving dependency arguments to ensure alignment with the filtered parameter set.
src/amrita_core/hook/matcher.py
Update English API reference AmritaConfig example to reflect BuiltinAgentConfig addition and clean up parameters.
  • Extend import to include BuiltinAgentConfig (though note the current typo BuiltinAgnentConfig should be checked during review).
  • Add builtin=BuiltinAgentConfig(tool_calling_mode="agent") to the example configuration.
  • Remove now-obsolete FunctionConfig tool_calling_mode usage from the example.
docs/guide/api-reference/classes/AmritaConfig.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In docs/guide/api-reference/classes/AmritaConfig.md, the import line uses BuiltinAgnentConfig while the example below uses BuiltinAgentConfig; align the name to the actual exported class to avoid confusion and import errors.
  • In the BuiltinAgentConfig sections (both EN and ZH docs), the lists of string options for tool_calling_mode and agent_thought_mode use unbalanced quotes (e.g., "agent instead of "agent"); fix these so the option names render correctly and can be copy-pasted safely.
  • The new BuiltinAgentConfig examples still use variable names like func_config_agent/func_config_rag, which previously referred to FunctionConfig; consider renaming them (e.g., builtin_config_agent) to clearly distinguish built-in agent policy settings from function configuration.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `docs/guide/api-reference/classes/AmritaConfig.md`, the import line uses `BuiltinAgnentConfig` while the example below uses `BuiltinAgentConfig`; align the name to the actual exported class to avoid confusion and import errors.
- In the `BuiltinAgentConfig` sections (both EN and ZH docs), the lists of string options for `tool_calling_mode` and `agent_thought_mode` use unbalanced quotes (e.g., ``"agent`` instead of ``"agent"``); fix these so the option names render correctly and can be copy-pasted safely.
- The new `BuiltinAgentConfig` examples still use variable names like `func_config_agent`/`func_config_rag`, which previously referred to `FunctionConfig`; consider renaming them (e.g., `builtin_config_agent`) to clearly distinguish built-in agent policy settings from function configuration.

## Individual Comments

### Comment 1
<location path="docs/guide/api-reference/classes/AmritaConfig.md" line_range="14" />
<code_context>

 ```python
-from amrita_core.config import AmritaConfig, FunctionConfig, LLMConfig, CookieConfig
+from amrita_core.config import AmritaConfig, FunctionConfig, LLMConfig, CookieConfig, BuiltinAgnentConfig

 config = AmritaConfig(
</code_context>
<issue_to_address>
**issue (typo):** Fix the typo in the imported `BuiltinAgentConfig` class name.

The import currently uses `BuiltinAgnentConfig`, but the correct class name (as used in the docs and the `builtin=` argument) is `BuiltinAgentConfig`. Please update the import to use the correct spelling.

```suggestion
from amrita_core.config import AmritaConfig, FunctionConfig, LLMConfig, CookieConfig, BuiltinAgentConfig
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread docs/guide/api-reference/classes/AmritaConfig.md Outdated
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying amritacore with  Cloudflare Pages  Cloudflare Pages

Latest commit: a8e1298
Status:⚡️  Build in progress...

View logs

@JohnRichard4096
Copy link
Copy Markdown
Member Author

@sourcery-ai title

@sourcery-ai sourcery-ai Bot changed the title Docs: Fix problems Refine config docs and fix matcher required param detection Mar 16, 2026
@JohnRichard4096 JohnRichard4096 merged commit e692feb into main Mar 16, 2026
3 of 4 checks passed
@JohnRichard4096 JohnRichard4096 deleted the docs/update branch March 16, 2026 04:21
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.

1 participant