-
Notifications
You must be signed in to change notification settings - Fork 189
Add Tendem integration #562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tendemmcp
wants to merge
1
commit into
deepset-ai:main
Choose a base branch
from
tendemmcp:add-tendem-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| --- | ||
| layout: integration | ||
| name: Tendem | ||
| description: Delegate tasks to vetted human experts - research, writing, analysis, and data work. | ||
| authors: | ||
| - name: Tendem | ||
| socials: | ||
| github: Toloka | ||
| repo: https://github.com/Toloka/tendem-mcp | ||
| report_issue: https://github.com/Toloka/tendem-mcp/issues | ||
| type: Tool Integration | ||
| version: Haystack 2.0 | ||
| toc: true | ||
| --- | ||
|
Comment on lines
+1
to
+14
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a logo we could add here? |
||
| ### **Table of Contents** | ||
| - [Overview](#overview) | ||
| - [Installation](#installation) | ||
| - [Usage](#usage) | ||
| - [License](#license) | ||
|
|
||
| ## Overview | ||
|
|
||
| [Tendem](https://tendem.ai) is a hybrid AI + human task service, exposed to Haystack as a | ||
| remote MCP server. Your agent submits a task in natural language; Tendem's orchestrator | ||
| scopes it and quotes a transparent price; after explicit approval a vetted human expert | ||
| executes it and returns verified results as markdown plus files. | ||
|
|
||
| This gives a Haystack `Agent` a way to hand off the work that a model alone cannot reliably | ||
| finish — research and competitive analysis, fact-checking, copywriting and editing, design | ||
| review, presentation polish, data cleaning and list building. Tendem declines data scraping | ||
| and extraction tasks by policy, and quick general-knowledge questions are better answered by | ||
| the model itself. | ||
|
|
||
| The server is hosted at `https://mcp.tendem.ai/mcp` over streamable HTTP, so there is no | ||
| Tendem-specific Haystack package to install — the | ||
| [MCP integration](https://haystack.deepset.ai/integrations/mcp) connects to it directly. | ||
|
|
||
| The main tools it exposes are `create_task`, `send_message` and `read_chat` (agent-to-agent | ||
| scoping), `get_contract` (scope and price), `approve_task`, `get_task` and `get_task_result`. | ||
|
|
||
| > Tasks are billed. `create_task` and scoping are free; nothing is charged until | ||
| > `approve_task` is called, so keep a human in the loop before approving a quote. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install mcp-haystack | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| Interactive clients authenticate with OAuth 2.0 on first use. For scripts and pipelines, | ||
| create an API key at [agent.tendem.ai/tokens](https://agent.tendem.ai/tokens) and pass it as | ||
| an `Authorization` header: | ||
|
|
||
| ```bash | ||
| export TENDEM_AUTH="ApiKey <your-token>" | ||
| ``` | ||
|
|
||
| ### Load the Tendem tools | ||
|
|
||
| ```python | ||
| from haystack.utils import Secret | ||
| from haystack_integrations.tools.mcp import MCPToolset, StreamableHttpServerInfo | ||
|
|
||
| toolset = MCPToolset( | ||
| server_info=StreamableHttpServerInfo( | ||
| url="https://mcp.tendem.ai/mcp?utm_hash=b3b2da7bd9", | ||
|
|
||
| headers={"Authorization": Secret.from_env_var("TENDEM_AUTH")}, | ||
| ), | ||
| ) | ||
|
|
||
| for tool in toolset: | ||
| print(tool.name) | ||
| ``` | ||
|
|
||
| ### Use it in an Agent | ||
|
|
||
| ```python | ||
| from haystack.components.agents import Agent | ||
| from haystack.components.generators.chat import OpenAIChatGenerator | ||
| from haystack.dataclasses import ChatMessage | ||
| from haystack.utils import Secret | ||
| from haystack_integrations.tools.mcp import MCPToolset, StreamableHttpServerInfo | ||
|
|
||
| toolset = MCPToolset( | ||
| server_info=StreamableHttpServerInfo( | ||
| url="https://mcp.tendem.ai/mcp?utm_hash=b3b2da7bd9", | ||
| headers={"Authorization": Secret.from_env_var("TENDEM_AUTH")}, | ||
| ), | ||
| tool_names=["create_task", "read_chat", "send_message", "get_contract", "get_task"], | ||
|
|
||
| ) | ||
|
|
||
| agent = Agent( | ||
| chat_generator=OpenAIChatGenerator(model="gpt-4o-mini"), | ||
| tools=list(toolset), | ||
| system_prompt=( | ||
| "You can delegate work to human experts through Tendem. Pass the user's own words " | ||
| "into create_task and let Tendem drive scoping. Always call get_contract and show " | ||
| "the scope and price to the user, and never call approve_task without an explicit " | ||
| "go-ahead. Poll with get_task(task_id, wait_for_change_seconds=30) rather than " | ||
| "looping." | ||
| ), | ||
| ) | ||
|
|
||
| result = agent.run( | ||
| messages=[ | ||
| ChatMessage.from_user( | ||
| "Have a human expert compare the top 5 open-source vector databases " | ||
| "on licensing and hybrid search support, with sources." | ||
| ) | ||
| ] | ||
| ) | ||
| print(result["messages"][-1].text) | ||
| ``` | ||
|
|
||
| Selecting a subset of tools with `tool_names` keeps the approval and cancellation tools out | ||
| of the model's reach, which is a good default for unattended pipelines. | ||
|
|
||
| ### Retrieving results | ||
|
|
||
| Once a task is approved and executed, `get_task_result` returns markdown plus pre-signed URLs | ||
| for any files the expert produced, so results can be fed straight into a Haystack pipeline — | ||
| for example converted and written to a Document Store. | ||
|
|
||
| ## License | ||
|
|
||
| The Tendem MCP server is a hosted commercial service; use is governed by the | ||
| [Tendem terms](https://tendem.ai). The client-side plugin configuration in | ||
| [Toloka/tendem-mcp](https://github.com/Toloka/tendem-mcp) is Apache-2.0 licensed. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an
mcpproperty to mark MCP-based integrations.