AI & Agents

How to Implement Semantic Search with Fastio API

How to implement semantic search with Fastio API starts with enabling Intelligence Mode on a workspace. This auto-indexes files for natural language queries, going beyond keyword matches to retrieve contextually relevant content. Agents can then use the AI chat endpoints to search workspaces, respecting file permissions automatically. Fastio handles vector embeddings internally, so developers focus on API calls rather than infrastructure.

Derek Labian 9 min read Updated
Fastio auto-indexes files for meaning-based retrieval

What Is Semantic Search in Fastio?

Semantic search in Fastio finds files by meaning, not exact keywords. For example, query "Q3 contracts with Acme" to retrieve relevant documents even without those words in filenames.

It relies on Intelligence Mode, which indexes files with vector embeddings for RAG. Queries go through AI chat endpoints that retrieve and cite sources. This improves retrieval accuracy for agent workflows.

Unlike keyword search, semantic search understands context. It combines full-text indexing with AI to handle synonyms, intent, and relationships.

AI summaries and indexing in action

Prerequisites and Account Setup

Start by creating a Fastio account (see /pricing/ for plans and the 14-day Business Trial).

Use the API base URL https://api.fast.io/current/. Get a JWT from GET /current/user/auth/ with HTTP Basic auth, or create an API key with POST /current/user/auth/key/; send either as a Bearer token.

Code example for agent signup (adapt for your LLM):

curl -X POST https://api.fast.io/current/user/ \
  -d "first_name=Agent" \
  -d "last_name=Search" \
  -d "email_address=agent@example.com" \
  -d "password=$PASSWORD" \
  -d "tos_agree=true" \
  -d "agent=true"

Verify email, then create an organization:

curl -X POST https://api.fast.io/current/org/create/ \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -d "name=My Agent Org" \
  -d "domain=agent-search"

A new organization must select a paid plan before it can create workspaces or use resources.

Create and Configure a Workspace

Workspaces hold files. Create one:

curl -X POST https://api.fast.io/current/org/{org_id}/create/workspace/ \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -d "folder_name=semantic-search-ws" \
  -d "name=Semantic Search Workspace" \
  -d "perm_join=Member or above" \
  -d "perm_member_manage=Admin or above"

Intelligence Mode, which auto-indexes files, is on by default for a new workspace. To turn it on later, POST /current/workspace/{workspace_id}/update/ with intelligence=true.

Uploaded files are then indexed automatically and reach the indexed AI state.

Check status: GET /current/workspace/{workspace_id}/storage/root/list/ and read each node's ai.state field.

Agent building intelligent workspace
Fastio features

Build Semantic Search Now

Get started with Fastio intelligent workspaces. Explore plans and the 14-day Business Trial at /pricing/.

Upload Files for Indexing

Chunked uploads for large files. First create an upload session:

curl -X POST https://api.fast.io/current/upload/ \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -d "name=document.pdf" \
  -d "size=10485760" \
  -d "action=create" \
  -d "instance_id={workspace_id}" \
  -d "folder_id=root"

Upload chunks to /current/upload/{upload_id}/chunk/, then complete with /current/upload/{upload_id}/complete/.

Or import from URL: POST /current/web_upload/ with source_url, file_name, profile_id (the workspace ID) and profile_type=workspace.

Wait for the file's ai.state to reach indexed. Indexed files support semantic queries.

Execute Semantic Searches via API

Use an AI chat for semantic search with cited answers. With no files attached, the agent can search the whole indexed workspace.

Create chat:

curl -X POST https://api.fast.io/current/workspace/{workspace_id}/ai/agent/ \
  -H "Authorization: Bearer $JWT_TOKEN" \
  -d "question=Find contracts mentioning indemnity from last quarter"

The response returns thread.thread_id (the chat ID) and turn.turn_id (the message ID). Long-poll GET /current/activity/poll/{workspace_id}?wait=95 until the ai_chat:{chat_id} key changes, then GET /current/workspace/{workspace_id}/ai/agent/{chat_id}/message/{message_id}/details/.

The answer's result.citations list each cited file's nodeId with page and snippet entries.

To focus a chat on one folder, attach it as a folder reference item in the references array.

Numbered API flow:

  1. POST /ai/agent/ to create the chat.
  2. Long-poll /activity/poll/{workspace_id}, then GET .../message/{message_id}/details/.
  3. Parse citations for relevant files.

Scoped Searches and Permissions

Permissions are enforced automatically. Queries respect member roles.

On /storage/search/, scope to a folder: folders_scope={folder_node_id}:2.

Multi-file: files_scope={node1}:{version1},{node2}:{version2}.

For shares: use the /current/share/{share_id}/ versions of the search and AI routes.

Edge case: files whose ai.state is not indexed are left out of RAG.

Test with small set first.

Auditing search results and permissions

Best Practices and Troubleshooting

  • Monitor credits: GET /current/org/{org_id}/billing/usage/limits/credits/.
  • Poll activity: /activity/poll/{entity_id}.
  • Handle errors: check the HTTP status, such as 429 for rate limits.
  • Scale: Poll the realtime activity feed or use the WebSocket events feed.

Common issues:

Issue Fix
No results Ensure intelligence is on and files are indexed
402 Check the error code: no active plan (1688), upgrade required (1695) or credit limit exceeded (1696)
429 Respect rate limits

Integrate with MCP for a consolidated MCP toolset in agent frameworks.

Frequently Asked Questions

How do I query Fastio via API?

Authenticate with JWT, use `/ai/agent/` for cited answers or `/storage/search/` for keyword and semantic search. Base: https://api.fast.io/current/.

Does Fastio support vector embeddings?

Yes, Intelligence Mode auto-generates embeddings for RAG. No external DB needed; query via chat endpoints.

Does Fastio offer a trial?

Fastio provides a 14-day Business Trial requiring a credit card, with plans starting at Starter ($9.99/mo); see /pricing/.

How to handle large files?

Chunked uploads up to 25 GB on the Starter plan, 50 GB on Business and 100 GB on Enterprise. Previews and indexing automatic.

Can agents collaborate with humans?

Yes, invite via members API. Shared workspaces with real-time presence.

Related Resources

Fastio features

Build Semantic Search Now

Get started with Fastio intelligent workspaces. Explore plans and the 14-day Business Trial at /pricing/.