Skip to content

Add agent plugins support to AISDKAgent.#8

Open
mm-zacharydavison wants to merge 1 commit intomainfrom
feature/agent-plugins
Open

Add agent plugins support to AISDKAgent.#8
mm-zacharydavison wants to merge 1 commit intomainfrom
feature/agent-plugins

Conversation

@mm-zacharydavison
Copy link
Copy Markdown
Contributor

I was implementing citations feature, and it requires different implementation depending on source of citations (e.g. Anthropic Web Search, OpenAI Web Search, RAG, all operate differently).

It was making the code messy, so I created agent plugin system to use.

I will use it for citations feature.

// Sanitize messages before sending to ensure no provider-specific fields leak through (e.g. for Anthropic: 'tool_use_id')
const sanitizedInputMessages = this.sanitizeMessages(messages);

// Run onUserMessage plugin hook
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This feature itself works fine, but please note that if you modify any of the previous messages in the conversation, prompt caching will no longer work.

https://platform.claude.com/docs/ja/build-with-claude/prompt-caching

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a good point. I need to think about it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[FYI] manus famous document about context engineering says KV cache (= prompt caching in anthropic) is very important.

https://manus.im/en/blog/Context-Engineering-for-AI-Agents-Lessons-from-Building-Manus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants