Skip to content

Conversation

@waleedalzarooni
Copy link
Collaborator

@waleedalzarooni waleedalzarooni commented Dec 15, 2025

Description

Adds LarkToolkit for integrating CAMEL agents with Lark (Feishu) Open Platform - a popular enterprise collaboration platform similar to Slack + Notion.

Features

Authentication

  • Browser-based OAuth 2.0 with automatic token caching (~/.camel/lark_token.json)
  • Auto-refresh tokens before expiry
  • Supports both user tokens (documents) and tenant tokens (messaging)

16 Tools Available

Category Tools
Documents create_document, get_document, get_document_content
Blocks list_document_blocks, get_block, get_block_children, create_block, update_block, delete_block
Drive get_root_folder_token, list_folder_contents, create_folder
Messaging send_message, list_chats, get_chat, get_chat_messages

Block Types Supported: text, heading (1-9), bullet, ordered, code, quote, todo, divider, callout

Configuration

LARK_APP_ID=cli_xxxxx
LARK_APP_SECRET=xxxxxxxx

Usage

from camel.toolkits import LarkToolkit
from camel.agents import ChatAgent

toolkit = LarkToolkit()  # Auto-authenticates
agent = ChatAgent(system_message="Lark assistant", tools=toolkit.get_tools())
agent.step("Create a document called 'Notes' and add a heading 'Tasks'")

Files Added

  • camel/toolkits/lark_toolkit.py - Main implementation
  • examples/toolkits/lark_toolkit_example.py - Examples
  • test/toolkits/test_lark_toolkit.py - Unit tests

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • [ X] I have read the CONTRIBUTION guide (required)
  • [ X] I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • [X ] I have checked if any dependencies need to be added or updated in pyproject.toml and uv lock
  • [ X] I have updated the tests accordingly (required for a bug fix or a new feature)
  • [ X] I have updated the documentation if needed:
  • [ X] I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

@waleedalzarooni waleedalzarooni self-assigned this Dec 15, 2025
@waleedalzarooni waleedalzarooni added the Waiting for Update PR has been reviewed, need to be updated based on review comment label Dec 15, 2025
@waleedalzarooni waleedalzarooni marked this pull request as draft December 15, 2025 16:35
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 15, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the Review Required PR need to be reviewed label Dec 15, 2025
@waleedalzarooni waleedalzarooni linked an issue Dec 15, 2025 that may be closed by this pull request
2 tasks
@waleedalzarooni waleedalzarooni removed the Review Required PR need to be reviewed label Dec 15, 2025
@Pakchoioioi
Copy link

@waleedalzarooni thanks for the contribution. I suppose that would be better that the Lark integration should allow:

Agents to access Lark data from:

  • Direct message
  • IM group chats message
  • Lark Docs (Feishu Documents)

@Wendong-Fan Wendong-Fan added this to the Sprint 45 milestone Dec 22, 2025
@waleedalzarooni waleedalzarooni marked this pull request as ready for review December 22, 2025 15:15
@waleedalzarooni
Copy link
Collaborator Author

@Wendong-Fan @a7m-1st @fengju0213 @JINO-ROHIT There are a couple of conflicts however I don't want to resolve them on the command line in case all the changes in master get included in the diff making reviews difficult. I propose that after reviews are completed I can create a commit updating the branch to master before we merge.

@waleedalzarooni waleedalzarooni added Review Required PR need to be reviewed P0 Task with high level priority and removed Waiting for Update PR has been reviewed, need to be updated based on review comment labels Dec 22, 2025
Copy link
Collaborator

@a7m-1st a7m-1st left a comment

Choose a reason for hiding this comment

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

Hi there @waleedalzarooni thanks for the PR, those are my analysis after static review.

I am yet to test it, though I hope meanwhile you can make those simple changes to maintain consistency.

Comment on lines 765 to 770

response = requests.post(
url, headers=headers, json=body, timeout=30
)
result = response.json()

Copy link
Collaborator

Choose a reason for hiding this comment

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

16 instances use hard coded timeouts, but we defined it in Args. Perhaps need to use self.timeout:

timeout (Optional[float]): Request timeout in seconds.

Copy link
Collaborator

@fengju0213 fengju0213 left a comment

Choose a reason for hiding this comment

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

thanks @waleedalzarooni left some comments

logger.error(f"Error getting document: {e}")
return {"error": f"Error getting document: {e!s}"}

def lark_get_document_content(
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like there are query parameters can be added
image

logger.error(f"Error listing blocks: {e}")
return {"error": f"Error listing blocks: {e!s}"}

def lark_get_block(
Copy link
Collaborator

Choose a reason for hiding this comment

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

image i suggest using the same api name in lark doc to replace all toolkit methods

self,
document_id: str,
block_id: str,
parent_block_id: Optional[str] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

self,
folder_token: Optional[str] = None,
page_size: int = 50,
page_token: Optional[str] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

logger.error(f"Error listing folder contents: {e}")
return {"error": f"Error listing folder contents: {e!s}"}

def lark_get_root_folder_token(self) -> Dict[str, Any]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

betterbetter to unfiy the name
image

def lark_create_folder(
self,
name: str,
folder_token: Optional[str] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

image its a required parameter

self,
receive_id: str,
content: str,
receive_id_type: Literal[
Copy link
Collaborator

Choose a reason for hiding this comment

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

image some parameters are required

Copy link
Collaborator

@fengju0213 fengju0213 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

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

thanks @waleedalzarooni and @fengju0213 and sorry for the late review, added one enhance PR: #3685, feel free to check and leave your comment

@Wendong-Fan Wendong-Fan merged commit 986eda5 into master Jan 13, 2026
13 checks passed
@Wendong-Fan Wendong-Fan deleted the feat/lark-integration branch January 13, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P0 Task with high level priority Review Required PR need to be reviewed

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Feature Request] Integrate Lark

5 participants